A Makefile contains:
- Comments
# comments start with `#' and end with the new-line
- Macro Definitions
The macro_name can contain any upper- or lower-case letters, digits, and the underscore (_). Upper-case letters are prefered by convention. Macro substitution occurs when given as $(macro_name) or ${macro_name}. Single character $(macro_name)s are special and don't require the parentheses ``()'' or brackets ``{}'' for substitution.macro_name = string
- Dependency Lines
Defines the dependency relationships. Actions follow. There can not be any space before the targets.targets :[:] [prerequisites] [; [commands]]
- Suffix or Implicit Rules
Defines implicit or generic rules for creating a file with the second suffix dependent on a file with the same base name and the first given suffix. No spaces before or between sufficessuffix[suffix] :[:]
- Actions
Actions must start with a tab, else not recognized. The shell command must be a valid single line command. The shell invocation is usually the Bourne shell (/bin/sh).<tab> [- @] shell command
- Include Statement
reads and evaluates file as if part of the current Makefile. Must not have any white-space at beginning of line.include file
$@ 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_name:s1=s2} substitutes s2 for any s1 string that occurs in the list at the end any word delimited by white-space.
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.
.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.