Makefiles

Some notes on GNU Make. I always have to look-up these in the manual. Here now for my own convenience.

GNU Make automatic variables:

From http://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html.

  • $@
    The file name of the target of the rule.
  • $%
    The target member name
  • $<
    The name of the first prerequisite.
  • $?
    The names of all the prerequisites that are newer.
  • $^
    The names of all the prerequisites.

To include files in Makefile only if they exist:

ifneq ($(wildcard _incfile_),)
  include _incfile_
endif