home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 332_01 / make.man < prev    next >
Text File  |  1988-10-04  |  6KB  |  141 lines

  1. MAKE(1)            MS-DOS Programmer's Manual            MAKE(1)
  2.  
  3. NAME
  4.    make - maintain program groups
  5.  
  6. SYNOPSIS
  7.    make [-f <makefile>] [-ainpqrst] [<target>...]
  8.  
  9. DESCRIPTION
  10.    Make executes commands in makefile to update one or more target names. Name
  11.    is typically a program. If no -f option is present, `makefile' is tried. If
  12.    makefile is `-', the standard input is taken. More than one -f option may
  13.    appear
  14.  
  15.    Make updates a target if it depends on prerequisite files that have been
  16.    modified since the target was last modified, or if the target does not
  17.    exist.
  18.  
  19.    Makefile contains a sequence of entries that specify dependencies. The
  20.    first line of an entry is a blank-separated list of targets, then a colon,
  21.    then a list of prerequisite files. Text following a semicolon, and all
  22.    following lines that begin with a tab, are shell commands to be executed to
  23.    update the target. If a name appears on the left of more than one `colon'
  24.    line, then it depends on all of the names on the right of the colon on
  25.    those lines, but only one command sequence may be specified for it. If a
  26.    name appears on a line with a double colon :: then the command sequence
  27.    following that line is performed only if the name is out of date with
  28.    respect to the names to the right of the double colon, and is not affected
  29.    by other double colon lines on which that name may appear.
  30.  
  31.    Sharp and newline surround comments.
  32.  
  33.    The following makefile says that `pgm' depends on two files `a.obj' and
  34.    `b.obj', and that they in turn depend on `.c' files and a common file
  35.    `incl'.
  36.  
  37.           pgm: a.obj b.obj
  38.             cc a.obj b.obj -lm -o pgm
  39.           a.obj: incl a.c
  40.             cc -c a.c
  41.           b.obj: incl b.c
  42.             cc -c b.c
  43.  
  44.    Makefile entries of the form
  45.  
  46.           string1 = string2
  47.  
  48.    are macro definitions. Subsequent appearances of $(string1) or ${string1}
  49.    are replaced by string2. If string1 is a single character, the parentheses
  50.    or braces are optional.
  51.  
  52.    Make infers prerequisites for files for which makefile gives no construc-
  53.    tion commands. For example, a `.c' file may be inferred as prerequisite for
  54.    a `.obj' file and be compiled to produce the `.obj' file. Thus the prece-
  55.    ding example can be done more briefly:
  56.  
  57.           pgm: a.obj b.obj
  58.             cc a.obj b.obj -lm -o pgm
  59.           a.obj b.obj: incl
  60.  
  61.    Prerequisites are inferred according to selected suffixes listed as the
  62.    `prerequisites' for the special name `.SUFFIXES'; multiple lists accumu-
  63.    late; an empty list clears what came before. Order is significant; the
  64.    first possible name for which both a file and a rule as described in the
  65.    next paragraph exist is inferred.  The default list is
  66.  
  67.           .SUFFIXES: .obj .asm .c
  68.  
  69.    The rule to create a file with suffix s2 that depends on a similarly named
  70.    file with suffix s1 is specified as an entry for the `target' s1s2.  In
  71.    such an entry, the special macros
  72.  
  73.        $* stands for the target name with suffix deleted,
  74.     $@ for the full target name,
  75.     $< for the complete list of prerequisites,
  76.     $? for the list of prerequisites that are out of date.
  77.  
  78.    For example, a rule for making optimized `.obj' files from `.c' files is
  79.  
  80.           .c.obj: ; cc -c -O -o $@ $*.c
  81.  
  82.    Certain macros are used by the default inference rules to communicate op-
  83.    tional arguments to any resulting compilations.  In particular, `CFLAGS' is
  84.    used for cc(1) options, and AFLAGS for masm options. In addition, the macro
  85.    `MFLAGS' is filled in with the initial command line options supplied to
  86.    make. This simplifies maintaining a hierarchy of makefiles as one may then
  87.    invoke make on makefiles in subdirectories and pass along useful options.
  88.  
  89.    Command lines are executed one at a time. First execution of the command
  90.    is attempted directly from make. If this fails, a secondary COMMAND.COM
  91.    processor is invoked to do the job. For commands executed by a secondary
  92.    COMMAND.COM processor, exit status may not be correct, which is a flaw in
  93.    MSDOS.
  94.  
  95.    A command line is printed when it is executed unless the special target
  96.    `.SILENT' is in makefile, or the first character of the command is `@'.
  97.  
  98.    Commands returning nonzero exit status cause make to terminate unless the
  99.    special target `.IGNORE' is in makefile or the command begins with the cha-
  100.    racter sequence <tab><hyphen>, or if the `-i' option was given.
  101.  
  102.    Interrupt and quit cause the target to be deleted unless the target is a
  103.    directory or depends on the special name `.PRECIOUS'.
  104.  
  105. OPTION
  106.    -a   Disregard date/time stamps, and perform all commands that would be
  107.        necessary to update the requested final target(s).
  108.    -f   Use the next command line token for the makefile name. If this is '-'
  109.        then use standard input.
  110.    -i   Equivalent to the special entry `.IGNORE:'. A single command may be
  111.        forced to behave this way by preceding it by '<tab>-'.
  112.    -n   Trace and print, but do not execute the commands needed to update the
  113.        targets.
  114.    -p   Print all macros and targets. Good for debugging your makefiles.
  115.    -q   Causes make to return the up-to-date-ness of the target as exit
  116.        status.
  117.    -r   Equivalent to an initial special entry `.SUFFIXES:' with no list. This
  118.        means that the built-in inference rules are not used.
  119.    -s   Equivalent to the special entry `.SILENT:'. A single command may be
  120.        forced to behave this way by preceding it by '@'.
  121.    -t   Touch, i.e. update the modified date of targets, without executing any
  122.        commands.
  123.  
  124. FILES
  125.    makefile, command.com
  126.  
  127. SEE ALSO
  128.    touch
  129.  
  130. RESTRICTIONS
  131.    Some commands return nonzero status inappropriately.  Use -i to overcome
  132.    the difficulty.
  133.  
  134.    If a command is executed by an invocation a secondary COMMAND.COM, and
  135.    ties to set environment variables, these settings will only affect the
  136.    environment of that secondary command processor. As soon asit terminates,
  137.    the settings are lost. Also, COMMAND.COM always return successful status,
  138.    even if it tries to execute a non-existen command. In general, the inten-
  139.    tion is that COMMAND.COM is only to be invoked to run simple commands as
  140.    COPY, TYPE, DEL and the like.
  141.