On Mon, 2015-07-27 at 12:47 -0500, Larry Evans wrote: > How should the which command within the for loop script be > modified to produce the same output as the which command > before the for loop script?
The recipe is run by the shell, not by make. Make simply expands the make variables and functions one time before the shell is started, then sends the results to the shell to be run, then waits for the exit code to see if it worked. The shell, being a separate shell process, cannot access make's database of variables. So, you cannot write a _shell_ loop that uses _make_ computed variables. If you want to use make variables, you have to use a make loop via $(foreach ...) or similar. compiles: make -version @echo "COMPILE.gcc=" $(COMPILE.gcc) which $(COMPILE.gcc) for HOW_CXX in $(foreach C,gcc,$(COMPILE.$C)) ; do \ which $$HOW_CXX ; \ done ; _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make