home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 092.lha / Make / Make.man < prev    next >
Text File  |  1986-11-20  |  6KB  |  154 lines

  1.  
  2.  
  3.  
  4.  
  5.                                                           make(1)
  6.  
  7.  
  8.  
  9. NAME
  10.      make - maintain program groups
  11.  
  12. SYNTAX
  13.      make [ -f makefile ] [ option ] ...  file ...
  14.  
  15. DESCRIPTION
  16.      _M_a_k_e executes commands in _m_a_k_e_f_i_l_e to update one or more
  17.      target _n_a_m_e_s.  _N_a_m_e is typically a program.  If no -f option
  18.      is present, `makefile' and `Makefile' are tried in order.
  19.      If _m_a_k_e_f_i_l_e is `-', the standard input is taken.  More than
  20.      one -f option may appear
  21.  
  22.      _M_a_k_e updates a target if it depends on prerequisite files
  23.      that have been modified since the target was last modified,
  24.      or if the target does not exist.
  25.  
  26.      _M_a_k_e_f_i_l_e contains a sequence of entries that specify depen-
  27.      dencies.  The first line of an entry is a blank-separated
  28.      list of targets, then a colon, then a list of prerequisite
  29.      files.  Text following a semicolon, and all following lines
  30.      that begin with a tab, are shell commands to be executed to
  31.      update the target.  If a name appears on the left of more
  32.      than one `colon' line, then it depends on all of the names
  33.      on the right of the colon on those lines, but only one com-
  34.      mand sequence may be specified for it.  If a name appears on
  35.      a line with a double colon :: then the command sequence fol-
  36.      lowing that line is performed only if the name is out of
  37.      date with respect to the names to the right of the double
  38.      colon, and is not affected by other double colon lines on
  39.      which that name may appear.
  40.  
  41.      Two special forms of a name are recognized.  A name like
  42.      _a(_b) means the file named _b stored in the archive named _a. A
  43.      name like _a((_b)) means the file stored in archive _a contain-
  44.      ing the entry point _b.
  45.  
  46.      Sharp and newline surround comments.
  47.  
  48.      The following makefile says that `pgm' depends on two files
  49.      `a.o' and `b.o', and that they in turn depend on `.c' files
  50.      and a common file `incl'.
  51.  
  52.           pgm: a.o b.o
  53.             cc a.o b.o -lm -o pgm
  54.           a.o: incl a.c
  55.             cc -c a.c
  56.           b.o: incl b.c
  57.             cc -c b.c
  58.  
  59.      _M_a_k_e_f_i_l_e entries of the form
  60.  
  61.           string1 = string2
  62.  
  63.      are macro definitions.  Subsequent appearances of $(_s_t_r_i_n_g_1)
  64.      or ${_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 sin-
  65.      gle character, the parentheses or braces are optional.
  66.  
  67.      _M_a_k_e infers prerequisites for files for which _m_a_k_e_f_i_l_e gives
  68.      no construction commands.  For example, a `.c' file may be
  69.      inferred as prerequisite for a `.o' file and be compiled to
  70.      produce the `.o' file.  Thus the preceding example can be
  71.      done more briefly:
  72.  
  73.           pgm: a.o b.o
  74.             cc a.o b.o -lm -o pgm
  75.           a.o b.o: incl
  76.  
  77.      Prerequisites are inferred according to selected suffixes
  78.      listed as the `prerequisites' for the special name `.SUF-
  79.      FIXES'; multiple lists accumulate; an empty list clears what
  80.      came before.  Order is significant; the first possible name
  81.      for which both a file and a rule as described in the next
  82.      paragraph exist is inferred.  The default list is
  83.  
  84.           .SUFFIXES: .out .o .c .e .r .f .y .l .s .p
  85.  
  86.      The rule to create a file with suffix _s_2 that depends on a
  87.      similarly named file with suffix _s_1 is specified as an entry
  88.      for the `target' _s_1_s_2.  In such an entry, the special macro
  89.      $* stands for the target name with suffix deleted, $@ for
  90.      the full target name, $< for the complete list of prere-
  91.      quisites, and $? for the list of prerequisites that are out
  92.      of date.  For example, a rule for making optimized `.o'
  93.      files from `.c' files is
  94.  
  95.           .c.o: ; cc -c -O -o $@ $*.c
  96.  
  97.      Certain macros are used by the default inference rules to
  98.      communicate optional arguments to any resulting compila-
  99.      tions.  In particular, `CFLAGS' is used for _c_c(1) options,
  100.      `FFLAGS' for _f_7_7(1) options, `PFLAGS' for _p_c(1) options, and
  101.      `LFLAGS' and `YFLAGS' for _l_e_x and _y_a_c_c(1) options.  In addi-
  102.      tion, the macro `MFLAGS' is filled in with the initial com-
  103.      mand line options supplied to _m_a_k_e.  This simplifies main-
  104.      taining a hierarchy of makefiles as one may then invoke _m_a_k_e
  105.      on makefiles in subdirectories and pass along useful options
  106.      such as -k.
  107.  
  108.      Command lines are executed one at a time, each by its own
  109.      shell.  A line is printed when it is executed unless the
  110.      special target `.SILENT' is in _m_a_k_e_f_i_l_e, or the first char-
  111.      acter of the command is `@'.
  112.  
  113.      Commands returning nonzero status (see _i_n_t_r_o(1)) cause _m_a_k_e
  114.      to terminate unless the special target `.IGNORE' is in
  115.      _m_a_k_e_f_i_l_e or the command begins with <tab><hyphen>.
  116.  
  117.      Interrupt and quit cause the target to be deleted unless the
  118.      target is a directory or depends on the special name `.PRE-
  119.      CIOUS'.
  120.  
  121.      Other options:
  122.  
  123.      -i   Equivalent to the special entry `.IGNORE:'.
  124.  
  125.      -k   When a command returns nonzero status, abandon work on
  126.           the current entry, but continue on branches that do not
  127.           depend on the current entry.
  128.  
  129.      -n   Trace and print, but do not execute the commands needed
  130.           to update the targets.
  131.  
  132.      -t   Touch, i.e. update the modified date of targets,
  133.           without executing any commands.
  134.  
  135.      -r   Equivalent to an initial special entry `.SUFFIXES:'
  136.           with no list.
  137.  
  138.      -s   Equivalent to the special entry `.SILENT:'.
  139.  
  140. FILES
  141.      makefile, Makefile
  142.  
  143. SEE ALSO
  144.      sh(1), touch(1), f77(1), pc(1)
  145.      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_-
  146.      _g_r_a_m_s
  147.  
  148. RESTRICTIONS
  149.      Some commands return nonzero status inappropriately.  Use -i
  150.      to overcome the difficulty.
  151.      Commands that are directly executed by the shell, notably
  152.      _c_d(1), are ineffectual across newlines in _m_a_k_e.
  153.  
  154.