maux
Star on GitHub Buy me a coffee

Manual / make

make(1)

MAKE(1) General Commands Manual MAKE(1)

make - keep files up to date

make [ -eikNnpqrSst ] [ -f makefile ] [ name=value ] ... [ target ] ...

Make reads a makefile of rules and, for each target named on the command line, brings that target's prerequisites up to date and then runs the target's recipe if any prerequisite is newer than the target or the target does not exist. With no target operand it builds the first rule in the file whose target does not begin with a period.

A makefile is made of four kinds of line:

NAME = value
A macro definition. Later, $(NAME), ${NAME} or, for a one-character name, $N, expands to the value. $$ is a literal dollar sign, and an undefined macro expands to nothing. A macro given on the command line overrides one in the makefile; an exported environment variable is a macro too, and -e makes the environment win over the makefile.
A rule. Several targets on one line make several rules sharing the prerequisites and the recipe.
<tab>command
A recipe line for the rule above it. A leading @ suppresses the echo, a leading - ignores a nonzero exit, and a leading + runs the line even under -n.
# comment
A comment, to the end of the line. Comments are recognised on macro and rule lines only, never inside a recipe: with no shell in the way (see BUGS) a recipe line IS the command.

The makefile may be in either text convention: maux text (high bit set, tab $89, lines ended by $8D) or ProDOS-standard text (low ASCII, tab $09, lines ended by $0D); both build the same bytes.

A line ending in \ is continued on the next; the join is one blank and the continuation's own indentation is dropped.

A target with no rule of its own can be made by an inference rule. .SUFFIXES lists the suffixes to try, in order; a second .SUFFIXES adds to the list and an empty one clears it. A rule whose target is two suffixes written together says how to make the second from the first, so with

.SUFFIXES: .o .c
.c.o:
	cc -c $<

the target prog.o is made from prog.c if that file exists or is itself a target. There are NO built-in suffixes or rules: this system has no compiler to write one for, so a makefile declares its own.

A suffix here need not begin with a period. Make joins the pair to name the rule and never takes it apart again, so .SUFFIXES: R .S with a rule .SR: makes CATMR from CATM.S, which is what maux's own self-rebuild uses.

Inside a recipe:

$@
the target.
$<
the prerequisite an inference rule was chosen for; in an ordinary rule, the first prerequisite.
$*
the target with its suffix removed.
$?
the prerequisites that are newer than the target. It is recomputed when it is used, so it costs one stat(2) per prerequisite.

.SILENT and .IGNORE do what -s and -i do. .DEFAULT gives a recipe for any target that has no rule and no file. .PRECIOUS and .POSIX are accepted and do nothing.

Environment variables override macros set in the makefile.
Read makefile instead of MAKEFILE. The name may be attached (-fname).
Ignore the exit status of every command.
On a failing command, abandon that target but carry on with targets that do not depend on it.
Write the commands that would run; run none of them. A line beginning @ is still written.
Write the macro definitions and the target descriptions.
Say nothing and run nothing; exit 1 if any named target is out of date.
Clear the initial suffix list. There is no built-in list, so this does nothing and is accepted for portability.
Undo a previous -k.
Do not echo commands.
Bring each target up to date by dating it, without running its recipe.

read when -f is not given.
/usr/man/MAKE
this page.

A recipe's command word is located the way sh(1) locates one: looked up on PATH, except that a word containing a slash is a path and is not searched. Unlike sh(1), make has no retry of a file that begins with #!, and a leading - carries on after a command that is not found but not after one that cannot be run. A command that cannot be found stops make with make: NAME: not found (a leading - or -i carries on).

Exit 0 if every target was already up to date or was made, 1 on any failure (or, under -q, if a target is out of date), 2 on a usage error.

There is no shell between make and the command. A recipe line is split on blanks and the program is spawned directly, so a recipe has no pipes, no redirection, no globbing, and no cd.

File times have one-minute resolution, so a target rebuilt within a minute of its source's last write compares equal to it and is judged up to date. -t and touch(1) are the way out; there is no -B to force a build.

There is no parallelism, no include, no :: rules, and -f - cannot read a makefile from the standard input.

nas(1), ld(1), ld(1), sh(1), touch(1)

September 18, 2026 maux