Skip to content

Instantly share code, notes, and snippets.

@Zialus
Created December 4, 2016 23:25
Show Gist options
  • Save Zialus/bbe23014b283cbe0e45612c73ccea367 to your computer and use it in GitHub Desktop.
Save Zialus/bbe23014b283cbe0e45612c73ccea367 to your computer and use it in GitHub Desktop.
GNU Make Special macros
Now all those $@ thingees that appear in the example above and elsewhere in the makefile are clearly not plain old macros, since they're never defined and yet this makefile works quite well, I promise. The reason is that there are a number of special macros with one character names that are only useable as part of a dependency rule:
$@
The file name of the target.
$<
The name of the first dependency.
$*
The part of a filename which matched a suffix rule.
$?
The names of all the dependencies newer than the target separated by spaces.
$^
The names of all the dependencies separated by spaces, but with duplicate names removed.
$+
The names of all the dependencies separated by spaces with duplicate names included and in the same order as in the rule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment