Makefiles - ``Make'' Summary

LeftRight

A Makefile contains:

Dependency and Action Lines

Internal Macros

$@ the name of the file to be ``made''
$? the set of dependent names that are younger than the target
$< the name of the related file that caused the action (the precursor to the target) - this is only for suffix rules
$* the shared prefix of the target and dependent - only for suffix rules
$$ escapes macro substitution, returns a single ``$''.

Macro String Substitution

${macro_name:s1=s2} substitutes s2 for any s1 string that occurs in the list at the end any word delimited by white-space.

Special Macros

SHELL tells make which command shell to invoke for actions. This is not always honored, and in general set it to /bin/sh and write all actions for the Bourne shell.
VPATH the path including the current working directory that make will search for prerequisites to satisfy the rules.

Special Targets

.DEFAULT Its associated actions are invoked whenever make is given a target that is not defined.
.IGNORE Ignores all return codes from actions. Same as command-line option ``-l''. By default make will stop processing whenever a non-zero return status is received from an action.
.SILENT Will not echo the action as its processed. Same as command-line option ``-s''. By default make will echo the action to stdout prior to invocation.
.SUFFIXES Appends any given ``prerequisites'' to the list of suffixes with implicit rules. If none are given then wipe the list of suffixes.

LeftRight
Slide 11