This is done with the automatic variables such as ‘$ˆ’ (see Automatic variables).
For instance, the value of
‘$ˆ’
is a list of all the dependencies of the rule, including the names of the
directories in which they were found, and the value of ‘$@’
is the target, as in the following example.
The CFLAGS variable exists so you can specify flags for C compilation by implicit rules; we use it here for consistency so it will affect all C compilations uniformly; see Variables used by implicit rules.
Often the dependencies include header files as well, which you do not want to mention in the commands.
The ‘$<’
automatic variable is just the first dependency, as in the following.