Using commands in a make description file
A command is any string of characters except a # (pound sign) or a new-line character. A command can use a # only if it is in quotation marks.
Commands can appear either after a semicolon on a dependency line or on lines beginning with a tab that immediately follows a dependency line.
When defining the command sequence for a particular target, specify one command sequence for each target in the description file, or else separate the command sequences for special sets of dependencies. Do not do both.
To use one command sequence for every use of the target file, use a single : (colon) following the target name on the dependency line. For example:
test: dependency list1...
command list...
.
.
.
test: dependency list2...defines a target name, test, with a set of parent files and a set of commands to create the file. The target name, test, can appear in other places in the description file with another dependency list. However, that name cannot have another command list in the description file. When one of the files that test depends on changes, the make command runs the commands in that one command list to create the target file named test.
To specify more than one set of commands to create a particular target file, enter more than one dependency definition. Each dependency line must have the target name, followed by :: (two colons), a dependency list, and a command list that the make command uses if any of the files in the dependency list changes. For example:
test:: dependency list1...
command list1...
test:: dependency list2...
command list2...defines two separate processes to create the target file, test . If any of the files in dependency list1 changes, themake command runs command list1. If any of the files in dependency list2 changes, the make command runs command list2. To avoid conflicts, a parent file cannot appear in both dependency list1 and dependency list2.
Note: The make command passes the commands from each command line to a new shell. Be careful when using commands that have meaning only within a single shell process; for example, cd and shell commands. The make command discards these results before running the commands on the next line.
To group commands together, use the \ (backslash) at the end of a command line. The make command then continues that command line into the next line in the description file. The shell sends both of these lines to a single new shell.