Annotation of coherent/a/usr/man/MULTI/make, revision 1.1.1.1

1.1       root        1: 
                      2: 
                      3: make                         Command                         make
                      4: 
                      5: 
                      6: 
                      7: 
                      8: Program building discipline
                      9: 
                     10: mmaakkee [_o_p_t_i_o_n ...] [_a_r_g_u_m_e_n_t ...] [_t_a_r_g_e_t ...]
                     11: 
                     12: mmaakkee helps you build programs  that consist of more than one file
                     13: of source code.
                     14: 
                     15: Complex programs often consist of several _o_b_j_e_c_t _m_o_d_u_l_e_s, each of
                     16: which is  the product of  compiling a _s_o_u_r_c_e _f_i_l_e.  A source file
                     17: may  refer  to one  or  more  iinncclluuddee files,  which  can also  be
                     18: changed.   Some  programs may  be  generated from  specifications
                     19: given  to  program  generators,  such  as yyaacccc.  Recompiling  and
                     20: relinking complicated programs can be difficult and tedious.
                     21: 
                     22: mmaakkee   regenerates   programs   automatically.   It   follows   a
                     23: specification of the structure of the program that you write into
                     24: a file  called mmaakkeeffiillee. mmaakkee also checks the  date and time that
                     25: COHERENT has recorded  for each source file and its corresponding
                     26: object  module;  to avoid  unnecessary  recompilation, mmaakkee  will
                     27: recompile a  source file  only if it  has been altered  since its
                     28: object module was last compiled.
                     29: 
                     30: ***** The Makefile *****
                     31: 
                     32: A  mmaakkeeffiillee  consists  of  three  types  of  instructions:  _m_a_c_r_o
                     33: _d_e_f_i_n_i_t_i_o_n_s, _d_e_p_e_n_d_e_n_c_y _d_e_f_i_n_i_t_i_o_n_s, and _c_o_m_m_a_n_d_s.
                     34: 
                     35: A macro definition simply  defines a macro for use throughout the
                     36: mmaakkeeffiillee; for example, the macro definition
                     37: 
                     38: 
                     39:         FILES=file1.o file2.o file3.o
                     40: 
                     41: 
                     42: Note the use of the equal sign `='.
                     43: 
                     44: A dependency  definition names the  object modules used  to build
                     45: the target  program, and source  files used to  build each object
                     46: module .  It consists of the  _t_a_r_g_e_t _n_a_m_e, or name of the program
                     47: to  be created,  followed by  a colon  `:' and  the names  of the
                     48: object modules that build it.  For example, the statement
                     49: 
                     50: 
                     51:         example:  $(FILES)
                     52: 
                     53: 
                     54: uses the macro FFIILLEESS to name the object modules used to build the
                     55: program eexxaammppllee.  Likewise, the dependency definition
                     56: 
                     57: 
                     58: 
                     59: 
                     60: 
                     61: 
                     62: 
                     63: 
                     64: COHERENT Lexicon                                           Page 1
                     65: 
                     66: 
                     67: 
                     68: 
                     69: make                         Command                         make
                     70: 
                     71: 
                     72: 
                     73:         file1.o:  file1.c macros.h
                     74: 
                     75: 
                     76: defines  the object  module ffiillee11.oo as  consisting of  the source
                     77: file ffiillee11.cc and the header file mmaaccrrooss.hh.
                     78: 
                     79: Finally, a command line  details an action that mmaakkee must perform
                     80: to build the target program.  Each command line must begin with a
                     81: space or tab character.  For example, the command line
                     82: 
                     83: 
                     84:                 cc -o example $(FILES)
                     85: 
                     86: 
                     87: gives the cccc command needed to build the program eexxaammppllee.  The cccc
                     88: command  lists the  _o_b_j_e_c_t  _m_o_d_u_l_e_s to  be used,  _n_o_t the  source
                     89: files.
                     90: 
                     91: Note that  if you prefix an  action with a hyphen  `-', mmaakkee will
                     92: ignore errors  in the action.  If the action  is prefixed by `@',
                     93: it tells  mmaakkee to be silent  about the action --  that is, do not
                     94: echo the command to the standard output.
                     95: 
                     96: Finally,  you  can   embed  comments  within  a  mmaakkeeffiillee.   mmaakkee
                     97: recognizes any line that begins with  a pound sign `#' as being a
                     98: comment, and ignores it.
                     99: 
                    100: mmaakkee  searches for  mmaakkeeffiillee first  in  directories named  in the
                    101: environmental variable PPAATTHH, and then in the current directory.
                    102: 
                    103: ***** Dependencies *****
                    104: 
                    105: The mmaakkeeffiillee  specifies which files depend  upon other files, and
                    106: how to recreate the  dependent files.  For example, if the target
                    107: file tteesstt  depends upon the object  module tteesstt.oo, the dependency
                    108: is as follows:
                    109: 
                    110: 
                    111:         test:   test.o
                    112:                 cc -o test test.o
                    113: 
                    114: 
                    115: mmaakkee knows about  common dependencies, e.g., that .oo files depend
                    116: upon  .cc files  with the  same base  name.  The  target .SSUUFFFFIIXXEESS
                    117: contains the suffixes that mmaakkee recognizes.
                    118: 
                    119: mmaakkee also has a set  of rules to regenerate dependent files.  For
                    120: example, for  a source file  with suffix .cc and  a dependent file
                    121: with the suffix .oo, the target .cc.oo gives the regeneration rule:
                    122: 
                    123: 
                    124: 
                    125: 
                    126: 
                    127: 
                    128: 
                    129: 
                    130: COHERENT Lexicon                                           Page 2
                    131: 
                    132: 
                    133: 
                    134: 
                    135: make                         Command                         make
                    136: 
                    137: 
                    138: 
                    139:         .c.o:
                    140:                 cc -c $<
                    141: 
                    142: 
                    143: The -cc  option to the cccc  commands tells cccc not  to link or erase
                    144: the compiled object module.  $<  is a macro that mmaakkee defines; it
                    145: stands for  the name of the file that  causes the current action.
                    146: The   default  suffixes   and  rules  are   kept  in   the  files
                    147: /uussrr/lliibb/mmaakkeemmaaccrrooss and /uussrr/lliibb/mmaakkeeaaccttiioonnss.
                    148: 
                    149: ***** Macros *****
                    150: 
                    151: To simplify the  writing of complex dependencies, mmaakkee provides a
                    152: _m_a_c_r_o facility.  To define a macro, write
                    153: 
                    154: 
                    155:         NNAAMMEE = ssttrriinngg
                    156: 
                    157: 
                    158: _s_t_r_i_n_g  is terminated  by the  end-of-line  character, so  it can
                    159: contain blanks.  To refer to the value of the macro, use a dollar
                    160: sign `$'  followed by the macro name enclosed in parentheses:
                    161: 
                    162: 
                    163:         $(NNAAMMEE)
                    164: 
                    165: 
                    166: If  the  macro   name  is  one  character,  parentheses  are  not
                    167: necessary.  mmaakkee uses macros in the definition of default rules:
                    168: 
                    169: 
                    170:         .c.o:
                    171:                 $(CC) $(CFLAGS) -c $<
                    172: 
                    173: 
                    174: where the macros are defined as
                    175: 
                    176: 
                    177:         CC=cc
                    178:         CFLAGS=-V
                    179: 
                    180: 
                    181: The other built-in macros are:
                    182: 
                    183: 
                    184:           $*   Target name, minus suffix
                    185:           $@   Full target name
                    186:           $<   List of referred files
                    187:           $?   Referred files newer than target
                    188: 
                    189: 
                    190: Each command  line _a_r_g_u_m_e_n_t should  be a macro  definition of the
                    191: form
                    192: 
                    193: 
                    194: 
                    195: 
                    196: COHERENT Lexicon                                           Page 3
                    197: 
                    198: 
                    199: 
                    200: 
                    201: make                         Command                         make
                    202: 
                    203: 
                    204: 
                    205: 
                    206:      OBJECT=a.o b.o
                    207: 
                    208: 
                    209: Arguments  that include  spaces must  be surrounded  by quotation
                    210: marks, because blanks are significant to the shell sshh.
                    211: 
                    212: You  can  specify  macro  definitions  in  the mmaakkeeffiillee,  in  the
                    213: environment, or as a command-line argument.  A macro defined as a
                    214: command-line argument  always overrides a definition  of the same
                    215: macro name  in the  environment or  in the mmaakkeeffiillee.  Normally, a
                    216: definition in a mmaakkeeffiillee overrides a definition of the same macro
                    217: name in  the environment; however, with  the -e option (described
                    218: below), a definition in the environment overrides a definition in
                    219: the mmaakkeeffiillee.
                    220: 
                    221: ***** Options *****
                    222: 
                    223: The following lists the options that can be passed to mmaakkee on its
                    224: command line.
                    225: 
                    226: -dd   (Debug)   Give  verbose  printout   of  all   decisions  and
                    227:      information going into decisions.
                    228: 
                    229: -ee   Force macro definitions  in environment to override those in
                    230:      the mmaakkeeffiillee.
                    231: 
                    232: -ff _f_i_l_e
                    233:      _f_i_l_e contains  the mmaakkee specification.  If  this option does
                    234:      not  appear, mmaakkee  uses the file  mmaakkeeffiillee, which  is sought
                    235:      first  in the  directories named  in the  PPAATTHH environmental
                    236:      variable, and then in  the current directory.  If _f_i_l_e is `-
                    237:      ',  mmaakkee uses  the standard input;  note, however,  that the
                    238:      standard input can be used _o_n_l_y if it is piped.
                    239: 
                    240: -ii   Ignore  all errors from  commands, and  continue processing.
                    241:      Normally, mmaakkee exits if a command returns an error.
                    242: 
                    243: -nn   Test only; suppresses actual execution of commands.
                    244: 
                    245: -pp   Print all macro definitions and target descriptions.
                    246: 
                    247: -qq   Return a zero exit status if the targets are up to date.  Do
                    248:      not execute any commands.
                    249: 
                    250: -rr   Do not use the built-in rules that describe dependencies.
                    251: 
                    252: -ss   Do not  print command  lines when executing  them.  Commands
                    253:      preceded by `@' are not printed, except under the -nn option.
                    254: 
                    255: -tt   (Touch option) Force the  dates of targets to be the current
                    256:      time, and bypass actual regeneration.
                    257: 
                    258: 
                    259: 
                    260: 
                    261: 
                    262: COHERENT Lexicon                                           Page 4
                    263: 
                    264: 
                    265: 
                    266: 
                    267: make                         Command                         make
                    268: 
                    269: 
                    270: 
                    271: ***** Source File Path *****
                    272: 
                    273: If a  file is not  specified with an  absolute pathname beginning
                    274: with `/', mmaakkee first looks for the file in the current directory.
                    275: If the file is not  found in the current directory, mmaakkee searches
                    276: for it in the  list of directories specified by macro $(SSRRCCPPAATTHH).
                    277: This  allows you  to  compile a  program in  an object  directory
                    278: separate from the source directory.  For example
                    279: 
                    280: 
                    281:      export SRCPATH=/usr/src/local/me
                    282:      make
                    283: 
                    284: 
                    285: or alteratively
                    286: 
                    287: 
                    288:      make SRCPATH=/usr/src/local/me
                    289: 
                    290: 
                    291: builds  objects in  the  current directory  as  specified by  the
                    292: mmaakkeeffiillee and  sources in /uussrr/ssrrcc/llooccaall/mmee. To  test changes to a
                    293: program built from several  source files, copy only the files you
                    294: wish to change to the  current directory; make will use the local
                    295: sources and find the other sources on the $(SSRRCCPPAATTHH).
                    296: 
                    297: Note that  $(SSRRCCPPAATTHH) can be a single directory,  as in the above
                    298: example, or a  `:'-separated list of directories, as described in
                    299: the Lexicon entry for the function ppaatthh().
                    300: 
                    301: ***** Files *****
                    302: 
                    303: mmaakkeeffiillee
                    304: MMaakkeeffiillee -- List of dependencies and commands
                    305: /uussrr/lliibb/mmaakkeeaaccttiioonnss -- Default actions
                    306: /uussrr/lliibb/mmaakkeemmaaccrrooss -- Default macros
                    307: 
                    308: ***** See Also *****
                    309: 
                    310: aass, cccc, ccoommmmaannddss, lldd, ssrrccppaatthh, ttoouucchh
                    311: _T_h_e _m_a_k_e _P_r_o_g_r_a_m_m_i_n_g _D_i_s_c_i_p_l_i_n_e, tutorial
                    312: 
                    313: ***** Diagnostics *****
                    314: 
                    315: mmaakkee  reports its  exit  status if  it  is interrupted  or if  an
                    316: executed command returns  error status.  It replies ``Target _n_a_m_e
                    317: not defined''  or ``Don't  know how to  make target _n_a_m_e''  if it
                    318: cannot find appropriate rules.
                    319: 
                    320: ***** Notes *****
                    321: 
                    322: The order  of items in mmaakkeemmaaccrrooss/.SSUUFFFFIIXXEESS  is significant.  The
                    323: consequent  of  a  default  rule  (e.g.,  .oo)  must  _p_r_e_c_e_d_e  the
                    324: antecedent  (e.g., .cc)  in the  entry .SSUUFFFFIIXXEESS.  Otherwise, mmaakkee
                    325: will not work properly.
                    326: 
                    327: 
                    328: COHERENT Lexicon                                           Page 5
                    329: 
                    330: 
                    331: 
                    332: 
                    333: make                         Command                         make
                    334: 
                    335: 
                    336: 
                    337: 
                    338: 
                    339: 
                    340: 
                    341: 
                    342: 
                    343: 
                    344: 
                    345: 
                    346: 
                    347: 
                    348: 
                    349: 
                    350: 
                    351: 
                    352: 
                    353: 
                    354: 
                    355: 
                    356: 
                    357: 
                    358: 
                    359: 
                    360: 
                    361: 
                    362: 
                    363: 
                    364: 
                    365: 
                    366: 
                    367: 
                    368: 
                    369: 
                    370: 
                    371: 
                    372: 
                    373: 
                    374: 
                    375: 
                    376: 
                    377: 
                    378: 
                    379: 
                    380: 
                    381: 
                    382: 
                    383: 
                    384: 
                    385: 
                    386: 
                    387: 
                    388: 
                    389: 
                    390: 
                    391: 
                    392: 
                    393: 
                    394: COHERENT Lexicon                                           Page 6
                    395: 
                    396: 

unix.superglobalmegacorp.com

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