Hello, I am experiencing unexpected results if both the $(file ...) function (that was introduced with GNU make version 4) and other command-line utilities are used to produce a single file.
Here is a minimal example. (The "echo" command is used for demonstration purposes, it stands for any external command-line utility writing to standard output.) $ cat Makefile all: /bin/echo "LINE FROM ECHO COMMAND" > file.txt $(file >>file.txt,LINE FROM FILE FUNCTION) $ make /bin/echo "LINE FROM ECHO COMMAND" > file.txt $ cat file.txt LINE FROM ECHO COMMAND 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. The $(file ...) function alone works as expected: $ cat Makefile all: $(file >file.txt,LINE 1 FROM FILE FUNCTION) $(file >>file.txt,LINE 2 FROM FILE FUNCTION) $ make make-4.1: 'all' is up to date. $ cat file.txt LINE 1 FROM FILE FUNCTION LINE 2 FROM FILE FUNCTION All tests are done with GNU make 4.1 on Mac OS X. Perhaps I am misunderstanding something completely? Any insight is highly appreciated. Best regards, Martin _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make