So, to compile my executable, I need to have the library locations set up correctly. The problem is, the setup comes from a bunch of scripts that do the env variable exporting, and what needs to be set up may change (beyond my control) so I need to use those scripts instead of copying their functionality. To compile in regular command line, I need to do something like:
setup library1
setup library2
source some_other_setup_script.bash
g++ blah.c
# setup is a executable on my system that run some scripts
How would I write a makefile that accomplishes that? As far as I tried, the env variable exporting does not carry over (i.e. “export VAR=remember; echo $VAR” won’t work)
If variable exporting is not working the way it does on your command line, that suggests that Make is choosing a shell different from the one you’re using, with different syntax for handling variables (
export VAR=remember; echo $VARworks fine for me). Make uses/bin/shby default, but you can override this with the SHELL variable, which Make does not import from the environment. I suggest setting SHELL (in the Makefile) to whatever you’re using in your environment and trying theexport VAR=rememberexperiment again.