On 14.03.16 14:43, Paul Smith wrote: > On Mon, 2016-03-14 at 14:32 +0100, Martin Reinders wrote: >> $ cat Makefile >> all: >> /bin/echo "LINE FROM ECHO COMMAND" > file.txt >> $(file >>file.txt,LINE FROM FILE FUNCTION) > >> I expected that the echo command writes one line to the file, and the >> $(file ...) function appends another line. But as one can see, the >> file contains the output from the echo command only. It seems to me >> that the echo command is executed _after_ executing the $(file ...) >> function. > >> Perhaps I am misunderstanding something completely? Any insight is >> highly appreciated. > > The thing you're missing is that GNU make will always expand the ENTIRE > recipe, before it starts ANY part of the recipe. So, all variables and > functions, including $(file ...), will be expanded first, then make will > start to run the recipe lines. So the $(file ...) function happens > before the echo command, as you've seen. >
That makes perfect sense, thank you very much! _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make