home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dmake40.zip / man / dmake.nc.A next >
Text File  |  1994-10-23  |  69KB  |  1,801 lines

  1.  
  2.  
  3.  
  4.  
  5. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  6.  
  7.  
  8.  
  9. NAME
  10.      dmake - maintain program groups, or interdependent files
  11.  
  12. SYNOPSIS
  13.      dmake [-P#] [-{f|C|K} file] [-{w|W} target ...]
  14.      [macro[[!][*][+][:]]=value ...] [-v{cdfimt}]
  15.      [-ABcdeEghiknpqrsStTuVxX] [target ...]
  16.  
  17. DESCRIPTION
  18.      dmake is a re-implementation of the UNIX Make utility with
  19.      significant enhancements.  dmake executes commands found in
  20.      an external file called a makefile to update one or more
  21.      target names.  Each target may depend on zero or more prere-
  22.      quisite targets.  If any of the target's prerequisites is
  23.      newer than the target or if the target itself does not
  24.      exist, then dmake will attempt to make the target.
  25.  
  26.      If no -f command line option is present then dmake searches
  27.      for an existing makefile from the list of prerequisites
  28.      specified for the special target .MAKEFILES (see the STARTUP
  29.      section for more details).  If "-" is the name of the file
  30.      specified to the -f flag then dmake uses standard input as
  31.      the source of the makefile text.
  32.  
  33.      Any macro definitions (arguments with embedded "=" signs)
  34.      that appear on the command line are processed first and
  35.      supercede definitions for macros of the same name found
  36.      within the makefile.  In general it is impossible for defin-
  37.      itions found inside the makefile to redefine a macro defined
  38.      on the command line, see the MACROS section for exceptions.
  39.  
  40.      If no target names are specified on the command line, then
  41.      dmake uses the first non-special target found in the
  42.      makefile as the default target.  See the SPECIAL TARGETS
  43.      section for the list of special targets and their function.
  44.      Makefiles written for most previous versions of Make will be
  45.      handled correctly by dmake. Known differences between dmake
  46.      and other versions of make are discussed in the COMPATIBIL-
  47.      ITY section found at the end of this document.  dmake
  48.      returns 0 if no errors were detected and a non-zero result
  49.      if an error occurred.
  50.  
  51. OPTIONS
  52.      -A   Enable AUGMAKE special inference rule transformations
  53.           (see the "PERCENT(%) RULES" section), these are set to
  54.           off by default.
  55.  
  56.      -B   Enable the use of spaces instead of <tabs> to begin
  57.           recipe lines.  This flag equivalent to the .NOTABS spe-
  58.           cial macro and is further described below.
  59.  
  60.  
  61.  
  62.  
  63.  
  64. Version 3.9 PL0                 UW                              1
  65.  
  66.  
  67.  
  68.  
  69. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  70.  
  71.  
  72.  
  73.      -c   Use non-standard comment stripping.  If you specify -c
  74.           then dmake will treat any # character as a start of
  75.           comment character wherever it may appear unless it is
  76.           escaped by a \.
  77.  
  78.      -C [+]file
  79.           This option writes to file a copy of standard output
  80.           and standard error from any child processes and from
  81.           the dmake process itself.  If you specify a + prior to
  82.           the file name then the text is appended to the previous
  83.           contents of file.  This option is active in the MSDOS
  84.           implementation only and is ignored by non-MSDOS ver-
  85.           sions of dmake.
  86.  
  87.      -d   Disable the use of the directory cache.  Normally dmake
  88.           caches directories as it checks file timestamps.  Giv-
  89.           ing this flag is equivalent to the .DIRCACHE attribute
  90.           or macro being set to no.
  91.  
  92.      -E   Read the environment and define all strings of the form
  93.           'ENV-VAR=evalue' defined within as macros whose name is
  94.           ENV-VAR, and whose value is 'evalue'.  The environment
  95.           is processed prior to processing the user specified
  96.           makefile thereby allowing definitions in the makefile
  97.           to override definitions in the environment.
  98.  
  99.      -e   Same as -E, except that the environment is processed
  100.           after the user specified makefile has been processed
  101.           (thus definitions in the environment override defini-
  102.           tions in the makefile).  The -e and -E options are
  103.           mutually exclusive.  If both are given the latter takes
  104.           effect.
  105.  
  106.      -f file
  107.           Use file as the source for the makefile text.  Only one
  108.           -f option is allowed.
  109.  
  110.      -g   Globally disable group recipe parsing, equivalent to
  111.           the .IGNOREGROUP attribute or macro being set to yes at
  112.           the start of the makefile.
  113.  
  114.      -h   Print the command summary for dmake.
  115.  
  116.      -i   Tells dmake to ignore errors, and continue making other
  117.           targets.  This is equivalent to the .IGNORE attribute
  118.           or macro.
  119.  
  120.      -K file
  121.           Turns on .KEEP_STATE state tracking and tells dmake to
  122.           use file as the state file.
  123.  
  124.  
  125.  
  126.  
  127.  
  128. Version 3.9 PL0                 UW                              2
  129.  
  130.  
  131.  
  132.  
  133. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  134.  
  135.  
  136.  
  137.      -k   Causes dmake to ignore errors caused by command execu-
  138.           tion and to make all targets not depending on targets
  139.           that could not be made. Ordinarily dmake stops after a
  140.           command returns a non-zero status, specifying -k causes
  141.           dmake to ignore the error and continue to make as much
  142.           as possible.
  143.  
  144.      -n   Causes dmake to print out what it would have executed,
  145.           but does not actually execute the commands.  A special
  146.           check is made for the string "$(MAKE)" inside a recipe
  147.           line, if found, the line is expanded and invoked,
  148.           thereby enabling recursive makes to give a full
  149.           description of all that they will do.  The check for
  150.           "$(MAKE)" is disabled inside group recipes.
  151.  
  152.      -p   Print out a version of the digested makefile in human
  153.           readable form.  (useful for debugging, but cannot be
  154.           re-read by dmake)
  155.  
  156.      -P#  On systems that support multi-processing cause dmake to
  157.           use # concurrent child processes to make targets.  See
  158.           the "MULTI PROCESSING" section for more information.
  159.  
  160.      -q   Check and see if the target is up to date.  Exits with
  161.           code 0 if up to date, 1 otherwise.
  162.  
  163.      -r   Tells dmake not to read the initial startup makefile,
  164.           see STARTUP section for more details.
  165.  
  166.      -s   Tells dmake to do all its work silently and not echo
  167.           the commands it is executing to stdout (also suppresses
  168.           warnings).  This  is equivalent to the .SILENT attri-
  169.           bute or macro.
  170.  
  171.      -S   Force sequential execution of recipes on architectures
  172.           which support concurrent makes.  For backward compati-
  173.           bility with old makefiles that have nasty side-effect
  174.           prerequisite dependencies.
  175.  
  176.      -t   Causes dmake to touch the targets and bring them up to
  177.           date without executing any commands.  Note that targets
  178.           will not be created if they do not already exist.
  179.  
  180.      -T   Tells dmake to not perform transitive closure on the
  181.           inference graph.
  182.  
  183.      -u   Force an unconditional update.  (ie. do everything that
  184.           would be done if everything that a target depended on
  185.           was out of date)
  186.  
  187.      -v[dfimt]
  188.           Verbose flag, when making targets print to stdout what
  189.  
  190.  
  191.  
  192. Version 3.9 PL0                 UW                              3
  193.  
  194.  
  195.  
  196.  
  197. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  198.  
  199.  
  200.  
  201.           we are going to make and what we think its time stamp
  202.           is.  The optional flags [dfimt] can be used to restrict
  203.           the information that is displayed.  In the absence of
  204.           any optional flags all are assumed to be given (ie. -v
  205.           is equivalent to -vdfimt).  The meanings of the
  206.           optional flags are:
  207.  
  208.           d    Notify of change directory operations only.
  209.  
  210.           f    Notify of file I/O operations only.
  211.  
  212.           i    Notify of inference algorithm operation only.
  213.  
  214.           m    Notify of target update operations only.
  215.  
  216.           t    Keep any temporary files created; normally they
  217.                are automatically deleted.
  218.  
  219.      -V   Print the version of dmake, and values of builtin mac-
  220.           ros.
  221.  
  222.      -W target
  223.           Run dmake pretending that target is out of date.
  224.  
  225.      -w target
  226.           What if? Show what would be made if target were out of
  227.           date.
  228.  
  229.      -x   Upon processing the user makefile export all non-
  230.           internally defined macros to the user's environment.
  231.           This option together with the -e option allows SYSV
  232.           AUGMAKE recursive makes to function as expected.
  233.  
  234.      -X   Inhibit the execution of #! lines found at the begin-
  235.           ning of a makefile.  The use of this flag prevents
  236.           non-termination of recursive make invocations.
  237.  
  238. INDEX
  239.      Here is a list of the sections that follow and a short
  240.      description of each.  Perhaps you won't have to read the
  241.      entire man page to find what you need.
  242.  
  243.      STARTUP            Describes dmake initialization.
  244.  
  245.      SYNTAX             Describes the syntax of makefile expres-
  246.                         sions.
  247.  
  248.      ATTRIBUTES         Describes the notion of attributes and
  249.                         how they are used when making targets.
  250.  
  251.      MACROS             Defining and expanding macros.
  252.  
  253.  
  254.  
  255.  
  256. Version 3.9 PL0                 UW                              4
  257.  
  258.  
  259.  
  260.  
  261. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  262.  
  263.  
  264.  
  265.      RULES AND TARGETS  How to define targets and their prere-
  266.                         quisites.
  267.  
  268.      RECIPES            How to tell dmake how to make a target.
  269.  
  270.      TEXT DIVERSIONS    How to use text diversions in recipes and
  271.                         macro expansions.
  272.  
  273.      SPECIAL TARGETS    Some targets are special.
  274.  
  275.      SPECIAL MACROS     Macros used by dmake to alter the pro-
  276.                         cessing of the makefile, and those
  277.                         defined by dmake for the user.
  278.  
  279.      CONTROL MACROS     Itemized list of special control macros.
  280.  
  281.      RUN-TIME MACROS    Discussion of special run-time macros
  282.                         such as $@ and $<.
  283.  
  284.      FUNCTION MACROS    GNU style function macros, only $(mktmp
  285.                         ...) for now.
  286.  
  287.      CONDITIONAL MACROS Target specific conditional macros.
  288.  
  289.      DYNAMIC PREREQUISITES
  290.                         Processing of prerequisites which contain
  291.                         macro expansions in their name.
  292.  
  293.      BINDING TARGETS    The rules that dmake uses to bind a tar-
  294.                         get to an existing file in the file sys-
  295.                         tem.
  296.  
  297.      PERCENT(%) RULES   Specification of recipes to be used by
  298.                         the inference algorithm.
  299.  
  300.      MAKING INFERENCES  The rules that dmake uses when inferring
  301.                         how to make a target which has no expli-
  302.                         cit recipe.  This and the previous sec-
  303.                         tion are really a single section in the
  304.                         text.
  305.  
  306.      MAKING TARGETS     How dmake makes targets other than
  307.                         libraries.
  308.  
  309.      MAKING LIBRARIES   How dmake makes libraries.
  310.  
  311.      KEEP STATE         A discussion of how .KEEP_STATE works.
  312.  
  313.      MULTI PROCESSING   Discussion of dmake's parallel make
  314.                         facilities for architectures that support
  315.                         them.
  316.  
  317.  
  318.  
  319.  
  320. Version 3.9 PL0                 UW                              5
  321.  
  322.  
  323.  
  324.  
  325. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  326.  
  327.  
  328.  
  329.      CONDITIONALS       Conditional expressions which control the
  330.                         processing of the makefile.
  331.  
  332.      EXAMPLES           Some hopefully useful examples.
  333.  
  334.      COMPATIBILITY      How dmake compares with previous versions
  335.                         of make.
  336.  
  337.      LIMITS             Limitations of dmake.
  338.  
  339.      PORTABILITY        Comments on writing portable makefiles.
  340.  
  341.      FILES              Files used by dmake.
  342.  
  343.      SEE ALSO           Other related programs, and man pages.
  344.  
  345.      AUTHOR             The guy responsible for this thing.
  346.  
  347.      BUGS               Hope not.
  348.  
  349. STARTUP
  350.      When dmake begins execution it first processes the command
  351.      line and then processes an initial startup-makefile.  This
  352.      is followed by an attempt to locate and process a user sup-
  353.      plied makefile.  The startup file defines the default values
  354.      of all required control macros and the set of default rules
  355.      for making targets and inferences.  When searching for the
  356.      startup makefile, dmake searches the following locations, in
  357.      the order specified, until a startup file is located:
  358.  
  359.           1.   The location given as the value of the macro MAK-
  360.                ESTARTUP defined on the command line.
  361.  
  362.           2.   The location given as the value of the environment
  363.                variable MAKESTARTUP defined in the current
  364.                environment.
  365.  
  366.           3.   The location given as the value of the macro MAK-
  367.                ESTARTUP defined internally within dmake.
  368.  
  369.      The above search is disabled by specifying the -r option on
  370.      the command line.  An error is issued if a startup makefile
  371.      cannot be found and the -r option was not specified.  A user
  372.      may substitute a custom startup file by defining the MAKES-
  373.      TARTUP environment variable or by redefining the MAKESTARTUP
  374.      macro on the command line.  To determine where dmake looks
  375.      for the default startup file, check your environment or
  376.      issue the command "dmake -V".
  377.  
  378.      A similar search is performed to locate a default user
  379.      makefile when no -f command line option is specified.  By
  380.      default, the prerequisite list of the special target
  381.  
  382.  
  383.  
  384. Version 3.9 PL0                 UW                              6
  385.  
  386.  
  387.  
  388.  
  389. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  390.  
  391.  
  392.  
  393.      .MAKEFILES specifies the names of possible makefiles and the
  394.      search order that dmake should use to determine if one
  395.      exists.  A typical definition for this target is:
  396.  
  397.           .MAKEFILES : makefile.mk Makefile makefile
  398.  
  399.      dmake will first look for makefile.mk and then the others.
  400.      If a prerequisite cannot be found dmake will try to make it
  401.      before going on to the next prerequisite.  For example,
  402.      makefile.mk can be checked out of an RCS file if the proper
  403.      rules for doing so are defined in the startup file.
  404.  
  405.      If the first line of the user makefile is of the form:
  406.  
  407.           #! command command_args
  408.  
  409.      then dmake will expand and run the command prior to reading
  410.      any additional input.  If the return code of the command is
  411.      zero then dmake will continue on to process the remainder of
  412.      the user makefile, if the return code is non-zero then dmake
  413.      will exit.
  414.  
  415.      dmake builds the internal dependency graph as it parses a
  416.      user specified makefile.  The graph is rooted at the special
  417.      target .ROOT. .ROOT is the top level target that dmake
  418.      builds when it starts to build targets.  All user specified
  419.      targets (those from the command line or taken as defaults
  420.      from the makefile) are made prerequisites of the special
  421.      target .TARGETS.  dmake by default creates the relationship
  422.      that .ROOT depends on .TARGETS and as a result everything is
  423.      made.  This approach allows the user to customize, within
  424.      their makefile, the order and which, target, is built first.
  425.      For example the default makefiles come with settings for
  426.      .ROOT that specify:
  427.  
  428.           .ROOT .PHONY .NOSTATE .SEQUENTIAL : .INIT .TARGETS
  429.           .DONE
  430.  
  431.      with .INIT and .DONE defined as:
  432.  
  433.           .INIT .DONE :;
  434.  
  435.      which nicely emulates the behaviour of Sun's make exten-
  436.      sions.  The building of .ROOT's prerequisites is always
  437.      forced to be sequential.
  438.  
  439. SYNTAX
  440.      This section is a summary of the syntax of makefile state-
  441.      ments.  The description is given in a style similar to BNF,
  442.      where { } enclose items that may appear zero or more times,
  443.      and [ ] enclose items that are optional.  Alternative pro-
  444.      ductions for a left hand side are indicated by '->', and
  445.  
  446.  
  447.  
  448. Version 3.9 PL0                 UW                              7
  449.  
  450.  
  451.  
  452.  
  453. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  454.  
  455.  
  456.  
  457.      newlines are significant.  All symbols in bold type are text
  458.      or names representing text supplied by the user.
  459.  
  460.  
  461.  
  462.           Makefile -> { Statement }
  463.  
  464.           Statement -> Macro-Definition
  465.                     -> Conditional-Macro-Definition
  466.                     -> Conditional
  467.                     -> Rule-Definition
  468.                     -> Attribute-Definition
  469.  
  470.           Macro-Definition -> MACRO = LINE
  471.                            -> MACRO [!]*= LINE
  472.                            -> MACRO [!]:= LINE
  473.                            -> MACRO [!]*:= LINE
  474.                            -> MACRO [!]+= LINE
  475.                            -> MACRO [!]+:= LINE
  476.  
  477.           Conditional-Macro-Definition ->  TARGET ?= Macro-
  478.                                            Definition
  479.  
  480.           Conditional ->  .IF expression
  481.                              Makefile
  482.                           [ .ELIF expression
  483.                              Makefile ]
  484.                           [ .ELSE
  485.                              Makefile ]
  486.                           .END
  487.  
  488.           expression -> LINE
  489.                      -> STRING == LINE
  490.                      -> STRING != LINE
  491.  
  492.  
  493.           Rule-Definition ->  target-definition
  494.                                  [ recipe ]
  495.  
  496.           target-definition -> targets [attrs] op { PREREQUISITE } [; rcp-line]
  497.  
  498.           targets -> target { targets }
  499.                   -> "target" { targets }
  500.  
  501.           target -> special-target
  502.                  -> TARGET
  503.  
  504.           attrs -> attribute { attrs }
  505.                 -> "attribute" { attrs }
  506.  
  507.           op -> : { modifier }
  508.  
  509.  
  510.  
  511.  
  512. Version 3.9 PL0                 UW                              8
  513.  
  514.  
  515.  
  516.  
  517. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  518.  
  519.  
  520.  
  521.           modifier -> :
  522.                    -> ^
  523.                    -> !
  524.                    -> -
  525.                    -> |
  526.  
  527.           recipe -> { TAB rcp-line }
  528.                  -> [@][%][-] [
  529.                        { LINE }
  530.                     ]
  531.  
  532.           rcp-line -> [@][%][-][+] LINE
  533.  
  534.  
  535.           Attribute-Definition -> attrs : targets
  536.  
  537.  
  538.           attribute -> .EPILOG
  539.                     -> .GROUP
  540.                     -> .IGNORE
  541.                     -> .IGNOREGROUP
  542.                     -> .LIBRARY
  543.                     -> .MKSARGS
  544.                     -> .NOINFER
  545.                     -> .NOSTATE
  546.                     -> .PHONY
  547.                     -> .PRECIOUS
  548.                     -> .PROLOG
  549.                     -> .SETDIR=path
  550.                     -> .SILENT
  551.                     -> .SEQUENTIAL
  552.                     -> .SWAP
  553.                     -> .USESHELL
  554.                     -> .SYMBOL
  555.                     -> .UPDATEALL
  556.  
  557.           special-target -> .ERROR
  558.                          -> .EXIT
  559.                          -> .EXPORT
  560.                          -> .GROUPEPILOG
  561.                          -> .GROUPPROLOG
  562.                          -> .IMPORT
  563.                          -> .INCLUDE
  564.                          -> .INCLUDEDIRS
  565.                          -> .MAKEFILES
  566.                          -> .REMOVE
  567.                          -> .SOURCE
  568.                          -> .SOURCE.suffix
  569.                          -> .suffix1.suffix2
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576. Version 3.9 PL0                 UW                              9
  577.  
  578.  
  579.  
  580.  
  581. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  582.  
  583.  
  584.  
  585.      Where, TAB represents a <tab> character, STRING represents
  586.      an arbitrary sequence of characters, and LINE represents a
  587.      possibly empty sequence of characters terminated by a non-
  588.      escaped (not immediately preceded by a backslash '\') new-
  589.      line character.  MACRO, PREREQUISITE, and TARGET each
  590.      represent a string of characters not including space or tab
  591.      which respectively form the name of a macro, prerequisite or
  592.      target.  The name may itself be a macro expansion expres-
  593.      sion.  A LINE can be continued over several physical lines
  594.      by terminating it with a single backslash character.  Com-
  595.      ments are initiated by the pound # character and extend to
  596.      the end of line.  All comment text is discarded, a '#' may
  597.      be placed into the makefile text by escaping it with '\'
  598.      (ie. \# translates to # when it is parsed).  An exception to
  599.      this occurs when a # is seen inside a recipe line that
  600.      begins with a <tab> or is inside a group recipe.  If you
  601.      specify the -c command line switch then this behavior is
  602.      disabled and dmake will treat all # characters as start of
  603.      comment indicators unless they are escaped by \.  A set of
  604.      continued lines may be commented out by placing a single #
  605.      at the start of the first line.  A continued line cannot
  606.      span more than one makefile.
  607.  
  608.      white space is defined to be any combination of <space>,
  609.      <tab>, and the sequence \<nl> when \<nl> is used to ter-
  610.      minate a LINE.  When processing macro definition lines, any
  611.      amount of white space is allowed on either side of the macro
  612.      operator and white space is stripped from both before and
  613.      after the macro value string.  The sequence \<nl> is treated
  614.      as white space during recipe expansion and is deleted from
  615.      the final recipe string.  You must escape the \<nl> with
  616.      another \ in order to get a \ at the end of a recipe line.
  617.      The \<nl> sequence is deleted from macro values when they
  618.      are expanded.
  619.  
  620.      When processing target definition lines, the recipe for a
  621.      target must, in general, follow the first definition of the
  622.      target (See the RULES AND TARGETS section for an exception),
  623.      and the recipe may not span across multiple makefiles.  Any
  624.      targets and prerequisites found on a target definition line
  625.      are taken to be white space separated tokens.  The rule
  626.      operator (op in SYNTAX section) is also considered to be a
  627.      token but does not require white space to precede or follow
  628.      it.  Since the rule operator begins with a `:', traditional
  629.      versions of make do not allow the `:' character to form a
  630.      valid target name.  dmake allows `:' to be present in
  631.      target/prerequisite names as long as the entire
  632.      target/prerequisite name is quoted.  For example:
  633.  
  634.           a:fred : test
  635.  
  636.      would be parsed as TARGET = a, PREREQUISITES={fred, :,
  637.  
  638.  
  639.  
  640. Version 3.9 PL0                 UW                             10
  641.  
  642.  
  643.  
  644.  
  645. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  646.  
  647.  
  648.  
  649.      test}, which is not what was intended.  To fix this you must
  650.      write:
  651.  
  652.           "a:fred" : test
  653.  
  654.      Which will be parsed as expected.  Quoted target and prere-
  655.      quisite specifications may also contain white space thereby
  656.      allowing the use of complex function macro expressions..
  657.      See the EXAMPLES section for how to apply " quoting to a
  658.      list of targets.
  659.  
  660. ATTRIBUTES
  661.      dmake defines several target attributes.  Attributes may be
  662.      assigned to a single target, a group of targets, or to all
  663.      targets in the makefile.  Attributes are used to modify
  664.      dmake actions during target update.  The recognized attri-
  665.      butes are:
  666.  
  667.  
  668.      .EPILOG     Insert shell epilog code when executing a group
  669.                  recipe associated with any target having this
  670.                  attribute set.
  671.  
  672.      .FIRST      Used in conjunction with .INCLUDE.  Terminates
  673.                  the inclusion with the first successfully
  674.                  included prerequisite.
  675.  
  676.      .GROUP      Force execution of a target's recipe as a group
  677.                  recipe.
  678.  
  679.      .IGNORE     Ignore an error when trying to make any target
  680.                  with this attribute set.
  681.  
  682.      .IGNOREGROUP
  683.                  Disable the special meaning of '[' to initiate a
  684.                  group recipe.
  685.  
  686.      .LIBRARY    Target is a library.
  687.  
  688.      .MKSARGS    If running in an MSDOS environment then use MKS
  689.                  extended argument passing conventions to pass
  690.                  arguments to commands.  Non-MSDOS environments
  691.                  ignore this attribute.
  692.  
  693.      .NOINFER    Any target with this attribute set will not be
  694.                  subjected to transitive closure if it is
  695.                  inferred as a prerequisite of a target whose
  696.                  recipe and prerequisites are being inferred.
  697.                  (i.e. the inference algorithm will not use any
  698.                  prerequisite with this attribute set, as a tar-
  699.                  get) If specified as '.NOINFER:' (ie. with no
  700.                  prerequisites or targets) then the effect is
  701.  
  702.  
  703.  
  704. Version 3.9 PL0                 UW                             11
  705.  
  706.  
  707.  
  708.  
  709. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  710.  
  711.  
  712.  
  713.                  equivalent to specifying -T on the command line.
  714.  
  715.      .NOSTATE    Any target with this attribute set will not have
  716.                  command line flag information stored in the
  717.                  state file if .KEEP_STATE has been enabled.
  718.  
  719.      .PHONY      Any target with this attribute set will have its
  720.                  recipe executed each time the target is made
  721.                  even if a file matching the target name can be
  722.                  located.  Any targets that have a .PHONY attri-
  723.                  buted target as a prerequisite will be made each
  724.                  time the .PHONY attributed prerequisite is made.
  725.  
  726.      .PRECIOUS   Do not remove associated target under any cir-
  727.                  cumstances.  Set by default for any targets
  728.                  whose corresponding files exist in the file sys-
  729.                  tem prior to the execution of dmake.
  730.  
  731.      .PROLOG     Insert shell prolog code when executing a group
  732.                  recipe associated with any target having this
  733.                  attribute set.
  734.  
  735.      .SEQUENTIAL Force a sequential make of the associated
  736.                  target's prerequisites.
  737.  
  738.      .SETDIR     Change current working directory to specified
  739.                  directory when making the associated target.
  740.                  You must specify the directory at the time the
  741.                  attribute is specified.  To do this simply give
  742.                  .SETDIR=path as the attribute.  path is expanded
  743.                  and the result is used as the value of the
  744.                  directory to change to.  If path contains $$@
  745.                  then the name of the target to be built is used
  746.                  in computing the path to change directory to.
  747.                  If path is surrounded by single quotes then path
  748.                  is not expanded, and is used literally as the
  749.                  directory name.  If the path contains any `:'
  750.                  characters then the entire attribute string must
  751.                  be quoted using ".  If a target having this
  752.                  attribute set also has the .IGNORE attribute set
  753.                  then if the change to the specified directory
  754.                  fails it will be ignored, and no error message
  755.                  will be issued.
  756.  
  757.      .SILENT     Do not echo the recipe lines when making any
  758.                  target with this attribute set, and do not issue
  759.                  any warnings.
  760.  
  761.      .SWAP       Under MSDOS when making a target with this
  762.                  attribute set swap the dmake executable to disk
  763.                  prior to executing the recipe line.  Also see
  764.                  the '%' recipe line flag defined in the RECIPES
  765.  
  766.  
  767.  
  768. Version 3.9 PL0                 UW                             12
  769.  
  770.  
  771.  
  772.  
  773. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  774.  
  775.  
  776.  
  777.                  section.
  778.  
  779.      .SYMBOL     Target is a library member and is an entry point
  780.                  into a module in the library.  This attribute is
  781.                  used only when searching a library for a target.
  782.                  Targets of the form lib((entry)) have this
  783.                  attribute set automatically.
  784.  
  785.      .USESHELL   Force each recipe line of a target to be exe-
  786.                  cuted using a shell.  Specifying this attribute
  787.                  is equivalent to specifying the '+' character at
  788.                  the start of each line of a non-group recipe.
  789.  
  790.      .UPDATEALL  Indicates that all the targets listed in this
  791.                  rule are updated by the execution of the accom-
  792.                  panying recipe.  A common example is the produc-
  793.                  tion of the y.tab.c and y.tab.h files by yacc
  794.                  when it is run on a grammar.  Specifying
  795.                  .UPDATEALL in such a rule prevents the running
  796.                  of yacc twice, once for the y.tab.c file and
  797.                  once for the y.tab.h file.  .UPDATEALL targets
  798.                  that are specified in a single rule are treated
  799.                  as a single target and all timestamps are
  800.                  updated whenever any target in the set is made.
  801.                  As a side-effect, dmake internally sorts such
  802.                  targets in ascending alphabetical order and the
  803.                  value of $@ is always the first target in the
  804.                  sorted set.
  805.  
  806.      All attributes are user setable and except for .UPDATEALL,
  807.      .SETDIR and .MKSARGS may be used in one of two forms.  The
  808.      .MKSARGS attribute is restricted to use as a global attri-
  809.      bute, and the use of the .UPDATEALL and .SETDIR attributes
  810.      is restricted to rules of the second form only.
  811.  
  812.           ATTRIBUTE_LIST : targets
  813.  
  814.      assigns the attributes specified by ATTRIBUTE_LIST to each
  815.      target in targets or
  816.  
  817.           targets ATTRIBUTE_LIST : ...
  818.  
  819.      assigns the attributes specified by ATTRIBUTE_LIST to each
  820.      target in targets. In the first form if targets is empty
  821.      (ie. a NULL list), then the list of attributes will apply to
  822.      all targets in the makefile (this is equivalent to the com-
  823.      mon Make construct of ".IGNORE :" but has been modified to
  824.      the notion of an attribute instead of a special target).
  825.      Not all of the attributes have global meaning.  In particu-
  826.      lar, .LIBRARY, .NOSTATE, .PHONY, .SETDIR, .SYMBOL and
  827.      .UPDATEALL have no assigned global meaning.
  828.  
  829.  
  830.  
  831.  
  832. Version 3.9 PL0                 UW                             13
  833.  
  834.  
  835.  
  836.  
  837. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  838.  
  839.  
  840.  
  841.      Any attribute may be used with any target, even with the
  842.      special targets.  Some combinations are useless (e.g.
  843.      .INCLUDE .PRECIOUS: ... ), while others are useful (e.g.
  844.      .INCLUDE .IGNORE : "file.mk" will not complain if file.mk
  845.      cannot be found using the include file search rules, see the
  846.      section on SPECIAL TARGETS for a description of .INCLUDE).
  847.      If a specified attribute will not be used with the special
  848.      target a warning is issued and the attribute is ignored.
  849.  
  850. MACROS
  851.      dmake supports six forms of macro assignment.
  852.  
  853.  
  854.      MACRO = LINE    This is the most common and familiar form of
  855.                      macro assignment.  It assigns LINE literally
  856.                      as the value of MACRO.  Future expansions of
  857.                      MACRO recursively expand its value.
  858.  
  859.      MACRO *= LINE   This form behaves exactly as the simple '='
  860.                      form with the exception that if MACRO
  861.                      already has a value then the assignment is
  862.                      not performed.
  863.  
  864.      MACRO := LINE   This form differs from the simple '=' form
  865.                      in that it expands LINE prior to assigning
  866.                      it as the value of MACRO.  Future expansions
  867.                      of MACRO do not recursively expand its
  868.                      value.
  869.  
  870.      MACRO *:= LINE  This form behaves exactly as the ':=' form
  871.                      with the exception that if MACRO already has
  872.                      a value then the assignment and expansion
  873.                      are not performed.
  874.  
  875.      MACRO += LINE   This form of macro assignment allows macro
  876.                      values to grow.  It takes the literal value
  877.                      of LINE and appends it to the previous value
  878.                      of MACRO separating the two by a single
  879.                      space.  Future expansions of MACRO recur-
  880.                      sively expand its value.
  881.  
  882.      MACRO +:= LINE  This form is similar to the '+=' form except
  883.                      that the value of LINE is expanded prior to
  884.                      being added to the value of MACRO.
  885.  
  886.      Macro expressions specified on the command line allow the
  887.      macro value to be redefined within the makefile only if the
  888.      macro is defined using the '+=' and '+:=' operators.  Other
  889.      operators will define a macro that cannot be further modi-
  890.      fied.
  891.  
  892.  
  893.  
  894.  
  895.  
  896. Version 3.9 PL0                 UW                             14
  897.  
  898.  
  899.  
  900.  
  901. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  902.  
  903.  
  904.  
  905.      Each of the preceeding macro assignment operators may be
  906.      prefixed by !  to indicate that the assignment should be
  907.      forced and that no warnings should be issued.  Thus, speci-
  908.      fying ! has the effect of silently forcing the specified
  909.      macro assignment.
  910.  
  911.      When dmake defines a non-environment macro it strips leading
  912.      and trailing white space from the macro value.  Macros
  913.      imported from the environment via either the .IMPORT special
  914.      target (see the SPECIAL TARGETS section), or the -e, or -E
  915.      flags are an exception to this rule.  Their values are
  916.      always taken literally and white space is never stripped.
  917.      In addition, named macros defined using the .IMPORT special
  918.      target do not have their values expanded when they are used
  919.      within a makefile.  In contrast, environment macros that are
  920.      imported due to the specification of the -e or -E flags are
  921.      subject to expansion when used.
  922.  
  923.      To specify a macro expansion enclose the name in () or {}
  924.      and precede it with a dollar sign $.  Thus $(TEST)
  925.      represents an expansion of the macro variable named TEST.
  926.      If TEST is defined then $(TEST) is replaced by its expanded
  927.      value.  If TEST is not defined then $(TEST) expands to the
  928.      NULL string (this is equivalent to defining a macro as
  929.      'TEST=' ).  A short form may be used for single character
  930.      named macros.  In this case the parentheses are optional,
  931.      and $(I) is equivalent to $I.  Macro expansion is recursive,
  932.      hence, if the value string contains an expression represent-
  933.      ing a macro expansion, the expansion is performed.  Circular
  934.      macro expansions are detected and cause an error to be
  935.      issued.
  936.  
  937.      When defining a macro the given macro name is first expanded
  938.      before being used to define the macro.  Thus it is possible
  939.      to define macros whose names depend on values of other mac-
  940.      ros.  For example, suppose CWD is defined as
  941.  
  942.           CWD = $(PWD:b)
  943.  
  944.      then the value of $(CWD) is the name of the current direc-
  945.      tory.  This can be used to define macros specific to this
  946.      directory, for example:
  947.  
  948.           _$(CWD).prt = list of files to print...
  949.  
  950.      The actual name of the defined macro is a function of the
  951.      current directory.  A construct such as this is useful when
  952.      processing a hierarchy of directories using .SETDIR attri-
  953.      buted targets and a collection of small distributed makefile
  954.      stubs.
  955.  
  956.  
  957.  
  958.  
  959.  
  960. Version 3.9 PL0                 UW                             15
  961.  
  962.  
  963.  
  964.  
  965. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  966.  
  967.  
  968.  
  969.      Macro variables may be defined within the makefile, on the
  970.      command line, or imported from the environment.
  971.  
  972.      dmake supports several non-standard macro expansions: The
  973.      first is of the form:
  974.  
  975.           $(macro_name:modifier_list:modifier_list:...)
  976.  
  977.      where modifier_list is chosen from the set { B or b, D or d,
  978.      E or e, F or f, I or i, L or l, S or s, T or t, U or u, ^, +
  979.      } and
  980.  
  981.           b  - file (not including suffix) portion of path names
  982.           d  - directory portion of all path names
  983.           e  - suffix portion of path names
  984.           f  - file (including suffix) portion of path names
  985.           i  - inferred names of targets
  986.           l  - macro value in lower case
  987.           s  - simple pattern substitution
  988.           t  - tokenization.
  989.           u  - macro value in upper case
  990.           ^  - prepend a prefix to each token
  991.           +  - append a suffix to each token
  992.  
  993.      Thus if we have the example:
  994.  
  995.           test = d1/d2/d3/a.out f.out d1/k.out
  996.  
  997.      The following macro expansions produce the values on the
  998.      right of '->' after expansion.
  999.  
  1000.           $(test:d)             -> d1/d2/d3/ d1/
  1001.           $(test:b)             -> a f k
  1002.           $(test:f)             -> a.out f.out k.out
  1003.           ${test:db}            -> d1/d2/d3/a f d1/k
  1004.           ${test:s/out/in/:f}   -> a.in f.in k.in
  1005.           $(test:f:t"+")        -> a.out+f.out+k.out
  1006.           $(test:e)             -> .out .out .out
  1007.           $(test:u)             -> D1/D2/D3/A.OUT F.OUT D1/K.OUT
  1008.  
  1009.      If a token ends in a string composed from the value of the
  1010.      macro DIRBRKSTR (ie. ends in a directory separator string,
  1011.      e.g. '/' in UNIX) and you use the :d modifier then the
  1012.      expansion returns the directory name less the final direc-
  1013.      tory separator string.  Thus successive pairs of :d modif-
  1014.      iers each remove a level of directory in the token string.
  1015.  
  1016.      The tokenization modifier takes all white space separated
  1017.      tokens from the macro value and separates them by the quoted
  1018.      separator string.  The separator string may contain the fol-
  1019.      lowing escape codes \a => <bel>, \b => <backspace>, \f =>
  1020.      <formfeed>, \n => <nl>, \r => <cr>, \t => <tab>, \v =>
  1021.  
  1022.  
  1023.  
  1024. Version 3.9 PL0                 UW                             16
  1025.  
  1026.  
  1027.  
  1028.  
  1029. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1030.  
  1031.  
  1032.  
  1033.      <vertical tab>, \" => ", and \xxx => <xxx> where xxx is the
  1034.      octal representation of a character.  Thus the expansion:
  1035.  
  1036.           $(test:f:t"+\n")
  1037.      produces:
  1038.           a.out+
  1039.           f.out+
  1040.           k.out
  1041.  
  1042.      The prefix operator ^ takes all white space separated tokens
  1043.      from the macro value and prepends string to each.
  1044.  
  1045.           $(test:f:^mydir/)
  1046.      produces:
  1047.           mydir/a.out mydir/f.out mydir/k.out
  1048.  
  1049.      The suffix operator + takes all white space separated tokens
  1050.      from the macro value and appends string to each.
  1051.  
  1052.           $(test:b:+.c)
  1053.      produces:
  1054.           a.c f.c k.c
  1055.  
  1056.      The next non-standard form of macro expansion allows for
  1057.      recursive macros.  It is possible to specify a $(macro_name)
  1058.      or ${macro_name} expansion where macro_name contains more $(
  1059.      ... ) or ${ ... } macro expansions itself.
  1060.  
  1061.      For example $(CC$(_HOST)$(_COMPILER)) will first expand
  1062.      CC$(_HOST)$(_COMPILER) to get a result and use that result
  1063.      as the name of the macro to expand.  This is useful for
  1064.      writing a makefile for more than one target environment.  As
  1065.      an example consider the following hypothetical case. Suppose
  1066.      that _HOST and _COMPILER are imported from the environment
  1067.      and are set to represent the host machine type and the host
  1068.      compiler respectively.
  1069.  
  1070.           CFLAGS_VAX_CC = -c -O     # _HOST == "_VAX", _COMPILER == "_CC"
  1071.           CFLAGS_PC_MSC = -c -ML # _HOST == "_PC",  _COMPILER == "_MSC"
  1072.  
  1073.           # redefine CFLAGS macro as:
  1074.  
  1075.           CFLAGS := $(CFLAGS$(_HOST)$(_COMPILER))
  1076.  
  1077.      This causes CFLAGS to take on a value that corresponds to
  1078.      the environment in which the make is being invoked.
  1079.  
  1080.      The final non-standard macro expansion is of the form:
  1081.  
  1082.           string1{token_list}string2
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088. Version 3.9 PL0                 UW                             17
  1089.  
  1090.  
  1091.  
  1092.  
  1093. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1094.  
  1095.  
  1096.  
  1097.      where string1, string2 and token_list are expanded.  After
  1098.      expansion, string1 is prepended to each token found in
  1099.      token_list and string2 is appended to each resulting token
  1100.      from the previous prepend.  string1 and string2 are not del-
  1101.      imited by white space whereas the tokens in token_list are.
  1102.      A null token in the token list is specified using "".  Thus
  1103.      using another example we have:
  1104.  
  1105.           test/{f1 f2}.o     --> test/f1.o test/f2.o
  1106.           test/ {f1 f2}.o    --> test/ f1.o f2.o
  1107.           test/{f1 f2} .o    --> test/f1 test/f2 .o
  1108.           test/{"f1"  ""}.o  --> test/f1.o test/.o
  1109.  
  1110.           and
  1111.  
  1112.           test/{d1 d2}/{f1 f2}.o --> test/d1/f1.o test/d1/f2.o
  1113.                                      test/d2/f1.o test/d2/f2.o
  1114.  
  1115.      This last expansion is activated only when the first charac-
  1116.      ters of token_list appear immediately after the opening '{'
  1117.      with no intervening white space.  The reason for this res-
  1118.      triction is the following incompatibility with Bourne Shell
  1119.      recipes.  The line
  1120.  
  1121.           { echo hello;}
  1122.  
  1123.      is valid /bin/sh syntax; while
  1124.  
  1125.           {echo hello;}
  1126.  
  1127.      is not.  Hence the latter triggers the enhanced macro expan-
  1128.      sion while the former causes it to be suppressed.  See the
  1129.      SPECIAL MACROS section for a description of the special mac-
  1130.      ros that dmake defines and understands.
  1131.  
  1132. RULES AND TARGETS
  1133.      A makefile contains a series of entries that specify depen-
  1134.      dencies.  Such entries are called target/prerequisite or
  1135.      rule definitions.  Each rule definition is optionally fol-
  1136.      lowed by a set of lines that provide a recipe for updating
  1137.      any targets defined by the rule.  Whenever dmake attempts to
  1138.      bring a target up to date and an explicit recipe is provided
  1139.      with a rule defining the target, that recipe is used to
  1140.      update the target.  A rule definition begins with a line
  1141.      having the following syntax:
  1142.  
  1143.           <targets> [<attributes>] <ruleop> [<prerequisites>] [;<recipe>]
  1144.  
  1145.      targets is a non-empty list of targets.  If the target is a
  1146.      special target (see SPECIAL TARGETS section below) then it
  1147.      must appear alone on the rule line.  For example:
  1148.  
  1149.  
  1150.  
  1151.  
  1152. Version 3.9 PL0                 UW                             18
  1153.  
  1154.  
  1155.  
  1156.  
  1157. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1158.  
  1159.  
  1160.  
  1161.           .IMPORT .ERROR : ...
  1162.  
  1163.      is not allowed since both .IMPORT and .ERROR are special
  1164.      targets.  Special targets are not used in the construction
  1165.      of the dependency graph and will not be made.
  1166.  
  1167.      attributes is a possibly empty list of attributes.  Any
  1168.      attribute defined in the ATTRIBUTES section above may be
  1169.      specified.  All attributes will be applied to the list of
  1170.      named targets in the rule definition.  No other targets will
  1171.      be affected.
  1172.  
  1173.  
  1174.      NOTE:   As stated earlier, if both the target list and
  1175.              prerequisite list are empty but the attributes list
  1176.              is not, then the specified attributes affect all
  1177.              targets in the makefile.
  1178.  
  1179.  
  1180.      ruleop is a separator which is used to identify the targets
  1181.      from the prerequisites.  Optionally it also provides a
  1182.      facility for modifying the way in which dmake handles the
  1183.      making of the associated targets.  In its simplest form the
  1184.      operator is a single ':', and need not be separated by white
  1185.      space from its neighboring tokens.  It may additionally be
  1186.      followed by any of the modifiers { !, ^, -, :, | }, where:
  1187.  
  1188.  
  1189.      !    says execute the recipe for the associated targets once
  1190.           for each out of date prerequisite.  Ordinarily the
  1191.           recipe is executed once for all out of date prere-
  1192.           quisites at the same time.
  1193.  
  1194.      ^    says to insert the specified prerequisites, if any,
  1195.           before any other prerequisites already associated with
  1196.           the specified targets.  In general, it is not useful to
  1197.           specify ^ with an empty list of prerequisites.
  1198.  
  1199.      -    says to clear the previous list of prerequisites before
  1200.           adding the new prerequisites.  Thus,
  1201.  
  1202.                .SUFFIXES :
  1203.                .SUFFIXES : .a .b
  1204.  
  1205.           can be replaced by
  1206.  
  1207.                .SUFFIXES :- .a .b
  1208.  
  1209.           however the old form still works as expected.  NOTE:
  1210.           .SUFFIXES is ignored by dmake it is used here simply as
  1211.           an example.
  1212.  
  1213.  
  1214.  
  1215.  
  1216. Version 3.9 PL0                 UW                             19
  1217.  
  1218.  
  1219.  
  1220.  
  1221. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1222.  
  1223.  
  1224.  
  1225.      :    When the rule operator is not modified by a second ':'
  1226.           only one set of rules may be specified for making a
  1227.           target.  Multiple definitions may be used to add to the
  1228.           list of prerequisites that a target depends on.  How-
  1229.           ever, if a target is multiply defined only one defini-
  1230.           tion may specify a recipe for making the target.
  1231.  
  1232.           When a target's rule operator is modified by a second
  1233.           ':' (:: for example) then this definition may not be
  1234.           the only definition with a recipe for the target.
  1235.           There may be other :: target definition lines that
  1236.           specify a different set of prerequisites with a dif-
  1237.           ferent recipe for updating the target. Any such target
  1238.           is made if any of the definitions find it to be out of
  1239.           date with respect to the related prerequisites and the
  1240.           corresponding recipe is used to update the target.  By
  1241.           definition all '::' recipes that are found to be out of
  1242.           date for are executed.
  1243.  
  1244.           In the following simple example, each rule has a `::'
  1245.           ruleop.  In such an operator we call the first `:' the
  1246.           operator, and the second `:' the modifier.
  1247.  
  1248.           a.o :: a.c b.h
  1249.              first recipe for making a.o
  1250.  
  1251.           a.o :: a.y b.h
  1252.              second recipe for making a.o
  1253.  
  1254.           If a.o is found to be out of date with respect to a.c
  1255.           then the first recipe is used to make a.o.  If it is
  1256.           found out of date with respect to a.y then the second
  1257.           recipe is used.  If a.o is out of date with respect to
  1258.           b.h then both recipes are invoked to make a.o.  In the
  1259.           last case the order of invocation corresponds to the
  1260.           order in which the rule definitions appear in the
  1261.           makefile.
  1262.  
  1263.      |    Is defined only for PERCENT rule target definitions.
  1264.           When specified it indicates that the following con-
  1265.           struct should be parsed using the old semantinc mean-
  1266.           ing:
  1267.  
  1268.           %.o :| %.c %.r %.f ; some rule
  1269.  
  1270.           is equivalent to:
  1271.  
  1272.           %.o : %.c ; some rule
  1273.           %.o : %.r ; some rule
  1274.           %.o : %.f ; some rule
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280. Version 3.9 PL0                 UW                             20
  1281.  
  1282.  
  1283.  
  1284.  
  1285. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1286.  
  1287.  
  1288.  
  1289.      Targets defined using a single `:' operator with a recipe
  1290.      may be redefined again with a new recipe by using a `:'
  1291.      operator with a `:' modifier.  This is equivalent to a tar-
  1292.      get having been initially defined with a rule using a `:'
  1293.      modifier.  Once a target is defined using a `:' modifier it
  1294.      may not be defined again with a recipe using only the `:'
  1295.      operator with no `:' modifier.  In both cases the use of a
  1296.      `:' modifier creates a new list of prerequisites and makes
  1297.      it the current prerequisite list for the target.  The `:'
  1298.      operator with no recipe always modifies the current list of
  1299.      prerequisites.  Thus assuming each of the following defini-
  1300.      tions has a recipe attached, then:
  1301.  
  1302.           joe :  fred ...     (1)
  1303.           joe :: more ...     (2)
  1304.  
  1305.           and
  1306.  
  1307.           joe :: fred ...     (3)
  1308.           joe :: more ...     (4)
  1309.  
  1310.      are legal and mean:  add the recipe associated with (2), or
  1311.      (4) to the set of recipes for joe, placing them after exist-
  1312.      ing recipes for making joe.  The constructs:
  1313.  
  1314.           joe :: fred ...     (5)
  1315.           joe : more ... (6)
  1316.  
  1317.           and
  1318.  
  1319.           joe : fred ... (7)
  1320.           joe : more ... (8)
  1321.  
  1322.      are errors since we have two sets of perfectly good recipes
  1323.      for making the target.
  1324.  
  1325.      prerequisites is a possibly empty list of targets that must
  1326.      be brought up to date before making the current target.
  1327.  
  1328.      recipe is a short form and allows the user to specify short
  1329.      rule definitions on a single line.  It is taken to be the
  1330.      first recipe line in a larger recipe if additional lines
  1331.      follow the rule definition.  If the semi-colon is present
  1332.      but the recipe line is empty (ie. null string) then it is
  1333.      taken to be an empty rule.  Any target so defined causes the
  1334.      Don't know how to make ... error message to be suppressed
  1335.      when dmake tries to make the target and fails.  This silence
  1336.      is maintained for rules that are terminated by a semicolon
  1337.      and have no following recipe lines, for targets listed on
  1338.      the command line, for the first target found in the
  1339.      makefile, and for any target having no recipe but containing
  1340.      a list of prerequisites (see the COMPATIBILITY section for
  1341.  
  1342.  
  1343.  
  1344. Version 3.9 PL0                 UW                             21
  1345.  
  1346.  
  1347.  
  1348.  
  1349. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1350.  
  1351.  
  1352.  
  1353.      an exception to this rule if the AUGMAKE (-A) flag was
  1354.      specified.
  1355.  
  1356. RECIPES
  1357.      The traditional format used by most versions of Make defines
  1358.      the recipe lines as arbitrary strings that may contain macro
  1359.      expansions.  They follow a rule definition line and may be
  1360.      spaced apart by comment or blank lines.  The list of recipe
  1361.      lines defining the recipe is terminated by a new target
  1362.      definition, a macro definition, or end-of-file.  Each recipe
  1363.      line MUST begin with a <TAB> character which may optionally
  1364.      be followed with one or all of the characters '@%+-'.  The
  1365.      '-' indicates that non-zero exit values (ie. errors) are to
  1366.      be ignored when this recipe line is executed, the '+' indi-
  1367.      cates that the current recipe line is to be executed using
  1368.      the shell, the '%' indicates that dmake should swap itself
  1369.      out to secondary storage (MSDOS only) before running the
  1370.      recipe and the '@' indicates that the recipe line should NOT
  1371.      be echoed to the terminal prior to being executed.  Each
  1372.      switch is off by default (ie. by default, errors are signi-
  1373.      ficant, commands are echoed, no swapping is done and a shell
  1374.      is used only if the recipe line contains a character found
  1375.      in the value of the SHELLMETAS macro).  Global settings
  1376.      activated via command line options or special attribute or
  1377.      target names may also affect these settings.  An example
  1378.      recipe:
  1379.  
  1380.           target :
  1381.                first recipe line
  1382.                second recipe line, executed independently of the first.
  1383.                @a recipe line that is not echoed
  1384.                -and one that has errors ignored
  1385.                %and one that causes dmake to swap out
  1386.                +and one that is executed using a shell.
  1387.  
  1388.      The second and new format of the recipe block begins the
  1389.      block with the character '[' (the open group character) in
  1390.      the last non-white space position of a line, and terminates
  1391.      the block with the character ']' (the close group character)
  1392.      in the first non-white space position of a line.  In this
  1393.      form each recipe line need not have a leading TAB.  This is
  1394.      called a recipe group.  Groups so defined are fed intact as
  1395.      a single unit to a shell for execution whenever the
  1396.      corresponding target needs to be updated.  If the open group
  1397.      character '[' is preceded by one or all of -, @ or % then
  1398.      they apply to the entire group in the same way that they
  1399.      apply to single recipe lines.  You may also specify '+' but
  1400.      it is redundant as a shell is already being used to run the
  1401.      recipe.  See the MAKING TARGETS section for a description of
  1402.      how dmake invokes recipes.  Here is an example of a group
  1403.      recipe:
  1404.  
  1405.  
  1406.  
  1407.  
  1408. Version 3.9 PL0                 UW                             22
  1409.  
  1410.  
  1411.  
  1412.  
  1413. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1414.  
  1415.  
  1416.  
  1417.           target :
  1418.           [
  1419.                first recipe line
  1420.                second recipe line
  1421.                all of these recipe lines are fed to a
  1422.                single copy of a shell for execution.
  1423.           ]
  1424.  
  1425.  
  1426. TEXT DIVERSIONS
  1427.      dmake supports the notion of text diversions.  If a recipe
  1428.      line contains the macro expression
  1429.  
  1430.           $(mktmp[,[file][,text]] data)
  1431.  
  1432.      then all text contained in the data expression is expanded
  1433.      and is written to a temporary file.  The return value of the
  1434.      macro is the name of the temporary file.
  1435.  
  1436.      data can be any text and must be separated from the 'mktmp'
  1437.      portion of the macro name by white-space.  The only restric-
  1438.      tion on the data text is that it must contain a balanced
  1439.      number of parentheses of the same kind as are used to ini-
  1440.      tiate the $(mktmp ...) expression.  For example:
  1441.  
  1442.           $(mktmp $(XXX))
  1443.  
  1444.      is legal and works as expected, but:
  1445.  
  1446.           $(mktmp text (to dump to file)
  1447.  
  1448.      is not legal.  You can achieve what you wish by either
  1449.      defining a macro that expands to '(' or by using {} in the
  1450.      macro expression; like this:
  1451.  
  1452.           ${mktmp text (to dump to file}
  1453.  
  1454.      Since the temporary file is opened when the macro containing
  1455.      the text diversion expression is expanded, diversions may be
  1456.      nested and any diversions that are created as part of ':='
  1457.      macro expansions persist for the duration of the dmake run.
  1458.      The diversion text may contain the same escape codes as
  1459.      those described in the MACROS section.  Thus if the data
  1460.      text is to contain new lines they must be inserted using the
  1461.      \n escape sequence.  For example the expression:
  1462.  
  1463.           all:
  1464.                cat $(mktmp this is a\n\
  1465.                test of the text diversion\n)
  1466.  
  1467.      is replaced by:
  1468.  
  1469.  
  1470.  
  1471.  
  1472. Version 3.9 PL0                 UW                             23
  1473.  
  1474.  
  1475.  
  1476.  
  1477. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1478.  
  1479.  
  1480.  
  1481.           cat /tmp/mk12294AA
  1482.  
  1483.      where the temporary file contains two lines both of which
  1484.      are terminated by a new-line.  If the data text spans multi-
  1485.      ple lines in the makefile then each line must be continued
  1486.      via the use of a \.  A second more illustrative example gen-
  1487.      erates a response file to an MSDOS link command:
  1488.  
  1489.           OBJ = fred.obj mary.obj joe.obj
  1490.           all : $(OBJ)
  1491.                link @$(mktmp $(^:t"+\n")\n)
  1492.  
  1493.      The result of making `all' in the second example is the com-
  1494.      mand:
  1495.  
  1496.           link @/tmp/mk02394AA
  1497.  
  1498.      where the temporary file contains:
  1499.  
  1500.           fred.obj+
  1501.           mary.obj+
  1502.           joe.obj
  1503.  
  1504.      The last line of the file is terminated by a new-line which
  1505.      is inserted due to the \n found at the end of the data
  1506.      string.
  1507.  
  1508.      If the optional file specifier is present then its expanded
  1509.      value is the name of the temporary file to create.  Whenever
  1510.      a $(mktmp ...) macro is expanded the macro $(TMPFILE) is set
  1511.      to a new temporary file name.  Thus the construct:
  1512.  
  1513.           $(mktmp,$(TMPFILE) data)
  1514.  
  1515.      is completely equivalent to not specifying the $(TMPFILE)
  1516.      optional argument.  Another example that would be useful for
  1517.      MSDOS users with a Turbo-C compiler
  1518.  
  1519.           $(mktmp,turboc.cfg $(CFLAGS))
  1520.  
  1521.      will place the contents of CFLAGS into a local turboc.cfg
  1522.      file.  The second optional argument, text, if present alters
  1523.      the name of the value returned by the $(mktmp ...) macro.
  1524.  
  1525.      Under MS-DOS text diversions may be a problem.  Many DOS
  1526.      tools require that path names which contain directories use
  1527.      the \ character to delimit the directories.  Some users how-
  1528.      ever wish to use the '/' to delimit pathnames and use
  1529.      environments that allow them to do so.  The macro USESHELL
  1530.      is set to "yes" if the current recipe is forced to use a
  1531.      shell via the .USESHELL or '+' directives, otherwise its
  1532.      value is "no".  The dmake startup files define the macro
  1533.  
  1534.  
  1535.  
  1536. Version 3.9 PL0                 UW                             24
  1537.  
  1538.  
  1539.  
  1540.  
  1541. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1542.  
  1543.  
  1544.  
  1545.      DIVFILE whose value is either the value of TMPFILE or the
  1546.      value of TMPFILE edited to replace any '/' characters to the
  1547.      appropriate value based on the current shell and whether it
  1548.      will be used to execute the recipe.
  1549.  
  1550.      Previous versions of dmake defined text diversions using <+,
  1551.      +> strings, where <+ started a text diversion and +> ter-
  1552.      minated one.  dmake is backward compatible with this con-
  1553.      struct only if the <+ and +> appear literally on the same
  1554.      recipe line or in the same macro value string.  In such
  1555.      instances the expression:
  1556.  
  1557.           <+data+>
  1558.  
  1559.      is mapped to:
  1560.  
  1561.           $(mktmp data)
  1562.  
  1563.      which is fully output compatible with the earlier construct.
  1564.      <+, +> constructs whose text spans multiple lines must be
  1565.      converted by hand to use $(mktmp ...).
  1566.  
  1567.      If the environment variable TMPDIR is defined then the tem-
  1568.      porary file is placed into the directory specified by that
  1569.      variable.  A makefile can modify the location of temporary
  1570.      files by defining a macro named TMPDIR and exporting it
  1571.      using the .EXPORT special target.
  1572.  
  1573. SPECIAL TARGETS
  1574.      This section describes the special targets that are recog-
  1575.      nized by dmake.  Some are affected by attributes and others
  1576.      are not.
  1577.  
  1578.      .ERROR        If defined then the recipe associated with
  1579.                    this target is executed whenever an error con-
  1580.                    dition is detected by dmake.  All attributes
  1581.                    that can be used with any other target may be
  1582.                    used with this target.  Any prerequisites of
  1583.                    this target will be brought up to date during
  1584.                    its processing.  NOTE:  errors will be ignored
  1585.                    while making this target, in extreme cases
  1586.                    this may cause some problems.
  1587.  
  1588.      .EXIT         If this target is encountered while parsing a
  1589.                    makefile then the parsing of the makefile is
  1590.                    immediately terminated at that point.
  1591.  
  1592.      .EXPORT       All prerequisites associated with this target
  1593.                    are assumed to correspond to macro names and
  1594.                    they and their values are exported to the
  1595.                    environment as environment strings at the
  1596.                    point in the makefile at which this target
  1597.  
  1598.  
  1599.  
  1600. Version 3.9 PL0                 UW                             25
  1601.  
  1602.  
  1603.  
  1604.  
  1605. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1606.  
  1607.  
  1608.  
  1609.                    appears.  Any attributes specified with this
  1610.                    target are ignored.  Only macros which have
  1611.                    been assigned a value in the makefile prior to
  1612.                    the export directive are exported, macros as
  1613.                    yet undefined or macros whose value contains
  1614.                    any of the characters "+=:*" are not exported.
  1615.                    is suppre
  1616.  
  1617.      .IMPORT       Prerequisite names specified for this target
  1618.                    are searched for in the environment and
  1619.                    defined as macros with their value taken from
  1620.                    the environment.  If the special name .EVERY-
  1621.                    THING is used as a prerequisite name then all
  1622.                    environment variables defined in the environ-
  1623.                    ment are imported.  The functionality of the
  1624.                    -E flag can be forced by placing the construct
  1625.                    .IMPORT : .EVERYTHING at the start of a
  1626.                    makefile.  Similarly, by placing the construct
  1627.                    at the end, one can emulate the effect of the
  1628.                    -e command line flag.  If a prerequisite name
  1629.                    cannot be found in the environment an error
  1630.                    message is issued.  .IMPORT accepts the
  1631.                    .IGNORE attribute.  When given, it causes
  1632.                    dmake to ignore the above error.  See the MAC-
  1633.                    ROS section for a description of the process-
  1634.                    ing of imported macro values.
  1635.  
  1636.      .INCLUDE      Parse another makefile just as if it had been
  1637.                    located at the point of the .INCLUDE in the
  1638.                    current makefile.  The list of prerequisites
  1639.                    gives the list of makefiles to try to read.
  1640.                    If the list contains multiple makefiles then
  1641.                    they are read in order from left to right.
  1642.                    The following search rules are used when try-
  1643.                    ing to locate the file.  If the filename is
  1644.                    surrounded by " or just by itself then it is
  1645.                    searched for in the current directory.  If it
  1646.                    is not found it is then searched for in each
  1647.                    of the directories specified as prerequisites
  1648.                    of the .INCLUDEDIRS special target.  If the
  1649.                    file name is surrounded by < and >, (ie.
  1650.                    <my_spiffy_new_makefile>) then it is searched
  1651.                    for only in the directories given by the
  1652.                    .INCLUDEDIRS special target.  In both cases if
  1653.                    the file name is a fully qualified name start-
  1654.                    ing at the root of the file system then it is
  1655.                    only searched for once, and the .INCLUDEDIRS
  1656.                    list is ignored.  .INCLUDE accepts the .IGNORE
  1657.                    and .SETDIR attributes.  If .IGNORE attribute
  1658.                    is given and the file cannot be found then
  1659.                    dmake continues processing, otherwise an error
  1660.                    message is generated.  The .SETDIR attribute
  1661.  
  1662.  
  1663.  
  1664. Version 3.9 PL0                 UW                             26
  1665.  
  1666.  
  1667.  
  1668.  
  1669. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1670.  
  1671.  
  1672.  
  1673.                    causes dmake to change directories to the
  1674.                    specified directory prior to attempting the
  1675.                    include operation.  If all fails dmake
  1676.                    attempts to make the file to be included.  If
  1677.                    making the file fails then dmake terminates
  1678.                    unless the .INCLUDE directive also specified
  1679.                    the .IGNORE attribute.  If .FIRST is specified
  1680.                    along with .INCLUDE then dmake attempts to
  1681.                    include each named prerequisite and will ter-
  1682.                    minate the inclusion with the first prere-
  1683.                    quisite that results in a successful inclu-
  1684.                    sion.
  1685.  
  1686.      .INCLUDEDIRS  The list of prerequisites specified for this
  1687.                    target defines the set of directories to
  1688.                    search when trying to include a makefile.
  1689.  
  1690.      .KEEP_STATE   This special target is a synonym for the macro
  1691.                    definition
  1692.  
  1693.                         .KEEP_STATE := _state.mk
  1694.  
  1695.                    It's effect is to turn on STATE keeping and to
  1696.                    define _state.mk as the state file.
  1697.  
  1698.      .MAKEFILES    The list of prerequisites is the set of files
  1699.                    to try to read as the default makefile.  By
  1700.                    default this target is defined as:
  1701.  
  1702.                         .MAKEFILES : makefile.mk Makefile
  1703.                    makefile
  1704.  
  1705.  
  1706.      .SOURCE       The prerequisite list of this target defines a
  1707.                    set of directories to check when trying to
  1708.                    locate a target file name.  See the section on
  1709.                    BINDING of targets for more information.
  1710.  
  1711.      .SOURCE.suff  The same as .SOURCE, except that the
  1712.                    .SOURCE.suff list is searched first when try-
  1713.                    ing to locate a file matching the a target
  1714.                    whose name ends in the suffix .suff.
  1715.  
  1716.      .REMOVE       The recipe of this target is used whenever
  1717.                    dmake needs to remove intermediate targets
  1718.                    that were made but do not need to be kept
  1719.                    around.  Such targets result from the applica-
  1720.                    tion of transitive closure on the dependency
  1721.                    graph.
  1722.  
  1723.      In addition to the special targets above, several other
  1724.      forms of targets are recognized and are considered special,
  1725.  
  1726.  
  1727.  
  1728. Version 3.9 PL0                 UW                             27
  1729.  
  1730.  
  1731.  
  1732.  
  1733. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1734.  
  1735.  
  1736.  
  1737.      their exact form and use is defined in the sections that
  1738.      follow.
  1739.  
  1740. SPECIAL MACROS
  1741.      dmake defines a number of special macros.  They are divided
  1742.      into three classes: control macros, run-time macros, and
  1743.      function macros.  The control macros are used by dmake to
  1744.      configure its actions, and are the preferred method of doing
  1745.      so.  In the case when a control macro has the same function
  1746.      as a special target or attribute they share the same name as
  1747.      the special target or attribute.  The run-time macros are
  1748.      defined when dmake makes targets and may be used by the user
  1749.      inside recipes.  The function macros provide higher level
  1750.      functions dealing with macro expansion and diversion file
  1751.      processing.
  1752.  
  1753. CONTROL MACROS
  1754.      To use the control macros simply assign them a value just
  1755.      like any other macro.  The control macros are divided into
  1756.      three groups: string valued macros, character valued macros,
  1757.      and boolean valued macros.
  1758.  
  1759.      The following are all of the string valued macros.  This
  1760.      list is divided into two groups.  The first group gives the
  1761.      string valued macros that are defined internally and cannot
  1762.      be directly set by the user.
  1763.  
  1764.      INCDEPTH        This macro's value is a string of digits
  1765.                      representing the current depth of makefile
  1766.                      inclusion.  In the first makefile level this
  1767.                      value is zero.
  1768.  
  1769.      MFLAGS          Is the list of flags that were given on the
  1770.                      command line including a leading switch
  1771.                      character.  The -f flag is not included in
  1772.                      this list.
  1773.  
  1774.      MAKECMD         Is the name with which dmake was invoked.
  1775.  
  1776.      MAKEDIR         Is the full path to the initial directory in
  1777.                      which dmake was invoked.
  1778.  
  1779.      MAKEFILE        Contains the string "-f makefile" where,
  1780.                      makefile is the name of initial user
  1781.                      makefile that was first read.
  1782.  
  1783.      MAKEFLAGS       Is the same as $(MFLAGS) but has no leading
  1784.                      switch character. (ie. MFLAGS =
  1785.                      -$(MAKEFLAGS))
  1786.  
  1787.      MAKEMACROS      Contains the complete list of macro expres-
  1788.                      sions that were specified on the command
  1789.  
  1790.  
  1791.  
  1792. Version 3.9 PL0                 UW                             28
  1793.  
  1794.  
  1795.  
  1796.  
  1797. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  1798.  
  1799.  
  1800.  
  1801.