diff --git a/Makefile b/Makefile index 823bb7cc..ba608d09 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,7 @@ setmanpath ?= y setbinpath ?= y setdotmodulespath ?= n setswitchml ?= y +usecverdotmodulespath ?= n all: initdir doc ChangeLog .makeinstallpath @@ -44,6 +45,8 @@ all: initdir doc ChangeLog .makeinstallpath @echo "mandir := $(mandir)" >>$@ @echo "docdir := $(docdir)" >>$@ @echo "setdotmodulespath := $(setdotmodulespath)" >>$@ + @echo "usecverdotmodulespath := $(usecverdotmodulespath)" >>$@ + @echo "cverinitdir := $(cverinitdir)" >>$@ initdir: make -C init all prefix=$(prefix) libexecdir=$(libexecdir) \ @@ -53,7 +56,7 @@ initdir: modulepath=$(modulepath) loadedmodules=$(loadedmodules) \ setdotmodulespath=$(setdotmodulespath) cverinitdir=$(cverinitdir) \ cverbindir=$(cverbindir) cvermandir=$(cvermandir) \ - setswitchml=$(setswitchml) + setswitchml=$(setswitchml) usecverdotmodulespath=$(usecverdotmodulespath) doc: make -C doc all prefix=$(prefix) libexecdir=$(libexecdir) \ diff --git a/init/Makefile b/init/Makefile index 82b0255e..7e4ec28d 100644 --- a/init/Makefile +++ b/init/Makefile @@ -28,10 +28,13 @@ setmanpath ?= y setbinpath ?= y # define switchml if we know where C version is installed +# same applies for using C version .modulespath config ifeq ($(cverinitdir),) override setswitchml := n + override usecverdotmodulespath := n else setswitchml ?= y + usecverdotmodulespath ?= n endif # reset C version path if they are standard system path (to ensure # switchml will not remove them from PATH or MANPATH) @@ -43,7 +46,11 @@ ifneq ($(findstring $(cvermandir),/usr/share/man /usr/local/share/man),) endif # kind of config file to use: modulerc or both .modulespath and modulerc -setdotmodulespath ?= n +ifeq ($(usecverdotmodulespath),y) + override setdotmodulespath := y +else + setdotmodulespath ?= n +endif ifeq ($(setdotmodulespath),y) ALL_CONFIG := .modulespath modulerc # modulepath information will only be set in .modulespath @@ -76,6 +83,8 @@ all: $(ALL_SHELLS) $(ALL_CONFIG) .makeinstallpath @echo "datarootdir := $(datarootdir)" >>$@ @echo "mandir := $(mandir)" >>$@ @echo "setdotmodulespath := $(setdotmodulespath)" >>$@ + @echo "usecverdotmodulespath := $(usecverdotmodulespath)" >>$@ + @echo "cverinitdir := $(cverinitdir)" >>$@ # if enabled translate to keep text after markup elsewhere remove the # entire line @@ -125,6 +134,12 @@ tcsh: csh.in Makefile profile.sh: profile.sh.in Makefile $(translate-in-script) +# make link on C version installed .modulespath +ifeq ($(usecverdotmodulespath),y) +.modulespath: + ln -s $(cverinitdir)/$@ $@ +endif + install: all mkdir -p $(initdir) mkdir -p $(initdir)/ksh-functions @@ -133,7 +148,7 @@ install: all cp bash_completion $(initdir)/ cp ksh $(initdir)/ksh-functions/module cp ksh $(initdir)/ksh-functions/switchml - cp $(ALL_CONFIG) $(initdir)/ + cp -P --remove-destination $(ALL_CONFIG) $(initdir)/ uninstall: rm -f $(addprefix $(initdir)/,$(ALL_SHELLS) bash_completion)