Annotation of 43BSDTahoe/man/man1/make.1, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1980 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"    @(#)make.1      6.4 (Berkeley) 8/24/87
                      6: .\"
                      7: .TH MAKE 1 "August 24, 1987"
                      8: .UC 4
                      9: .SH NAME
                     10: make \- maintain program groups
                     11: .SH SYNOPSIS
                     12: .B make
                     13: [
                     14: .B \-f
                     15: makefile ] [ option ] ...
                     16: file ...
                     17: .SH DESCRIPTION
                     18: .I Make
                     19: executes commands in
                     20: .I makefile
                     21: to update
                     22: one or more target
                     23: .IR names .
                     24: .I Name
                     25: is typically a program.
                     26: If no
                     27: .B \-f
                     28: option is present, `makefile' and `Makefile' are
                     29: tried in order.
                     30: If
                     31: .I makefile
                     32: is `\-', the standard input is taken.
                     33: More than one
                     34: .B \-f
                     35: option may appear.
                     36: .PP
                     37: .I Make
                     38: updates a target if it depends on prerequisite files
                     39: that have been modified since the target was last modified,
                     40: or if the target does not exist.
                     41: .PP
                     42: .I Makefile
                     43: contains a sequence of entries that specify dependencies.
                     44: The first line of an entry is a
                     45: blank-separated list of targets, then a colon,
                     46: then a list of prerequisite files.
                     47: Text following a semicolon, and all following lines
                     48: that begin with a tab, are shell commands
                     49: to be executed to update the target.
                     50: If a name appears on the left of more than one `colon' line, then it depends
                     51: on all of the names on the right of the colon on those lines, but only
                     52: one command sequence may be specified for it.
                     53: If a name appears on a line with a double colon
                     54: .B "::"
                     55: then the command sequence following that line is performed
                     56: only if the name is out of date with respect to the names to the right
                     57: of the double colon, and is not affected by other double colon lines
                     58: on which that name may appear.
                     59: .PP
                     60: Two special forms of a name are recognized.
                     61: A name like
                     62: .IR a ( b )
                     63: means the file named
                     64: .I b
                     65: stored in the archive named
                     66: .I a.
                     67: A name like
                     68: .IR a (( b ))
                     69: means the file stored in archive
                     70: .I a
                     71: containing the entry point
                     72: .I b.
                     73: .PP
                     74: Sharp and newline surround comments.
                     75: .PP
                     76: The following makefile says that `pgm' depends on two
                     77: files `a.o' and `b.o', and that they in turn depend on
                     78: `.c' files and a common file `incl'.
                     79: .RS 
                     80: .HP
                     81: .PD 0
                     82: .nf
                     83: pgm: a.o b.o
                     84: cc a.o b.o \-lm \-o pgm
                     85: .HP
                     86: a.o: incl a.c
                     87: cc \-c a.c
                     88: .HP
                     89: b.o: incl b.c
                     90: cc \-c b.c
                     91: .fi
                     92: .RE
                     93: .PD
                     94: .PP
                     95: .I Makefile
                     96: entries of the form
                     97: .PP
                     98: .IP
                     99: string1 = string2
                    100: .PP
                    101: are macro definitions.
                    102: Subsequent appearances of 
                    103: .RI $( string1 )
                    104: or
                    105: .RI ${ string1 }
                    106: are replaced by
                    107: .IR string2 .
                    108: If
                    109: .I string1
                    110: is a single character, the parentheses or braces
                    111: are optional.
                    112: .PP
                    113: .I Make 
                    114: infers prerequisites for files for which
                    115: .I makefile
                    116: gives no construction commands.
                    117: For example, a
                    118: `.c' file may be inferred as prerequisite for a `.o' file
                    119: and be compiled to produce the `.o' file.
                    120: Thus the preceding example can be done more briefly:
                    121: .RS
                    122: .HP
                    123: .PD 0
                    124: .nf
                    125: pgm: a.o b.o
                    126: cc a.o b.o \-lm \-o pgm
                    127: .HP
                    128: a.o b.o: incl
                    129: .fi
                    130: .RE
                    131: .PD
                    132: .PP
                    133: Prerequisites are inferred according to selected suffixes
                    134: listed as the `prerequisites' for the special name `.SUFFIXES';
                    135: multiple lists accumulate;
                    136: an empty list clears what came before.
                    137: Order is significant; the first possible name for which both
                    138: a file and a rule as described in the next paragraph exist
                    139: is inferred.
                    140: The default list is
                    141: .IP
                    142: \&.SUFFIXES: .out .o .c .e .r .f .y .l .s .p
                    143: .PP
                    144: The rule to create a file with suffix
                    145: .I s2
                    146: that depends on a similarly named file with suffix
                    147: .I s1
                    148: is specified as an entry
                    149: for the `target'
                    150: .IR s1s2 .
                    151: In such an entry, the special macro $* stands for
                    152: the target name with suffix deleted, $@ for the full target name,
                    153: $< for the complete list of prerequisites,
                    154: and
                    155: $? for the list of prerequisites that are out of date.
                    156: For example, a rule for making
                    157: optimized `.o' files from `.c' files is
                    158: .IP
                    159: \&.c.o: ; cc \-c \-O \-o $@ $*.c
                    160: .PP
                    161: Certain macros are used by the default inference rules
                    162: to communicate optional arguments to
                    163: any resulting compilations.
                    164: In particular,
                    165: `CFLAGS' is used for
                    166: .IR cc (1)
                    167: options,
                    168: `FFLAGS' for
                    169: .IR f77 (1)
                    170: options,
                    171: `PFLAGS' for
                    172: .IR pc (1)
                    173: options,
                    174: and `LFLAGS' and `YFLAGS' for 
                    175: .I lex
                    176: and
                    177: .IR yacc (1)
                    178: options.  In addition, the macro `MFLAGS' is filled in
                    179: with the initial command line options supplied to 
                    180: .IR make .
                    181: This simplifies maintaining a hierarchy of makefiles as
                    182: one may then invoke 
                    183: .I make
                    184: on makefiles in subdirectories and pass along useful options
                    185: such as
                    186: .BR \-k .
                    187: .PP
                    188: The environment is read by \fImake\fP.  All variables are assumed to be
                    189: macro definitions and processed as such.  The environmental variables
                    190: are processed before any makefile and after the internal rules; thus,
                    191: macro assignments in a makefile override environmental variables.  The
                    192: \fB-e\fP option causes the environment to override the macro assignments
                    193: in a makefile.  As with macro assignments, environmental variables are
                    194: always overriden by the command line.
                    195: .PP
                    196: Another special macro is `VPATH'.
                    197: The `VPATH' macro should be set to a list of directories separated by colons.
                    198: When
                    199: .I make
                    200: searches for a file as a result of a dependency relation, it will
                    201: first search the current directory and then each of the directories on the
                    202: `VPATH' list.
                    203: If the file is found, the actual path to the file will be used, rather than
                    204: just the filename.
                    205: If `VPATH' is not defined, then only the current directory is searched.
                    206: .PP
                    207: One use for `VPATH' is when one has several programs that compile from the
                    208: same source.
                    209: The source can be kept in one directory and each set of
                    210: object files (along with a separate
                    211: .IR makefile )
                    212: would be in a separate subdirectory.
                    213: The `VPATH' macro would point to the source directory in this case.
                    214: .PP
                    215: Command lines are executed one at a time, each by its
                    216: own shell.
                    217: A line is printed when it is executed unless
                    218: the special target `.SILENT'
                    219: is in 
                    220: .I makefile,
                    221: or the first character of the command is `@'.
                    222: .PP
                    223: Commands returning nonzero status (see
                    224: .IR intro (1))
                    225: cause
                    226: .I make
                    227: to terminate unless
                    228: the special target `.IGNORE' is in
                    229: .I makefile
                    230: or the command begins with
                    231: <tab><hyphen>.
                    232: .PP
                    233: Interrupt and quit cause the target to be deleted
                    234: unless the target is a directory or
                    235: depends on the special name `.PRECIOUS'.
                    236: .PP
                    237: Other options:
                    238: .TP
                    239: .B \-e
                    240: Environmental variables override assignments within makefiles.
                    241: .TP
                    242: .B \-i
                    243: Equivalent to the special entry `.IGNORE:'.
                    244: .TP
                    245: .B \-k
                    246: When a command returns nonzero status,
                    247: abandon work on the current entry, but
                    248: continue on branches that do not depend on the current entry.
                    249: .TP
                    250: .B \-n
                    251: Trace and print, but do not execute the commands
                    252: needed to update the targets.
                    253: .TP
                    254: .B \-t
                    255: Touch, i.e. update the modified date of targets, without
                    256: executing any commands.
                    257: .TP
                    258: .B \-r
                    259: Equivalent to an initial special entry `.SUFFIXES:'
                    260: with no list.
                    261: .TP 
                    262: .B \-s
                    263: Equivalent to the special entry
                    264: `.SILENT:'.
                    265: .SH FILES
                    266: makefile, Makefile
                    267: .br
                    268: .SH "SEE ALSO"
                    269: sh(1), touch(1), f77(1), pc(1), getenv(3)
                    270: .br
                    271: S. I. Feldman
                    272: .I
                    273: Make \- A Program for Maintaining Computer Programs
                    274: .SH BUGS
                    275: Some commands return nonzero status inappropriately.
                    276: Use
                    277: .B \-i
                    278: to overcome the difficulty.
                    279: .br
                    280: Commands that are directly executed by the shell,
                    281: notably
                    282: .IR  cd (1),
                    283: are ineffectual across newlines in
                    284: .I make.
                    285: .PP
                    286: `VPATH' is intended to act like the System V `VPATH' support,
                    287: but there is no guarantee that it functions identically.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.