home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: Dennis Vadura <dvadura@watdragon.waterloo.edu>
- Subject: v20i078: dmake - dmake version 3.7, Patch02c/12
- Message-ID: <1991Jun29.222527.4070@sparky.IMD.Sterling.COM>
- X-Md4-Signature: 998f407846e91d1f769152ca49a826e1
- Date: Sat, 29 Jun 1991 22:25:27 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
- Posting-number: Volume 20, Issue 78
- Archive-name: dmake/patch02c
- Patch-To: dmake: Volume 19, Issue 22-58
-
- #!/bin/sh
- # this is dp2.02 (part 2 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" != 2; 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 attribute string must be quoted using ". If a
- XX target having this attribute set also has the
- XX .IGNORE attribute set then if the change to the
- XX specified directory fails it will be ignored,
- XX and no error message will be issued.
- XX
- XX ..SSIILLEENNTT Do not echo the recipe lines when making any
- XX target with this attribute set, and do not issue
- XX any warnings.
- XX
- XX ..SSWWAAPP Under MSDOS when making a target with this
- XX attribute set swap the ddmmaakkee executable to disk
- XX prior to executing the recipe line. Also see
- XX the '%' recipe line flag defined in the RECIPES
- XX section.
- XX
- XX ..SSYYMMBBOOLL Target is a library member and is an entry point
- XX into a module in the library. This attribute is
- XX used only when searching a library for a target.
- XX Targets of the form lib((entry)) have this
- XX attribute set automatically.
- XX
- XX ..UUSSEESSHHEELLLL Force each recipe line of a target to be exe-
- XX cuted using a shell. Specifying this attribute
- XX is equivalent to specifying the '+' character at
- XX the start of each line of a non-group recipe.
- XX
- XX ..UUPPDDAATTEEAALLLL Indicates that all the targets listed in this
- XX rule are updated by the execution of the accom-
- XX panying recipe. A common example is the produc-
- XX tion of the _y_._t_a_b_._c and _y_._t_a_b_._h files by yyaacccc
- XX when it is run on a grammar. Specifying
- XX .UPDATEALL in such a rule prevents the running
- XX of yacc twice, once for the y.tab.c file and
- XX once for the y.tab.h file.
- XX
- XX
- XX All attributes are user setable and except for .UPDATEALL,
- XX .SETDIR and .MKSARGS may be used in one of two forms. The
- XX .MKSARGS attribute is restricted to use as a global attri-
- XX bute, and the use of the .UPDATEALL and .SETDIR attributes
- XX is restricted to rules of the second form only.
- XX
- XX ATTRIBUTE_LIST : _t_a_r_g_e_t_s
- XX
- XX assigns the attributes specified by ATTRIBUTE_LIST to each
- XX target in _t_a_r_g_e_t_s or
- XX
- XX
- XX
- XVersion 3.70 UW 11
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX _t_a_r_g_e_t_s ATTRIBUTE_LIST : ...
- XX
- XX assigns the attributes specified by ATTRIBUTE_LIST to each
- XX target in _t_a_r_g_e_t_s_. In the first form if _t_a_r_g_e_t_s is empty
- XX (ie. a NULL list), then the list of attributes will apply to
- XX all targets in the makefile (this is equivalent to the com-
- XX mon Make construct of _"_._I_G_N_O_R_E _:_" but has been modified to
- XX the notion of an attribute instead of a special target).
- XX Not all of the attributes have global meaning. In particu-
- XX lar, .LIBRARY, .SYMBOL, and .UPDATEALL have no assigned glo-
- XX bal meaning.
- XX
- XX Any attribute may be used with any target, even with the
- XX special targets. Some combinations are useless (e.g.
- XX .INCLUDE .PRECIOUS: ... ), while others are useful (e.g.
- XX .INCLUDE .IGNORE : "file.mk" will not complain if file.mk
- XX cannot be found using the include file search rules, see the
- XX section on SPECIAL TARGETS for a description of .INCLUDE).
- XX If a specified attribute will not be used with the special
- XX target a warning is issued and the attribute is ignored.
- XX
- XMMAACCRROOSS
- XX ddmmaakkee supports six types of macro assignment.
- XX
- XX
- XX MMAACCRROO == LLIINNEE This is the most common and familiar form of
- XX macro assignment. It assigns LINE literally
- XX as the value of MACRO. Future expansions of
- XX MACRO recursively expand its value.
- XX
- XX MMAACCRROO **== LLIINNEE This form behaves exactly as the simple '='
- XX form with the exception that if MACRO
- XX already has a value then the assignment is
- XX not performed.
- XX
- XX MMAACCRROO ::== LLIINNEE This form differs from the simple '=' form
- XX in that it expands LINE prior to assigning
- XX it as the value of MACRO. Future expansions
- XX of MACRO do not recursively expand its
- XX value.
- XX
- XX MMAACCRROO **::== LLIINNEE This form behaves exactly as the ':=' form
- XX with the exception that if MACRO already has
- XX a value then the assignment and expansion
- XX are not performed.
- XX
- XX MMAACCRROO ++== LLIINNEE This form of macro assignment allows macro
- XX values to grow. It takes the literal value
- XX of LINE and appends it to the previous value
- XX of MACRO separating the two by a single
- XX space. Future expansions of MACRO recur-
- XX sively expand its value.
- XX
- XX
- XX
- XVersion 3.70 UW 12
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX MMAACCRROO ++::== LLIINNEE This form is similar to the '+=' form except
- XX that the value of LINE is expanded prior to
- XX being added to the value of MACRO.
- XX
- XX Macro expressions specified on the command line allow the
- XX macro value to be redefined within the makefile only if the
- XX macro is defined using the '+=' and '+:=' operators. Other
- XX operators will define a macro that cannot be further modi-
- XX fied.
- XX
- XX When ddmmaakkee defines a non-environment macro it strips leading
- XX and trailing white space from the macro value. Macros
- XX imported from the environment via either the .IMPORT special
- XX target (see the SPECIAL TARGETS section), or the --ee, or --EE
- XX flags are an exception to this rule. Their values are
- XX always taken literally and white space is never stripped.
- XX In addition, named macros defined using the .IMPORT special
- XX target do not have their values expanded when they are used
- XX within a makefile. In contrast, environment macros that are
- XX imported due to the specification of the --ee or --EE flags are
- XX subject to expansion when used.
- XX
- XX To specify a macro expansion enclose the name in () or {}
- XX and precede it with a dollar sign $. Thus $(TEST)
- XX represents an expansion of the macro variable named TEST.
- XX If TEST is defined then $(TEST) is replaced by its expanded
- XX value. If TEST is not defined then $(TEST) expands to the
- XX NULL string (this is equivalent to defining a macro as
- XX 'TEST=' ). A short form may be used for single character
- XX named macros. In this case the parentheses are optional,
- XX and $(I) is equivalent to $I. Macro expansion is recursive,
- XX hence, if the value string contains an expression represent-
- XX ing a macro expansion, the expansion is performed. Circular
- XX macro expansions are detected and cause an error to be
- XX issued.
- XX
- XX When defining a macro the given macro name is first expanded
- XX before being used to define the macro. Thus it is possible
- XX to define macros whose names depend on values of other mac-
- XX ros. For example, suppose CWD is defined as
- XX
- XX CWD = $(PWD:b)
- XX
- XX then the value of $(CWD) is the name of the current direc-
- XX tory. This can be used to define macros specific to this
- XX directory, for example:
- XX
- XX _$(CWD).prt = list of files to print...
- XX
- XX The actual name of the defined macro is a function of the
- XX current directory. A construct such as this is useful when
- XX processing a hierarchy of directories using .SETDIR
- XX
- XX
- XX
- XVersion 3.70 UW 13
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX attributed targets and a collection of small distributed
- XX makefile stubs.
- XX
- XX Macro variables may be defined within the makefile, on the
- XX command line, or imported from the environment.
- XX
- XX ddmmaakkee supports several non-standard macro expansions: The
- XX first is of the form:
- XX
- XX _$_(_m_a_c_r_o___n_a_m_e_:_m_o_d_i_f_i_e_r___l_i_s_t_:_m_o_d_i_f_i_e_r___l_i_s_t_:_._._._)
- XX
- XX where _m_o_d_i_f_i_e_r___l_i_s_t is chosen from the set { D or d, F or f,
- XX B or b, S or s, T or t } and
- XX
- XX d - directory portion of all path names
- XX f - file (including suffix) portion of path names
- XX b - file (not including suffix) portion of path names
- XX s - simple pattern substitution
- XX t - tokenization.
- XX
- XX Thus if we have the example:
- XX
- XX test = d1/d2/d3/a.out f.out d1/k.out
- XX
- XX The following macro expansions produce the values on the
- XX right of '->' after expansion.
- XX
- XX $(test:d) -> d1/d2/d3/ d1/
- XX $(test:b) -> a f k
- XX $(test:f) -> a.out f.out k.out
- XX ${test:db} -> d1/d2/d3/a f d1/k
- XX ${test:s/out/in/:f} -> a.in f.in k.in
- XX $(test:f:t"+") -> a.out+f.out+k.out
- XX
- XX If a token ends in a string composed from the value of the
- XX macro DIRBRKSTR (ie. ends in a directory separator string,
- XX e.g. '/' in UNIX) and you use the ::dd modifier then the
- XX expansion returns the directory name less the final direc-
- XX tory separator string. Thus successive pairs of :d modif-
- XX iers each remove a level of directory in the token string.
- XX
- XX The tokenization modifier takes all white space separated
- XX tokens from the macro value and separates them by the quoted
- XX separator string. The separator string may contain the fol-
- XX lowing escape codes \a => <bel>, \b => <backspace>, \f =>
- XX <formfeed>, \n => <nl>, \r => <cr>, \t => <tab>, \v =>
- XX <vertical tab>, \" => ", and \xxx => <xxx> where xxx is the
- XX octal representation of a character. Thus the expansion:
- XX
- XX $(test:f:t"+\n")
- XX produces:
- XX a.out+
- XX
- XX
- XX
- XVersion 3.70 UW 14
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX f.out+
- XX k.out
- XX
- XX The second non-standard form of macro expansion allows for
- XX recursive macros. It is possible to specify a $(_m_a_c_r_o___n_a_m_e)
- XX or ${_m_a_c_r_o___n_a_m_e} expansion where _m_a_c_r_o___n_a_m_e contains more $(
- XX ... ) or ${ ... } macro expansions itself.
- XX
- XX For example $(CC$(_HOST)$(_COMPILER)) will first expand
- XX CC$(_HOST)$(_COMPILER) to get a result and use that result
- XX as the name of the macro to expand. This is useful for
- XX writing a makefile for more than one target environment. As
- XX an example consider the following hypothetical case. Suppose
- XX that _HOST and _COMPILER are imported from the environment
- XX and are set to represent the host machine type and the host
- XX compiler respectively.
- XX
- XX CFLAGS_VAX_CC = -c -O # _HOST == "_VAX", _COMPILER == "_CC"
- XX CFLAGS_PC_MSC = -c -ML # _HOST == "_PC", _COMPILER == "_MSC"
- XX
- XX # redefine CFLAGS macro as:
- XX
- XX CFLAGS := $(CFLAGS$(_HOST)$(_COMPILER))
- XX
- XX This causes CFLAGS to take on a value that corresponds to
- XX the environment in which the make is being invoked.
- XX
- XX The final non-standard macro expansion is of the form:
- XX
- XX string1{token_list}string2
- XX
- XX where string1, string2 and token_list are expanded. After
- XX expansion, string1 is prepended to each token found in
- XX token_list and string2 is appended to each resulting token
- XX from the previous prepend. string1 and string2 are not del-
- XX imited by white space whereas the tokens in token_list are.
- XX A null token in the token list is specified using "". Thus
- XX using another example we have:
- XX
- XX test/{f1 f2}.o --> test/f1.o test/f2.o
- XX test/ {f1 f2}.o --> test/ f1.o f2.o
- XX test/{f1 f2} .o --> test/f1 test/f2 .o
- XX test/{"f1" ""}.o --> test/f1.o test/.o
- XX
- XX and
- XX
- XX test/{d1 d2}/{f1 f2}.o --> test/d1/f1.o test/d1/f2.o
- XX test/d2/f1.o test/d2/f2.o
- XX
- XX This last expansion is activated only when the first charac-
- XX ters of _t_o_k_e_n___l_i_s_t appear immediately after the opening '{'
- XX with no intervening white space. The reason for this
- XX
- XX
- XX
- XVersion 3.70 UW 15
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX restriction is the following incompatibility with Bourne
- XX Shell recipes. The line
- XX
- XX { echo hello;}
- XX
- XX is valid /bin/sh syntax; while
- XX
- XX {echo hello;}
- XX
- XX is not. Hence the latter triggers the enhanced macro expan-
- XX sion while the former causes it to be suppressed. See the
- XX SPECIAL MACROS section for a description of the special mac-
- XX ros that ddmmaakkee defines and understands.
- XX
- XRRUULLEESS AANNDD TTAARRGGEETTSS
- XX A makefile contains a series of entries that specify depen-
- XX dencies. Such entries are called _t_a_r_g_e_t_/_p_r_e_r_e_q_u_i_s_i_t_e or
- XX _r_u_l_e definitions. Each rule definition is optionally fol-
- XX lowed by a set of lines that provide a recipe for updating
- XX any targets defined by the rule. Whenever ddmmaakkee attempts to
- XX bring a target up to date and an explicit recipe is provided
- XX with a rule defining the target, that recipe is used to
- XX update the target. A rule definition begins with a line
- XX having the following syntax:
- XX
- XX _<_t_a_r_g_e_t_s_> [_<_a_t_t_r_i_b_u_t_e_s_>] _<_r_u_l_e_o_p_> [_<_p_r_e_r_e_q_u_i_s_i_t_e_s_>] [;_<_r_e_c_i_p_e_>]
- XX
- XX _t_a_r_g_e_t_s is a non-empty list of targets. If the target is a
- XX special target (see SPECIAL TARGETS section below) then it
- XX must appear alone on the rule line. For example:
- XX
- XX .IMPORT .ERROR : ...
- XX
- XX is not allowed since both .IMPORT and .ERROR are special
- XX targets. Special targets are not used in the construction
- XX of the dependency graph and will not be made.
- XX
- XX _a_t_t_r_i_b_u_t_e_s is a possibly empty list of attributes. Any
- XX attribute defined in the ATTRIBUTES section above may be
- XX specified. All attributes will be applied to the list of
- XX named targets in the rule definition. No other targets will
- XX be affected.
- XX
- XX
- XX NOTE: As stated earlier, if both the target list and
- XX prerequisite list are empty but the attributes list
- XX is not, then the specified attributes affect all
- XX targets in the makefile.
- XX
- XX
- XX _r_u_l_e_o_p is a separator which is used to identify the targets
- XX from the prerequisites. Optionally it also provides a
- XX
- XX
- XX
- XVersion 3.70 UW 16
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX facility for modifying the way in which ddmmaakkee handles the
- XX making of the associated targets. In its simplest form the
- XX operator is a single ':', and need not be separated by white
- XX space from its neighboring tokens. It may additionally be
- XX followed by any of the modifiers { !, ^, -, : }, where:
- XX
- XX
- XX !! says execute the recipe for the associated targets once
- XX for each out of date prerequisite. Ordinarily the
- XX recipe is executed once for all out of date prere-
- XX quisites at the same time.
- XX
- XX ^^ says to insert the specified prerequisites, if any,
- XX before any other prerequisites already associated with
- XX the specified targets. In general, it is not useful to
- XX specify ^ with an empty list of prerequisites.
- XX
- XX -- says to clear the previous list of prerequisites before
- XX adding the new prerequisites. Thus,
- XX
- XX .SUFFIXES :
- XX .SUFFIXES : .a .b
- XX
- XX can be replaced by
- XX
- XX .SUFFIXES :- .a .b
- XX
- XX however the old form still works as expected. NOTE:
- XX .SUFFIXES is ignored by ddmmaakkee it is used here simply as
- XX an example.
- XX
- XX :: When the rule operator is not modified by a second ':'
- XX only one set of rules may be specified for making a
- XX target. Multiple definitions may be used to add to the
- XX list of prerequisites that a target depends on. How-
- XX ever, if a target is multiply defined only one defini-
- XX tion may specify a recipe for making the target.
- XX
- XX When a target's rule operator is modified by a second
- XX ':' (:: for example) then this definition may not be
- XX the only definition with a recipe for the target.
- XX There may be other :: target definition lines that
- XX specify a different set of prerequisites with a dif-
- XX ferent recipe for updating the target. Any such target
- XX is made if any of the definitions find it to be out of
- XX date with respect to the related prerequisites and the
- XX corresponding recipe is used to update the target.
- XX
- XX In the following simple example, each rule has a `::'
- XX _r_u_l_e_o_p. In such an operator we call the first `:' the
- XX operator, and the second `:' the modifier.
- XX
- XX
- XX
- XX
- XVersion 3.70 UW 17
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX a.o :: a.c b.h
- XX first recipe for making a.o
- XX
- XX a.o :: a.y b.h
- XX second recipe for making a.o
- XX
- XX If a.o is found to be out of date with respect to a.c
- XX then the first recipe is used to make a.o. If it is
- XX found out of date with respect to a.y then the second
- XX recipe is used. If a.o is out of date with respect to
- XX b.h then both recipes are invoked to make a.o. In the
- XX last case the order of invocation corresponds to the
- XX order in which the rule definitions appear in the
- XX makefile.
- XX
- XX Targets defined using a single `:' operator with a recipe
- XX may be redefined again with a new recipe by using a `:'
- XX operator with a `:' modifier. This is equivalent to a tar-
- XX get having been initially defined with a rule using a `:'
- XX modifier. Once a target is defined using a `:' modifier it
- XX may not be defined again with a recipe using only the `:'
- XX operator with no `:' modifier. In both cases the use of a
- XX `:' modifier creates a new list of prerequisites and makes
- XX it the current prerequisite list for the target. The `:'
- XX operator with no recipe always modifies the current list of
- XX prerequisites. Thus assuming each of the following defini-
- XX tions has a recipe attached, then:
- XX
- XX joe : fred ... (1)
- XX joe :: more ... (2)
- XX
- XX and
- XX
- XX joe :: fred ... (3)
- XX joe :: more ... (4)
- XX
- XX are legal and mean: add the recipe associated with (2), or
- XX (4) to the set of recipes for joe, placing them after exist-
- XX ing recipes for making joe. The constructs:
- XX
- XX joe :: fred ... (5)
- XX joe : more ... (6)
- XX
- XX and
- XX
- XX joe : fred ... (7)
- XX joe : more ... (8)
- XX
- XX are errors since we have two sets of perfectly good recipes
- XX for making the target.
- XX
- XX
- XX
- XX
- XX
- XVersion 3.70 UW 18
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX _p_r_e_r_e_q_u_i_s_i_t_e_s is a possibly empty list of targets that must
- XX be brought up to date before making the current target.
- XX
- XX _r_e_c_i_p_e is a short form and allows the user to specify short
- XX rule definitions on a single line. It is taken to be the
- XX first recipe line in a larger recipe if additional lines
- XX follow the rule definition. If the semi-colon is present
- XX but the recipe line is empty (ie. null string) then it is
- XX taken to be an empty rule. Any target so defined causes the
- XX _D_o_n_'_t _k_n_o_w _h_o_w _t_o _m_a_k_e _._._. error message to be suppressed
- XX when ddmmaakkee tries to make the target and fails. This silence
- XX is maintained for rules that are terminated by a semicolon
- XX and have no following recipe lines, for targets listed on
- XX the command line, for the first target found in the
- XX makefile, and for any target having no recipe but containing
- XX a list of prerequisites (see the COMPATIBILITY section for
- XX an exception to this rule if the AUGMAKE (--AA) flag was
- XX specified.
- XX
- XRREECCIIPPEESS
- XX The traditional format used by most versions of Make defines
- XX the recipe lines as arbitrary strings that may contain macro
- XX expansions. They follow a rule definition line and may be
- XX spaced apart by comment or blank lines. The list of recipe
- XX lines defining the recipe is terminated by a new target
- XX definition, a macro definition, or end-of-file. Each recipe
- XX line MMUUSSTT begin with a <<TTAABB>> character which may optionally
- XX be followed with one or all of the characters _'_@_%_+_-_'. The
- XX _'_-_' indicates that non-zero exit values (ie. errors) are to
- XX be ignored when this recipe line is executed, the _'_+_' indi-
- XX cates that the current recipe line is to be executed using
- XX the shell, the _'_%_' indicates that ddmmaakkee should swap itself
- XX out to secondary storage (MSDOS only) before running the
- XX recipe and the _'_@_' indicates that the recipe line should NOT
- XX be echoed to the terminal prior to being executed. Each
- XX switch is off by default (ie. by default, errors are signi-
- XX ficant, commands are echoed, no swapping is done and a shell
- XX is used only if the recipe line contains a character found
- XX in the value of the SHELLMETAS macro). Global settings
- XX activated via command line options or special attribute or
- XX target names may also affect these settings. An example
- XX recipe:
- XX
- XX target :
- XX first recipe line
- XX second recipe line, executed independently of the first.
- XX @a recipe line that is not echoed
- XX -and one that has errors ignored
- XX %and one that causes dmake to swap out
- XX +and one that is executed using a shell.
- XX
- XX
- XX
- XX
- XX
- XVersion 3.70 UW 19
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX The second and new format of the recipe block begins the
- XX block with the character '[' (the open group character) in
- XX the last non-white space position of a line, and terminates
- XX the block with the character ']' (the close group character)
- XX in the first non-white space position of a line. In this
- XX form each recipe line need not have a leading TAB. This is
- XX called a recipe group. Groups so defined are fed intact as
- XX a single unit to a shell for execution whenever the
- XX corresponding target needs to be updated. If the open group
- XX character '[' is preceded by one or all of -, @ or % then
- XX they apply to the entire group in the same way that they
- XX apply to single recipe lines. You may also specify '+' but
- XX it is redundant as a shell is already being used to run the
- XX recipe. See the MAKING TARGETS section for a description of
- XX how ddmmaakkee invokes recipes. Here is an example of a group
- XX recipe:
- XX
- XX target :
- XX [
- XX first recipe line
- XX second recipe line
- XX all of these recipe lines are fed to a
- XX single copy of a shell for execution.
- XX ]
- XX
- XX
- XTTEEXXTT DDIIVVEERRSSIIOONNSS
- XX ddmmaakkee supports the notion of text diversions. If a recipe
- XX line contains the macro expression
- XX
- XX $(mktmp[,[_f_i_l_e][,_t_e_x_t]] _d_a_t_a)
- XX
- XX then all text contained in the _d_a_t_a expression is expanded
- XX and is written to a temporary file. The return value of the
- XX macro is the name of the temporary file.
- XX
- XX _d_a_t_a can be any text and must be separated from the 'mktmp'
- XX portion of the macro name by white-space. The only restric-
- XX tion on the data text is that it must contain a balanced
- XX number of parentheses of the same kind as are used to ini-
- XX tiate the $(mktmp ...) expression. For example:
- XX
- XX $(mktmp $(XXX))
- XX
- XX is legal and works as expected, but:
- XX
- XX $(mktmp text (to dump to file)
- XX
- XX is not legal. You can achieve what you wish by either
- XX defining a macro that expands to '(' or by using {} in the
- XX macro expression; like this:
- XX
- XX
- XX
- XX
- XVersion 3.70 UW 20
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX ${mktmp text (to dump to file}
- XX
- XX Since the temporary file is opened when the macro containing
- XX the text diversion expression is expanded, diversions may
- XX now be nested and any diversions that are created as part of
- XX ':=' macro expansions persist for the duration of the ddmmaakkee
- XX run. The diversion text may contain the same escape codes
- XX as those described in the MACROS section. Thus if the _d_a_t_a
- XX text is to contain new lines they must be inserted using the
- XX \n escape sequence. For example the expression:
- XX
- XX all:
- XX cat $(mktmp this is a\n\
- XX test of the text diversion\n)
- XX
- XX is replaced by:
- XX
- XX cat /tmp/mk12294AA
- XX
- XX where the temporary file contains two lines both of which
- XX are terminated by a new-line. If the _d_a_t_a text spans multi-
- XX ple lines in the makefile then each line must be continued
- XX via the use of a \. A second more illustrative example gen-
- XX erates a response file to an MSDOS link command:
- XX
- XX OBJ = fred.obj mary.obj joe.obj
- XX all : $(OBJ)
- XX link @$(mktmp $(^:t"+\n")\n)
- XX
- XX The result of making `all' in the second example is the com-
- XX mand:
- XX
- XX link @/tmp/mk02394AA
- XX
- XX where the temporary file contains:
- XX
- XX fred.obj+
- XX mary.obj+
- XX joe.obj
- XX
- XX The last line of the file is terminated by a new-line which
- XX is inserted due to the \n found at the end of the _d_a_t_a
- XX string.
- XX
- XX If the optional _f_i_l_e specifier is present then its expanded
- XX value is the name of the temporary file to create. Whenever
- XX a $(mktmp ...) macro is expanded the macro $(TMPFILE) is set
- XX to a new temporary file name. Thus the construct:
- XX
- XX $(mktmp,$(TMPFILE) data)
- XX
- XX is completely equivalent to not specifying the $(TMPFILE)
- XX
- XX
- XX
- XVersion 3.70 UW 21
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX optional argument. Another example that would be useful for
- XX MSDOS users with a Turbo-C compiler
- XX
- XX $(mktmp,turboc.cfg $(CFLAGS))
- XX
- XX will place the contents of CFLAGS into a local _t_u_r_b_o_c_._c_f_g
- XX file. The second optional argument, _t_e_x_t, if present alters
- XX the name of the value returned by the $(mktmp ...) macro.
- XX
- XX Under MS-DOS text diversions may be a problem. Many DOS
- XX tools require that path names which contain directories use
- XX the \ character to delimit the directories. Some users how-
- XX ever wish to use the '/' to delimit pathnames and use
- XX environments that allow them to do so. The macro USESHELL
- XX is set to "yes" if the current recipe is forced to use a
- XX shell via the .USESHELL or '+' directives, otherwise its
- XX value is "no". The ddmmaakkee startup files define the macro
- XX DIVFILE whose value is either the value of TMPFILE or the
- XX value of TMPFILE edited to replace any '/' characters to the
- XX appropriate value based on the current shell and whether it
- XX will be used to execute the recipe.
- XX
- XX Previous versions of ddmmaakkee defined text diversions using <+,
- XX +> strings, where <+ started a text diversion and +> ter-
- XX minated one. ddmmaakkee is backward compatible with this con-
- XX struct if the <+ and +> appear literally on the same recipe
- XX line or in the same macro value string. In such instances
- XX the expression:
- XX
- XX <+data+>
- XX
- XX is mapped to:
- XX
- XX $(mktmp data)
- XX
- XX which is fully output compatible with the earlier construct.
- XX <+, +> constructs whose text spans multiple lines must be
- XX converted by hand to use $(mktmp ...).
- XX
- XX If the environment variable TMPDIR is defined then the tem-
- XX porary file is placed into the directory specified by that
- XX variable. A makefile can modify the location of temporary
- XX files by defining a macro named TMPDIR and exporting it
- XX using the .EXPORT special target.
- XX
- XSSPPEECCIIAALL TTAARRGGEETTSS
- XX This section describes the special targets that are recog-
- XX nized by ddmmaakkee. Some are affected by attributes and others
- XX are not.
- XX
- XX ..EERRRROORR If defined then the recipe associated with
- XX this target is executed whenever an error
- XX
- XX
- XX
- XVersion 3.70 UW 22
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX condition is detected by ddmmaakkee. All attri-
- XX butes that can be used with any other target
- XX may be used with this target. Any prere-
- XX quisites of this target will be brought up to
- XX date during its processing. NOTE: errors
- XX will be ignored while making this target, in
- XX extreme cases this may cause some problems.
- XX
- XX ..EEXXPPOORRTT All prerequisites associated with this target
- XX are assumed to correspond to macro names and
- XX they and their values are exported to the
- XX environment as environment strings at the
- XX point in the makefile at which this target
- XX appears. Any attributes specified with this
- XX target are ignored. Only macros which have
- XX been assigned a value in the makefile prior to
- XX the export directive are exported, macros as
- XX yet undefined are not exported.
- XX
- XX ..IIMMPPOORRTT Prerequisite names specified for this target
- XX are searched for in the environment and
- XX defined as macros with their value taken from
- XX the environment. If the special name ..EEVVEERRYY----
- XX TTHHIINNGG is used as a prerequisite name then all
- XX environment variables defined in the environ-
- XX ment are imported. The functionality of the
- XX --ee flag can be forced by placing the construct
- XX _._I_M_P_O_R_T _: _._E_V_E_R_Y_T_H_I_N_G at the start of a
- XX makefile. Similarly, by placing the construct
- XX at the end, one can emulate the effect of the
- XX --EE command line flag. If a prerequisite name
- XX cannot be found in the environment an error
- XX message is issued. .IMPORT accepts the
- XX .IGNORE attribute. When given, it causes
- XX ddmmaakkee to ignore the above error. See the MAC-
- XX ROS section for a description of the process-
- XX ing of imported macro values.
- XX
- XX ..IINNCCLLUUDDEE Parse another makefile just as if it had been
- XX located at the point of the .INCLUDE in the
- XX current makefile. The list of prerequisites
- XX gives the list of makefiles to try to read.
- XX If the list contains multiple makefiles then
- XX they are read in order from left to right.
- XX The following search rules are used when try-
- XX ing to locate the file. If the filename is
- XX surrounded by " or just by itself then it is
- XX searched for in the current directory. If it
- XX is not found it is then searched for in each
- XX of the directories specified for the .INCLU-
- XX DEDIRS special target. If the file name is
- XX surrounded by < and >, (ie.
- XX
- XX
- XX
- XVersion 3.70 UW 23
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX <my_spiffy_new_makefile>) then it is searched
- XX for only in the directories given by the
- XX .INCLUDEDIRS special target. In both cases if
- XX the file name is a fully qualified name start-
- XX ing at the root of the file system then it is
- XX only searched for once, and the .INCLUDEDIRS
- XX list is ignored. .INCLUDE accepts the .IGNORE
- XX and .SETDIR attributes. If .IGNORE attribute
- XX is given and the file cannot be found then
- XX ddmmaakkee continues processing, otherwise an error
- XX message is generated. The .SETDIR attribute
- XX causes ddmmaakkee to change directories to the
- XX specified directory prior to attempting the
- XX include operation.
- XX
- XX ..IINNCCLLUUDDEEDDIIRRSS The list of prerequisites specified for this
- XX target defines the set of directories to
- XX search when trying to include a makefile.
- XX
- XX ..KKEEEEPP__SSTTAATTEE This special target is a synonym for the macro
- XX definition
- XX
- XX .KEEP_STATE := _state.mk
- XX
- XX It's effect is to turn on STATE keeping and to
- XX define ___s_t_a_t_e_._m_k as the state file.
- XX
- XX ..MMAAKKEEFFIILLEESS The list of prerequisites is the set of files
- XX to try to read as the default makefile. By
- XX default this target is defined as:
- XX
- XX .MAKEFILES : makefile.mk Makefile
- XX makefile
- XX
- XX
- XX ..SSOOUURRCCEE The prerequisite list of this target defines a
- XX set of directories to check when trying to
- XX locate a target file name. See the section on
- XX BINDING of targets for more information.
- XX
- XX ..SSOOUURRCCEE..ssuuffff The same as .SOURCE, except that the
- XX .SOURCE.suff list is searched first when try-
- XX ing to locate a file matching the a target
- XX whose name ends in the suffix .suff.
- XX
- XX ..RREEMMOOVVEE The recipe of this target is used whenever
- XX ddmmaakkee needs to remove intermediate targets
- XX that were made but do not need to be kept
- XX around. Such targets result from the applica-
- XX tion of transitive closure on the dependency
- XX graph.
- XX
- XX
- XX
- XX
- XVersion 3.70 UW 24
- XX
- XX
- XX
- XX
- XDMAKE(p) Unsupported Free Software DMAKE(p)
- XX
- XX
- XX
- XX In addition to the special targets above, several other
- XX forms of targets are recognized and are considered special,
- XX their exact form and use is defined in the sections that
- XX follow.
- XX
- XSSPPEECCIIAALL MMAACCRROOSS
- SHAR_EOF
- true || echo 'restore of dm37p2 failed'
- fi
- echo 'End of part 2'
- echo 'File dm37p2 is continued in part 3'
- echo 3 > _shar_seq_.tmp
- exit 0
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@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@uunet.uu.net.
-