If you're using GNU make, you need to export
the variables.
Use makefile variables inside tcsh
Question
I created a tcsh
script, which I want to call through a Makefile
environment. Therefore
I want to reference variables inside this tcsh script, which I have defined in the Makefile
environment.
I tried to reference environment variables as $?VARIABLE
, but this does not work on variables from the Makefile
environment.
How can I do this?
Solution 2
OTHER TIPS
Any dollar sign needs to be represented as a $$
in a make rule if it is to be used in commands. Note that it is extremely unwise to program in tcsh. In addition, make uses /bin/sh
to execute commands, so you cannot use tcsh syntax in make rules.
All you could do, if you must, is something along
MAKEVAR = foo
target:
tcsh -c 'echo $$HOME $(MAKEVAR)'
What everybody else does is
MAKEVAR = foo
ANOTHERVAR = bar
target:
MAKEVAR=$(MAKEVAR) ANOTHERVAR=$(ANOTHERVAR) script.sh
This works for all make
versions, not just GNU make.