32v 1m make
From Computer History Wiki
MAKE(1) UNIX Programmer's Manual MAKE(1)
make - maintain program groups
make [ -f makefile ] [ option ] ... file ...
_M_a_k_e executes commands in _m_a_k_e_f_i_l_e to update one or more target _n_a_m_e_s. _N_a_m_e is typically a program. If no -f option is present, `makefile' and `Makefile' are tried in order. If _m_a_k_e_f_i_l_e is `-', the standard input is taken. More than one -f option may appear
_M_a_k_e updates a target if it depends on prerequisite files that have been modified since the target was last modified, or if the target does not exist.
_M_a_k_e_f_i_l_e contains a sequence of entries that specify depen- dencies. The first line of an entry is a blank-separated list of targets, then a colon, then a list of prerequisite files. Text following a semicolon, and all following lines that begin with a tab, are shell commands to be executed to update the target.
Sharp and newline surround comments.
The following makefile says that `pgm' depends on two files `a.o' and `b.o', and that they in turn depend on `.c' files and a common file `incl'.
pgm: a.o b.o cc a.o b.o -lm -o pgm a.o: incl a.c cc -c a.c b.o: incl b.c cc -c b.c
_M_a_k_e_f_i_l_e entries of the form
string1 = string2
are macro definitions. Subsequent appearances of $(_s_t_r_i_n_g_1) are replaced by _s_t_r_i_n_g_2. If _s_t_r_i_n_g_1 is a single character, the parentheses are optional.
_M_a_k_e infers prerequisites for files for which _m_a_k_e_f_i_l_e gives no construction commands. For example, a `.c' file may be inferred as prerequisite for a `.o' file and be compiled to produce the `.o' file. Thus the preceding example can be done more briefly:
pgm: a.o b.o cc a.o b.o -lm -o pgm a.o b.o: incl
Prerequisites are inferred according to selected suffixes listed as the `prerequisites' for the special name `.SUF- FIXES'; multiple lists accumulate; an empty list clears what came before. Order is significant; the first possible name for which both a file and a rule as described in the next paragraph exist is inferred. The default list is
.SUFFIXES: .out .o .c .e .r .f .y .l .s
The rule to create a file with suffix _s_2 that depends on a similarly named file with suffix _s_1 is specified as an entry for the `target' _s_1_s_2. In such an entry, the special macro $* stands for the target name with suffix deleted, $@ for the full target name, $< for the complete list of prere- quisites, and $? for the list of prerequisites that are out of date. For example, a rule for making optimized `.o' files from `.c' files is
.c.o: ; cc -c -O -o $@ $*.c
Certain macros are used by the default inference rules to communicate optional arguments to any resulting compila- tions. In particular, `CFLAGS' is used for _c_c and _f_7_7(1) options, `LFLAGS' and `YFLAGS' for _l_e_x and _y_a_c_c(1) options.
Command lines are executed one at a time, each by its own shell. A line is printed when it is executed unless the special target `.SILENT' is in _m_a_k_e_f_i_l_e, or the first char- acter of the command is `@'.
Commands returning nonzero status (see _i_n_t_r_o(1)) cause _m_a_k_e to terminate unless the special target `.IGNORE' is in _m_a_k_e_f_i_l_e or the command begins with <tab><hyphen>.
Interrupt and quit cause the target to be deleted unless the target depends on the special name `.PRECIOUS'.
-i Equivalent to the special entry `.IGNORE:'.
-k When a command returns nonzero status, abandon work on the current entry, but continue on branches that do not depend on the current entry.
-n Trace and print, but do not execute the commands needed to update the targets.
-t Touch, i.e. update the modified date of targets, without executing any commands.
-r Equivalent to an initial special entry `.SUFFIXES:' with no list.
-s Equivalent to the special entry `.SILENT:'.
sh(1), touch(1) S. I. Feldman _M_a_k_e - _A _P_r_o_g_r_a_m _f_o_r _M_a_i_n_t_a_i_n_i_n_g _C_o_m_p_u_t_e_r _P_r_o_g_r_a_m_s
Some commands return nonzero status inappropriately. Use -i to overcome the difficulty. Commands that are directly executed by the shell, notably _c_d(1), are ineffectual across newlines in _m_a_k_e.