Currently, on clusters that use environment modules, simfactory uses the envsetup entry of the machine definition files to load modules required by the option list.
This ties together option list and machine definition file, making it hard to offer different “flavors” of the same machine.
It should be possible to instead use the information in envsetup in the Cactus option list. Since this implies that “make” needs to change its own environment the simplest way to achieve that is to have the top level Makefile load the environment then pass everything down one level:
%: export ENV_VAR="somesetting" ; $(MAKE) -f Makefile.real $(MAKECMDGOALS)
or one can try something like wrapping two Makefiles in one
.PHONY: all .SILENT: ifneq ($(MODULES_LOADED), yes) %: export ENV_VAR="dummy" ; make MODULES_LOADED=yes $(MAKECMDGOALS) else all: echo "ENV_VAR is $$ENV_VAR" endif
which has no advantage other than saving one file, so seems not best way of doing this.