v20i080: dmake - dmake version 3.7, Patch02e/12

Dennis Vadura dvadura at watdragon.waterloo.edu
Sun Jun 30 08:26:05 AEST 1991


Submitted-by: Dennis Vadura <dvadura at watdragon.waterloo.edu>
Posting-number: Volume 20, Issue 80
Archive-name: dmake/patch02e
Patch-To: dmake: Volume 19, Issue 22-58

#!/bin/sh
# this is dp2.04 (part 4 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file dm37p2 continued
#
if test ! -r _shar_seq_.tmp; then
	echo 'Please unpack part 1 first!'
	exit 1
fi
(read Scheck
 if test "$Scheck" != 4; then
	echo Please unpack part "$Scheck" next!
	exit 1
 else
	exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
	echo 'x - still skipping dm37p2'
else
echo 'x - continuing file dm37p2'
sed 's/^X//' << 'SHAR_EOF' >> 'dm37p2' &&
XX     quisite can be made.  Without _t_r_a_n_s_i_t_i_v_e _c_l_o_s_u_r_e on the
XX     inference graph the above rule describes precisely when an
XX     inference match terminates the search.  If transitive clo-
XX     sure is enabled (the usual case), and a prerequisite does
XX     not exist or cannot be made, then ddmmaakkee invokes the infer-
XX     ence algorithm recursively on the prerequisite to see if
XX     there is some way the prerequisite can be manufactured.
XX     For, if the prerequisite can be made then the current target
XX     can also be made using the current %-meta rule.  This means
XX     that there is no longer a need to give a rule for making a
XX     .o from a .y if you have already given a rule for making a
XX     .o from a .c and a .c from a .y.  In such cases ddmmaakkee can
XX     infer how to make the .o from the .y via the intermediary .c
XX     and will remove the .c when the .o is made.  Transitive clo-
XX     sure can be disabled by giving the -T switch on the command
XX     line.
XX
XX     A word of caution.  ddmmaakkee bases its transitive closure on
XX     the %-meta rule targets.  When it performs transitive clo-
XX     sure it infers how to make a target from a prerequisite by
XX     performing a pattern match as if the potential prerequisite
XX     were a new target.  The set of rules:
XX
XX          %.o : %.c :; rule for making .o from .c
XX
XX
XX
XVersion 3.70                    UW                             38
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX          %.c : %.y :; rule for making .c from .y
XX          % : RCS/%,v :; check out of RCS file
XX
XX     will, by performing transitive closure, allow ddmmaakkee to infer
XX     how to make a .o from a .y using a .c as an intermediate
XX     temporary file.  Additionally it will be able to infer how
XX     to make a .y from an RCS file, as long as that RCS file is
XX     in the RCS directory and has a name which ends in .y,v.  The
XX     transitivity computation is performed dynamically for each
XX     target that does not have a recipe.  This has potential to
XX     be costly if the %-meta rules are not carefully specified.
XX     The .NOINFER attribute is used to mark a %-meta node as
XX     being a final target during inference.  Any node with this
XX     attribute set will not be used for subsequent inferences.
XX     As an example the node RCS/%,v is marked as a final node
XX     since we know that if the RCS file does not exist there
XX     likely is no other way to make it.  Thus the standard
XX     startup makefile contains an entry similar to:
XX          .NOINFER : RCS/%,v
XX     Thereby indicating that the RCS file is the end of the
XX     inference chain.
XX
XX     Whenever the inference algorithm determines that a target
XX     can be made from more than one prerequisite and the infer-
XX     ence chains for the two methods are the same length the
XX     algorithm reports an ambiguity and prints the ambiguous
XX     inference chains.
XX
XX     ddmmaakkee tries to remove intermediate files resulting from
XX     transitive closure if the file is not marked as being PRE-
XX     CIOUS, or the --uu flag was not given on the command line, and
XX     if the inferred intermediate did not previously exist.
XX     Intermediate targets that existed prior to being made are
XX     never removed.  This is in keeping with the philosophy that
XX     ddmmaakkee should never remove things from the file system that
XX     it did not add.  If the special target .REMOVE is defined
XX     and has a recipe then ddmmaakkee constructs a list of the inter-
XX     mediate files to be removed and makes them prerequisites of
XX     .REMOVE.  It then makes .REMOVE thereby removing the prere-
XX     quisites if the recipe of .REMOVE says to.  Typically
XX     .REMOVE is defined in the startup file as:
XX
XX          .REMOVE :; $(RM) $<
XX
XMMAAKKIINNGG TTAARRGGEETTSS
XX     In order to update a target ddmmaakkee must execute a recipe.
XX     When a recipe needs to be executed it is first expanded so
XX     that any macros in the recipe text are expanded, and it is
XX     then either executed directly or passed to a shell.  ddmmaakkee
XX     supports two types of recipes.  The regular recipes and
XX     group recipes.
XX
XX
XX
XX
XVersion 3.70                    UW                             39
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX     When a regular recipe is invoked ddmmaakkee executes each line of
XX     the recipe separately using a new copy of a shell if a shell
XX     is required.  Thus effects of commands do not generally per-
XX     sist across recipe lines.  (e.g. cd requests in a recipe
XX     line do not carry over to the next recipe line) The decision
XX     on whether a shell is required to execute a command is based
XX     on the value of the macro SHELLMETAS or on the specification
XX     of '+' or .USESHELL for the current recipe or target respec-
XX     tively.  If any character in the value of SHELLMETAS is
XX     found in the expanded recipe text-line or the use of a shell
XX     is requested explicitly via '+' or .USESHELL then the com-
XX     mand is executed using a shell, otherwise the command is
XX     executed directly.  The shell that is used for execution is
XX     given by the value of the macro SHELL.  The flags that are
XX     passed to the shell are given by the value of SHELLFLAGS.
XX     Thus ddmmaakkee constructs the command line:
XX
XX          $(SHELL) $(SHELLFLAGS) $(expanded_recipe_command)
XX
XX     Normally ddmmaakkee writes the command line that it is about to
XX     invoke to standard output.  If the .SILENT attribute is set
XX     for the target or for the recipe line (via @), then the
XX     recipe line is not echoed.
XX
XX     Group recipe processing is similar to that of regular
XX     recipes, except that a shell is always invoked.  The shell
XX     that is invoked is given by the value of the macro GROUP-
XX     SHELL, and its flags are taken from the value of the macro
XX     GROUPFLAGS.  If a target has the .PROLOG attribute set then
XX     ddmmaakkee prepends to the shell script the recipe associated
XX     with the special target .GROUPPROLOG, and if the attribute
XX     .EPILOG is set as well, then the recipe associated with the
XX     special target .GROUPEPILOG is appended to the script file.
XX     This facility can be used to always prepend a common header
XX     and common trailer to group recipes.  Group recipes are
XX     echoed to standard output just like standard recipes, but
XX     are enclosed by lines beginning with [ and ].
XX
XX     The recipe flags [+,-,%,@] are recognized at the start of a
XX     recipe line even if they appear in a macro.  For example:
XX
XX          SH = +
XX          all:
XX               $(SH)echo hi
XX
XX     is completely equivalent to writing
XX
XX          SH = +
XX          all:
XX               +echo hi
XX
XX
XX
XX
XX
XVersion 3.70                    UW                             40
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX     The last step performed by ddmmaakkee prior to running a recipe
XX     is to set the macro CMNDNAME to the name of the command to
XX     execute (determined by finding the first white-space ending
XX     token in the command line).  It then sets the macro CMNDARGS
XX     to be the remainder of the line.  ddmmaakkee then expands the
XX     macro COMMAND which by default is set to
XX
XX          COMMAND = $(CMNDNAME) $(CMNDARGS)
XX
XX     The result of this final expansion is the command that will
XX     be executed.  The reason for this expansion is to allow for
XX     a different interface to the argument passing facilities
XX     (esp. under DOS) than that provided by ddmmaakkee. You can for
XX     example define COMMAND to be
XX
XX          COMMAND = $(CMNDNAME) @$(mktmp $(CMNDARGS))
XX
XX     which dumps the arguments into a temporary file and runs the
XX     command
XX
XX          $(CMNDNAME) @/tmp/ASAD23043
XX
XX     which has a much shorter argument list.  It is now up to the
XX     command to use the supplied argument as the source for all
XX     other arguments.  As an optimization, if COMMAND is not
XX     defined ddmmaakkee does not perform the above expansion.  On sys-
XX     tems, such as UNIX, that handle long command lines this pro-
XX     vides a slight saving in processing the makefiles.
XX
XMMAAKKIINNGG LLIIBBRRAARRIIEESS
XX     Libraries are easy to maintain using ddmmaakkee.  A library is a
XX     file containing a collection of object files.  Thus to make
XX     a library you simply specify it as a target with the
XX     .LIBRARY attribute set and specify its list of prere-
XX     quisites.  The prerequisites should be the object members
XX     that are to go into the library.  When ddmmaakkee makes the
XX     library target it uses the .LIBRARY attribute to pass to the
XX     prerequisites the .LIBMEMBER attribute and the name of the
XX     library.  This enables the file binding mechanism to look
XX     for the member in the library if an appropriate object file
XX     cannot be found. A small example best illustrates this.
XX
XX          mylib.a .LIBRARY : mem1.o mem2.o mem3.o
XX               rules for making library...
XX               # remember to remove .o's when lib is made
XX
XX          # equivalent to:  '%.o : %.c ; ...'
XX          .c.o :; rules for making .o from .c say
XX
XX     ddmmaakkee will use the .c.o rule for making the library members
XX     if appropriate .c files can be found using the search rules.
XX     NOTE:  this is not specific in any way to C programs, they
XX
XX
XX
XVersion 3.70                    UW                             41
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX     are simply used as an example.
XX
XX     ddmmaakkee tries to handle the old library construct format in a
XX     sensible way.  The construct _l_i_b_(_m_e_m_b_e_r_._o_) is separated and
XX     the _l_i_b portion is declared as a library target.  The new
XX     target is defined with the .LIBRARY attribute set and the
XX     _m_e_m_b_e_r_._o portion of the construct is declared as a prere-
XX     quisite of the lib target.  If the construct _l_i_b_(_m_e_m_b_e_r_._o_)
XX     appears as a prerequisite of a target in the makefile, that
XX     target has the new name of the lib assigned as its prere-
XX     quisite.  Thus the following example:
XX
XX          a.out : ml.a(a.o) ml.a(b.o); $(CC) -o $@  $<
XX
XX          .c.o :; $(CC) -c $(CFLAGS) -o $@  $<
XX          %.a:
XX               ar rv $@ $<
XX               ranlib $@
XX               rm -rf $<
XX
XX     constructs the following dependency graph.
XX
XX          a.out : ml.a; $(CC) -o $@  $<
XX          ml.a .LIBRARY : a.o b.o
XX
XX          %.o : %.c ; $(CC) -c $(CFLAGS) -o $@  $<
XX          %.a :
XX               ar rv $@ $<
XX               ranlib $@
XX               rm -rf $<
XX
XX     and making a.out then works as expected.
XX
XX     The same thing happens for any target of the form
XX     _l_i_b_(_(_e_n_t_r_y_)_).  These targets have an additional feature in
XX     that the _e_n_t_r_y target has the .SYMBOL attribute set automat-
XX     ically.
XX
XX     NOTE:  If the notion of entry points is supported by the
XX     archive and by ddmmaakkee (currently not the case) then ddmmaakkee
XX     will search the archive for the entry point and return not
XX     only the modification time of the member which defines the
XX     entry but also the name of the member file.  This name will
XX     then replace _e_n_t_r_y and will be used for making the member
XX     file.  Once bound to an archive member the .SYMBOL attribute
XX     is removed from the target.  This feature is presently dis-
XX     abled as there is little standardization among archive for-
XX     mats, and we have yet to find a makefile utilizing this
XX     feature (possibly due to the fact that it is unimplemented
XX     in most versions of UNIX Make).
XX
XX
XX
XX
XX
XVersion 3.70                    UW                             42
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX     Finally, when ddmmaakkee looks for a library member it must first
XX     locate the library file.  It does so by first looking for
XX     the library relative to the current directory and if it is
XX     not found it then looks relative to the current value of
XX     $(TMD).  This allows commonly used libraries to be kept near
XX     the root of a source tree and to be easily found by ddmmaakkee.
XX
XKKEEEEPP SSTTAATTEE
XX     ddmmaakkee supports the keeping of state information for targets
XX     that it makes whenever the macro .KEEP_STATE is assigned a
XX     value.  The value of the macro should be the name of a state
XX     file that will contain the state information.  If state
XX     keeping is enabled then each target that does not poses the
XX     .NOSTATE attribute will have a record written into the state
XX     file indicating the target's name, the current directory,
XX     the command used to update the target, and which, if any, ::
XX     rule is being used.  When you make this target again if any
XX     of this information does not match the previous settings and
XX     the target is not out dated it will still be re-made.  The
XX     assumption is that one of the conditions above has changed
XX     and that we wish to remake the target.  For example, state
XX     keeping is used in the maintenance of ddmmaakkee to test compile
XX     different versions of the source using different compilers.
XX     Changing the compiler causes the compilation flags to be
XX     modified and hence all sources to be recompiled.
XX
XX     The state file is an ascii file and is portable, however it
XX     is not in human readable form as the entries represent hash
XX     keys of the above information.
XX
XX     The Sun Microsystem's Make construct
XX
XX          .KEEP_STATE :
XX
XX     is recognized and is mapped to ..KKEEEEPP__SSTTAATTEE::==__ssttaattee..mmkk.  The
XX     ddmmaakkee version of state keeping does not include scanning C
XX     source files for dependencies like Sun Make.  This is
XX     specific to C programs and it was felt that it does not
XX     belong in make.  ddmmaakkee instead provides the tool, ccddeeppeenndd,
XX     to scan C source files and to produce depedency information.
XX     Users are free to modify cdepend to produce other dependency
XX     files.  (NOTE: ccddeeppeenndd does not come with the distribution
XX     at this time, but will be available in a patch in the near
XX     future)
XX
XMMUULLTTII PPRROOCCEESSSSIINNGG
XX     If the architecture supports it then ddmmaakkee is capable of
XX     making a target's prerequisites in parallel.  ddmmaakkee will
XX     make as much in parallel as it can and use a number of child
XX     processes up to the maximum specified by MAXPROCESS or by
XX     the value supplied to the -P command line flag.  A parallel
XX     make is enabled by setting the value of MAXPROCESS (either
XX
XX
XX
XVersion 3.70                    UW                             43
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX     directly or via -P option) to a value which is > 1.  ddmmaakkee
XX     guarantees that all dependencies as specified in the
XX     makefile are honored.  A target will not be made until all
XX     of its prerequisites have been made.  If a parallel make is
XX     being performed then the following restrictions on parallel-
XX     ism are enforced.
XX
XX          1.   Individual recipe lines in a non-group recipe are
XX               performed sequentially in the order in which they
XX               are specified within the makefile and in parallel
XX               with the recipes of other targets.
XX
XX          2.   If a target contains multiple recipe definitions
XX               (cf. :: rules) then these are performed sequen-
XX               tially in the order in which the :: rules are
XX               specified within the makefile and in parallel with
XX               the recipes of other targets.
XX
XX          3.   If a target rule contains the `!' modifier, then
XX               the recipe is performed sequentially for the list
XX               of outdated prerequisites and in parallel with the
XX               recipes of other targets.
XX
XX          4.   If a target has the .SEQUENTIAL attribute set then
XX               all of its prerequisites are made sequentially
XX               relative to one another (as if MAXPROCESS=1), but
XX               in parallel with other targets in the makefile.
XX
XX     Note:  If you specify a parallel make then the order of tar-
XX     get update and the order in which the associated recipes are
XX     invoked will not correspond to that displayed by the -n
XX     flag.
XX
XCCOONNDDIITTIIOONNAALLSS
XX     ddmmaakkee supports a makefile construct called a _c_o_n_d_i_t_i_o_n_a_l.
XX     It allows the user to conditionally select portions of
XX     makefile text for input processing and to discard other por-
XX     tions.  This becomes useful for writing makefiles that are
XX     intended to function for more than one target host and
XX     environment.  The conditional expression is specified as
XX     follows:
XX
XX          .IF  _e_x_p_r_e_s_s_i_o_n
XX             ... if text ...
XX          .ELIF  _e_x_p_r_e_s_s_i_o_n
XX             ... if text ...
XX          .ELSE
XX             ... else text ...
XX          .END
XX
XX     The .ELSE and .ELIF portions are optional, and the condi-
XX     tionals may be nested (ie.  the text may contain another
XX
XX
XX
XVersion 3.70                    UW                             44
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX     conditional).  .IF, .ELSE, and .END may appear anywhere in
XX     the makefile, but a single conditional expression may not
XX     span multiple makefiles.
XX
XX     _e_x_p_r_e_s_s_i_o_n can be one of the following three forms:
XX
XX          <text> | <text> == <text> | <text> != <text>
XX
XX     where _t_e_x_t is either text or a macro expression.  In any
XX     case, before the comparison is made, the expression is
XX     expanded.  The text portions are then selected and compared.
XX     White space at the start and end of the text portion is dis-
XX     carded before the comparison.  This means that a macro that
XX     evaluates to nothing but white space is considered a NULL
XX     value for the purpose of the comparison.  In the first case
XX     the expression evaluates TRUE if the text is not NULL other-
XX     wise it evaluates FALSE.  The remaining two cases both
XX     evaluate the expression on the basis of a string comparison.
XX     If a macro expression needs to be equated to a NULL string
XX     then compare it to the value of the macro $(NULL).  You can
XX     use the $(shell ...) macro to construct more complex test
XX     expressions.
XX
XEEXXAAMMPPLLEESS
XX          # A simple example showing how to use make
XX          #
XX          prgm : a.o b.o
XX               cc a.o b.o -o prgm
XX          a.o : a.c g.h
XX               cc a.c -o $@
XX          b.o : b.c g.h
XX               cc b.c -o $@
XX
XX     In the previous example prgm is remade only if a.o and/or
XX     b.o is out of date with respect to prgm.  These dependencies
XX     can be stated more concisely by using the inference rules
XX     defined in the standard startup file.  The default rule for
XX     making .o's from .c's looks something like this:
XX
XX          %.o : %.c; cc -c $(CFLAGS) -o $@ $<
XX
XX     Since there exists a rule (defined in the startup file) for
XX     making .o's from .c's ddmmaakkee will use that rule for manufac-
XX     turing a .o from a .c and we can specify our dependencies
XX     more concisely.
XX
XX          prgm : a.o b.o
XX               cc -o prgm $<
XX          a.o b.o : g.h
XX
XX     A more general way to say the above using the new macro
XX     expansions would be:
XX
XX
XX
XVersion 3.70                    UW                             45
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX          SRC = a b
XX          OBJ = {$(SRC)}.o
XX
XX          prgm : $(OBJ)
XX               cc -o $@ $<
XX
XX          $(OBJ) : g.h
XX
XX     If we want to keep the objects in a separate directory,
XX     called objdir, then we would write something like this.
XX
XX          SRC = a b
XX          OBJ = {$(SRC)}.o
XX
XX          prgm : $(OBJ)
XX               cc $< -o $@
XX
XX          $(OBJ) : g.h
XX          %.o : %.c
XX               $(CC) -c $(CFLAGS) -o $(@:f) $<
XX               mv $(@:f) objdir
XX
XX          .SOURCE.o : objdir       # tell make to look here for .o's
XX
XX     An example of building library members would go something
XX     like this: (NOTE:  The same rules as above will be used to
XX     produce .o's from .c's)
XX
XX          SRC  = a b
XX          LIB  = lib
XX          LIBm = { $(SRC) }.o
XX
XX          prgm: $(LIB)
XX               cc -o $@ $(LIB)
XX
XX          $(LIB) .LIBRARY : $(LIBm)
XX               ar rv $@ $<
XX               rm $<
XX
XX     Finally, suppose that each of the source files in the previ-
XX     ous example had the `:' character in their target name.
XX     Then we would write the above example as:
XX
XX          SRC  = f:a f:b
XX          LIB  = lib
XX          LIBm = "{ $(SRC) }.o"         # put quotes around each token
XX
XX          prgm: $(LIB)
XX               cc -o $@ $(LIB)
XX
XX          $(LIB) .LIBRARY : $(LIBm)
XX               ar rv $@ $<
XX
XX
XX
XVersion 3.70                    UW                             46
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX               rm $<
XX
XCCOOMMPPAATTIIBBIILLIITTYY
XX     There are two notable differences between ddmmaakkee and the
XX     standard version of BSD UNIX 4.2/4.3 Make.
XX
XX          1. BSD UNIX 4.2/4.3 Make supports wild card filename
XX             expansion for prerequisite names.  Thus if a direc-
XX             tory contains a.h, b.h and c.h, then a line like
XX
XX                  target: *.h
XX
XX             will cause UNIX make to expand the *.h into "a.h b.h
XX             c.h".  ddmmaakkee does not support this type of filename
XX             expansion.
XX
XX          2. Unlike UNIX make, touching a library member causes
XX             ddmmaakkee to search the library for the member name and
XX             to update the library time stamp.  This is only
XX             implemented in the UNIX version.  MSDOS and other
XX             versions may not have librarians that keep file time
XX             stamps, as a result ddmmaakkee touches the library file
XX             itself, and prints a warning.
XX
XX     ddmmaakkee is not compatible with GNU Make.  In particular it
XX     does not understand GNU Make's macro expansions that query
XX     the file system.
XX
XX     ddmmaakkee is fully compatible with SYSV AUGMAKE, and supports
XX     the following AUGMAKE features:
XX
XX          1. The word iinncclluuddee appearing at the start of a line
XX             can be used instead of the ".INCLUDE :" construct
XX             understood by ddmmaakkee.
XX
XX          2. The macro modifier expression $(macro:str=sub) is
XX             understood and is equivalent to the expression
XX             $(macro:s/str/sub), with the restriction that str
XX             must match the following regular expression:
XX
XX                  str[ |\t][ |\t]*
XX
XX             (ie. str only matches at the end of a token where
XX             str is a suffix and is terminated by a space, a tab,
XX             or end of line)
XX
XX          3. The macro % is defined to be $@ (ie. $% expands to
XX             the same value as $@).
XX
XX          4. The AUGMAKE notion of libraries is handled
XX             correctly.
XX
XX
XX
XX
XVersion 3.70                    UW                             47
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XX          5. When defining special targets for the inference
XX             rules and the AUGMAKE special target handling is
XX             enabled then the special target .X is equivalent to
XX             the %-rule "% : %.X".
XX
XX          6. Directories are always made if you specify --AA.  This
XX             is consistent with other UNIX versions of Make.
XX
XX          7. Makefiles that utilize virtual targets to force mak-
XX             ing of other targets work as expected if AUGMAKE
XX             special target handling is enabled.  For example:
XX
XX                  FRC:
XX                  myprog.o : myprog.c $(FRC) ; ...
XX
XX             Works as expected if you issue the command
XX
XX                  'ddmmaakkee -A FRC=FRC'
XX
XX             but fails with a 'don't know how to make FRC' error
XX             message if you do not specify AUGMAKE special target
XX             handling via the -A flag (or by setting AUGMAKE:=yes
XX             internally).
XX
XLLIIMMIITTSS
XX     In some environments the length of an argument string is
XX     restricted.  (e.g. MSDOS command line arguments cannot be
XX     longer than 128 bytes if you are using the standard
XX     command.com command interpreter as your shell, ddmmaakkee text
XX     diversions may help in these situations.)
XX
XPPOORRTTAABBIILLIITTYY
XX     To write makefiles that can be moved from one environment to
XX     another requires some forethought.  In particular you must
XX     define as macros all those things that may be different in
XX     the new environment.  ddmmaakkee has two facilities that help to
XX     support writing portable makefiles, recursive macros and
XX     conditional expressions.  The recursive macros, allow one to
XX     define environment configurations that allow different
XX     environments for similar types of operating systems.  For
XX     example the same make script can be used for SYSV and BSD
XX     but with different macro definitions.
XX
XX     To write a makefile that is portable between UNIX and MSDOS
XX     requires both features since in almost all cases you will
XX     need to define new recipes for making targets.  The recipes
XX     will probably be quite different since the capabilities of
XX     the tools on each machine are different.  Different macros
XX     will be needed to help handle the smaller differences in the
XX     two environments.
XX
XX
XX
XX
XX
XVersion 3.70                    UW                             48
XX
XX
XX
XX
XDMAKE(p)             Unsupported Free Software            DMAKE(p)
XX
XX
XX
XFFIILLEESS
XX     Makefile, makefile, startup.mk (use dmake -V to tell you
XX     where the startup file is)
XX
XSSEEEE AALLSSOO
XX     sh(1), csh(1), touch(1), f77(1), pc(1), cc(1)
XX     S.I. Feldman  _M_a_k_e _- _A _P_r_o_g_r_a_m _f_o_r _M_a_i_n_t_a_i_n_i_n_g _C_o_m_p_u_t_e_r _P_r_o_-
XX     _g_r_a_m_s
XX
XAAUUTTHHOORR
XX     Dennis Vadura, CS Dept. University of Waterloo.
XX     dvadura at watdragon.uwaterloo.ca
XX     Many thanks to Carl Seger for his helpful suggestions, and
XX     to Trevor John Thompson for his many excellent ideas and
XX     informative bug reports.
XX
XBBUUGGSS
XX     Some system commands return non-zero status inappropriately.
XX     Use --ii (`-' within the makefile) to overcome the difficulty.
XX
XX     Some systems do not have easily accessible time stamps for
XX     library members (MSDOS, AMIGA, etc) for these ddmmaakkee uses the
XX     time stamp of the library instead and prints a warning the
XX     first time it does so.  This is almost always ok, except
XX     when multiple makefiles update a single library file.  In
XX     these instances it is possible to miss an update if one is
XX     not careful.
XX
XX     This man page is way too long.
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XVersion 3.70                    UW                             49
XSHAR_EOF
Xchmod 0640 man/dmake.p ||
Xecho 'restore of man/dmake.p failed'
XWc_c="`wc -c < 'man/dmake.p'`"
Xtest 125864 -eq "$Wc_c" ||
X	echo 'man/dmake.p: original size 125864, current size' "$Wc_c"
Xfi
X# ============= man/dmake.tf ==============
Xif test -f 'man/dmake.tf' -a X != X; then
X	echo 'x - skipping man/dmake.tf (File already exists)'
Xelse
Xecho 'x - extracting man/dmake.tf (Text)'
Xsed 's/^X//' << 'SHAR_EOF' > 'man/dmake.tf' &&
X.\" Copyright (c) 1990 Dennis Vadura, All rights reserved.
X.\"
X.ds TB "0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.5i +0.5i +2.0i
X.de Ip
X.fi
X.nr Ip \w'\\$1 'u
X.IP "\\$1" \\n(Ipu
X\\$2
X.nf
X..
X.de Is
X.nr )I \w'\\$1'u
X..
X.de Ii
X.in \\n()Ru
X.nr )E 1
X.ns
X.ne 1.1v
X.it 1 }N
X.di ]B
X\&\\$1
X..
X.TH DMAKE p  "UW" "Version 3.70" "Unsupported Free Software"
X.SH NAME
X\fBdmake\fR \- maintain program groups, or interdependent files
X.SH SYNOPSIS
X.B dmake
X[\-ABceEhiknpqrsStTuVx] [\-v{dfimt}] [\-P#] [\-{f|C|K} file]
X[macro[*][+][:]=\fIvalue\fP ...] [target ...]
X.SH DESCRIPTION
X.PP
X.B dmake
Xexecutes commands found in an external file called a
X.I makefile
Xto update one or more target names.
XEach target may depend on zero or more prerequisite targets.
XIf any of the target's prerequisites is newer than the target or if the target
Xitself does not exist, then
X.B dmake
Xwill attempt to make the target.
X.PP
XIf no
X.B \-f
Xcommand line option is present then
X.B dmake
Xsearches for an existing
X.I makefile
Xfrom the list of prerequisites specified for the special target \fI.MAKEFILES\fR
X(see the STARTUP section for more details).
XIf "\-" is the name of the file specified to the
X.B \-f
Xflag then \fBdmake\fR uses standard input as the source of the makefile text.
X.PP
XAny macro definitions (arguments with embedded "="
Xsigns) that appear on the command line are processed first
Xand supersede definitions for macros of the same name found
Xwithin the makefile.  In general it is impossible for definitions found
Xinside the makefile to redefine a macro defined on the command line, see the
XMACROS section for an exception.
X.PP
XIf no
X.I target
Xnames are specified on the command line, then \fBdmake\fR uses the first
Xnon-special target found in the makefile as the default target.
XSee the
X.B "SPECIAL TARGETS"
Xsection for the list of special targets and their function.
X\fBdmake\fR is a re-implementation of the UNIX Make utility with
Xsignificant enhancements.  Makefiles written for most previous
Xversions of
X.I Make
Xwill be handled correctly by 
X.B dmake.
XKnown differences between \fBdmake\fR and other versions of make
Xare discussed in the
X.B COMPATIBILITY
Xsection found at the end of this document.
X.SH OPTIONS
X.IP "\fB\-A\fR"
XEnable AUGMAKE special inference rule transformations
X(see the "PERCENT(%) RULES" section), these are set to off by default.
X.IP "\fB\-B\fR"
XEnable the use of spaces instead of <tabs> to begin recipe lines.
XThis flag equivalent to the .NOTABS special macro and is further described
Xbelow.
X.IP "\fB\-c\fR"
XUse non-standard comment stripping.  If you specify \fB\-c\fP then
X.B dmake
Xwill treat any \fB#\fP character as a start of comment character wherever it
Xmay appear unless it is escaped by a \e.
X.IP "\fB\-C [+]file\fR"
XThis option writes to \fIfile\fP a copy of standard output and
Xstandard error from any child processes and from the
X.B dmake
Xprocess itself.  If you specify a \fB+\fP prior to the file name then
Xthe text is appended to the previous contents of \fIfile\fP.
XThis option is active in the MSDOS implementation only and is ignored
Xby non-MSDOS versions of
X.B dmake.
X.IP "\fB\-e\fR"
XRead the environment and define all strings of the
Xform '\fBENV\-VAR\fP=\fIevalue\fP'
Xdefined within as macros whose name is \fBENV\-VAR\fP,
Xand whose value is '\fIevalue\fP'.
XThe environment is processed prior to processing the user
Xspecified makefile thereby allowing definitions in the makefile to override
Xdefinitions in the environment.
X.IP "\fB\-E\fR"
XSame as \-e, except that the environment is processed after the
Xuser specified makefile has been processed
X(thus definitions in the environment override definitions in the makefile).
XThe \-e and \-E options are mutually exclusive.
XIf both are given the latter takes effect.
X.IP "\fB\-f file\fR"
XUse \fBfile\fR as the source for the makefile text.
XOnly one \fB\-f\fR option is allowed.
X.IP "\fB\-h\fR"
XPrint the command summary for \fBdmake\fR.
X.IP "\fB\-i\fR"
XTells \fBdmake\fR to ignore errors, and continue making other targets.
XThis is equivalent to the .IGNORE attribute or macro.
X.IP "\fB\-K file\fR"
XTurns on \fB.KEEP_STATE\fP state tracking and tells \fBdmake\fP to use
X\fIfile\fP as the state file.
X.IP "\fB\-k\fR"
XCauses \fBdmake\fR to ignore errors caused by command execution and to make
Xall targets not depending on targets that could not be made. 
XOrdinarily \fBdmake\fR stops after a command returns a non-zero status,
Xspecifying \fB\-k\fR causes \fBdmake\fR to ignore the error
Xand continue to make as much as possible.
X.IP "\fB\-n\fR"
XCauses \fBdmake\fR to print out what it would have executed,
Xbut does not actually execute the commands.  A special check is made for
Xthe string "$(MAKE)" inside a recipe line, if found, the line is expanded
Xand invoked, thereby enabling recursive makes to give a full
Xdescription of all that they will do.
XThe check for "$(MAKE)" is disabled inside group recipes.
X.IP "\fB\-p\fR"
XPrint out a version of the digested makefile in human readable form.
X(useful for debugging, but cannot be re-read by \fBdmake\fP)
X.IP "\fB\-P#\fR"
XOn systems that support multi-processing cause \fBdmake\fP to use \fI#\fP
Xconcurrent child processes to make targets.
XSee the "MULTI PROCESSING" section for more information.
X.IP "\fB\-q\fR"
XCheck and see if the target is up to date.  Exits with code 0 if up to date,
X1 otherwise.
X.IP "\fB\-r\fR"
XTells \fBdmake\fR not to read the initial startup makefile, see STARTUP
Xsection for more details.
X.IP "\fB\-s\fR"
XTells \fBdmake\fR to do all its work silently and not echo the commands it is
Xexecuting to stdout (also suppresses warnings).
XThis  is equivalent to the .SILENT attribute or macro.
X.IP "\fB\-S\fR"
XForce sequential execution of recipes on architectures which support
Xconcurrent makes.  For backward compatibility with old makefiles that have
Xnasty side-effect prerequisite dependencies.
X.IP "\fB\-t\fR"
XCauses \fBdmake\fR to touch the targets and bring them up to date
Xwithout executing any commands.
X.IP "\fB\-T\fR"
XTells \fBdmake\fP to not perform transitive closure on the inference graph.
X.IP "\fB\-u\fR"
XForce an unconditional update.  (ie. do everything that would
Xbe done if everything that a target depended on was out of date)
X.IP "\fB\-v[dfimt]\fR"
XVerbose flag, when making targets print to stdout what we are going to make
Xand what we think its time stamp is.  The optional flags \fB[dfimt]\fP can be
Xused to restrict the information that is displayed.  In the absence of any
Xoptional flags all are assumed to be given (ie. \fB\-v\fP is equivalent to
X\fB\-vdfimt\fP).  The meanings of the optional flags are:
X.RS
X.IP "\fBd\fP"
XNotify of change directory operations only.
X.IP "\fBf\fP"
XNotify of file I/O operations only.
X.IP "\fBi\fP"
XNotify of inference algorithm operation only.
X.IP "\fBm\fP"
XNotify of target update operations only.
X.IP "\fBt\fP"
XKeep any temporary files created; normally they are automatically deleted.
X.RE
X.IP "\fB\-V\fR"
XPrint the version of \fBdmake\fR, and values of builtin macros.
X.IP "\fB\-x\fR"
XUpon processing the user makefile export all non-internally defined macros
Xto the user's environment.  This option together with the \-e option
Xallows SYSV AUGMAKE recursive makes to function as expected.
X.SH INDEX
XHere is a list of the sections that follow and a short description of each.
XPerhaps you won't have to read the whole man page to find
Xwhat you need.
X.IP \fBSTARTUP\fP 1.9i
XDescribes \fBdmake\fP initialization.
X.IP \fBSYNTAX\fP 1.9i
XDescribes the syntax of makefile expressions.
X.IP \fBATTRIBUTES\fP 1.9i
XDescribes the notion of attributes and how they are used when
Xmaking targets.
X.IP \fBMACROS\fP 1.9i
XDefining and expanding macros.
X.IP "\fBRULES AND TARGETS" 1.9i
XHow to define targets and their prerequisites.
X.IP \fBRECIPES\fP 1.9i
XHow to tell \fBdmake\fP how to make a target.
X.IP "\fBTEXT DIVERSIONS\fP" 1.9i
XHow to use text diversions in recipes and macro expansions.
X.IP "\fBSPECIAL TARGETS\fP" 1.9i
XSome targets are special.
X.IP "\fBSPECIAL MACROS\fP" 1.9i
XMacros used by \fBdmake\fP to alter the processing of the makefile,
Xand those defined by \fBdmake\fP for the user.
X.IP "\fBCONTROL MACROS\fP" 1.9i
XItemized list of special control macros.
X.IP "\fBRUN-TIME MACROS\fP" 1.9i
XDiscussion of special run-time macros such as $@ and $<.
X.IP "\fBFUNCTION MACROS\fP" 1.9i
XGNU style function macros, only $(mktmp ...) for now.
X.IP "\fBDYNAMIC PREREQUISITES\fP" 1.9i
SHAR_EOF
true || echo 'restore of dm37p2 failed'
fi
echo 'End of  part 4'
echo 'File dm37p2 is continued in part 5'
echo 5 > _shar_seq_.tmp
exit 0

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent at sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent at uunet.uu.net.



More information about the Comp.sources.misc mailing list