I am thinking I may need to use the file function in GNU make, and just can not follow the example they give. I have looked online, but don't see any post with more explanation. Here is the example they give:
program: $(OBJECTS)
$(file >[email protected],$^)
$(CMD) $(CMDFLAGS) @[email protected]
@rm [email protected]
I think I know what it is doing at a high level as it is explained in the manual.
[email protected]
is a list of all the target files
$^
is a list of the source files
I am not sure how @[email protected]
is used on the third line or what there is an @
sign at the beginning. What does that mean please? What does it supposed to do?
The key to the operation of that recipe is given in the prose immediately preceding it in the manual:
$@
is the target file (there is only one of those in any given recipe)[email protected]
is the target file with.in
added to the end of the name.$^
is the "list" of the all the prerequisites of the target.@[email protected]
is the name of the target with.in
at the end and@
at the start.So the
$(file ...)
call in that recipe writes the list of prerequisites of the target into a file calledprogram.in
in "overwrite" mode and then passes that file name to the$(CMD)
command using the@filename
convention that was mentioned.