There are three unrelated uses of @
here.
In $@
, the character @
is the name of an automatic variable that can be used in a rule. The value of that variable is the target that the rule is building.
When @
is used at the very beginning of a recipe (command) line, just after the tab character, it causes the command not to be printed when it's about to be executed.
The character @
elsewhere isn't special.
Thus, in your example, to build program
:
- The
file
function is invoked. It writes the dependencies of the target ($^
automatic variable) to the file program.in
.
Whatever command is stored in the variable CMD
is executed, with the parameters stored in the variable CMDFLAGS
, plus the extra parameter @program.in
. What this does depends on what CMD
is.
The command rm program.in
is executed, without printing it first.
A few commands treat a parameter starting with @
as indicating a file from which to read more parameters. This is a DOS convention which came about because DOS had a stringent limit on the command line length and no way to interpolate the output of a command into a command line. It is uncommon in the Unix world since Unix doesn't have these limitations. The effect of the recipe is thus likely the same as
$(CMD) $(CMDFLAGS) $(OBJECTS)
>$@.in
is used as a file mode... but it is useful in its own way.. thanks cuonglm... – Mar 24 '15 at 16:32