Target rules are defined by a line that begins with one or more target names, followed by a colon, an optional list of dependent filenames, an optional semicolon and an optional command. Subsequent lines that begin with a tab character are command lines associated with the rule. The next line that does not begin with a tab character indicates the end of the current rule and the beginning of a new rule.
goal: target.o ; command three target.o: source.c header.h command one command two
In the above example, the Make program will read the Makefile and find the first target filename to be goal. It will then attempt to make goal up-to-date by first making its dependents (namely, target.o) up-to-date. In order to make target.o up-to-date, Make requires a rule that contains target.o as a target filename. Such a rule exists in the example Makefile with dependents source.c and header.h, which must in turn be made before target.o can be made up-to-date. Since source.c and header.h are not defined as targets in the Makefile, the Make program must use builtin rules of inference to make those files up-to-date, or it must give up and report that is doesn't know how to make the target. As it turns out, the source and header files are known by builtin rules of inference to require no further action to be made up-to-date, so the Make program can continue to make target.o now that its dependencies have fulfilled their requirements. In order to make target.o up-to-date, command one must be executed successfully, and then command two must be executed successfully after that. Finally, the goal can be made by executing the command line, command three, and the Make program will terminate.
If there are no dependencies for a target, and a target needs to be remade by the Make program, then the target is always remade. A target with no dependencies will always have its commands executed when that target needs to be remade.