📄 dmake.man
字号:
joe : fred ... (1)
joe :: more ... (2)
and
joe :: fred ... (3)
joe :: more ... (4)
are legal and mean: add the recipe associated with (2), or
(4) to the set of recipes for joe, placing them after exist-
ing recipes for making joe. The constructs:
joe :: fred ... (5)
joe : more ... (6)
and
joe : fred ... (7)
joe : more ... (8)
are errors since we have two sets of perfectly good recipes
for making the target.
_p_r_e_r_e_q_u_i_s_i_t_e_s is a possibly empty list of targets that must
be brought up to date before making the current target.
_r_e_c_i_p_e is a short form and allows the user to specify short
rule definitions on a single line. It is taken to be the
first recipe line in a larger recipe if additional lines
follow the rule definition. If the semi-colon is present
but the recipe line is empty (ie. null string) then it is
taken to be an empty rule. Any target so defined causes the
_D_o_n_'_t _k_n_o_w _h_o_w _t_o _m_a_k_e _._._. error message to be suppressed
when ddmmaakkee tries to make the target and fails. This silence
is maintained for rules that are terminated by a semicolon
and have no following recipe lines, for targets listed on
the command line, for the first target found in the
makefile, and for any target having no recipe but containing
a list of prerequisites (see the COMPATIBILITY section for
Version 3.9 PL0 UW 21
DMAKE(p) Unsupported Free Software DMAKE(p)
an exception to this rule if the AUGMAKE (--AA) flag was
specified.
RREECCIIPPEESS
The traditional format used by most versions of Make defines
the recipe lines as arbitrary strings that may contain macro
expansions. They follow a rule definition line and may be
spaced apart by comment or blank lines. The list of recipe
lines defining the recipe is terminated by a new target
definition, a macro definition, or end-of-file. Each recipe
line MMUUSSTT begin with a <<TTAABB>> character which may optionally
be followed with one or all of the characters _'_@_%_+_-_'. The
_'_-_' indicates that non-zero exit values (ie. errors) are to
be ignored when this recipe line is executed, the _'_+_' indi-
cates that the current recipe line is to be executed using
the shell, the _'_%_' indicates that ddmmaakkee should swap itself
out to secondary storage (MSDOS only) before running the
recipe and the _'_@_' indicates that the recipe line should NOT
be echoed to the terminal prior to being executed. Each
switch is off by default (ie. by default, errors are signi-
ficant, commands are echoed, no swapping is done and a shell
is used only if the recipe line contains a character found
in the value of the SHELLMETAS macro). Global settings
activated via command line options or special attribute or
target names may also affect these settings. An example
recipe:
target :
first recipe line
second recipe line, executed independently of the first.
@a recipe line that is not echoed
-and one that has errors ignored
%and one that causes dmake to swap out
+and one that is executed using a shell.
The second and new format of the recipe block begins the
block with the character '[' (the open group character) in
the last non-white space position of a line, and terminates
the block with the character ']' (the close group character)
in the first non-white space position of a line. In this
form each recipe line need not have a leading TAB. This is
called a recipe group. Groups so defined are fed intact as
a single unit to a shell for execution whenever the
corresponding target needs to be updated. If the open group
character '[' is preceded by one or all of -, @ or % then
they apply to the entire group in the same way that they
apply to single recipe lines. You may also specify '+' but
it is redundant as a shell is already being used to run the
recipe. See the MAKING TARGETS section for a description of
how ddmmaakkee invokes recipes. Here is an example of a group
recipe:
Version 3.9 PL0 UW 22
DMAKE(p) Unsupported Free Software DMAKE(p)
target :
[
first recipe line
second recipe line
all of these recipe lines are fed to a
single copy of a shell for execution.
]
TTEEXXTT DDIIVVEERRSSIIOONNSS
ddmmaakkee supports the notion of text diversions. If a recipe
line contains the macro expression
$(mktmp[,[_f_i_l_e][,_t_e_x_t]] _d_a_t_a)
then all text contained in the _d_a_t_a expression is expanded
and is written to a temporary file. The return value of the
macro is the name of the temporary file.
_d_a_t_a can be any text and must be separated from the 'mktmp'
portion of the macro name by white-space. The only restric-
tion on the data text is that it must contain a balanced
number of parentheses of the same kind as are used to ini-
tiate the $(mktmp ...) expression. For example:
$(mktmp $(XXX))
is legal and works as expected, but:
$(mktmp text (to dump to file)
is not legal. You can achieve what you wish by either
defining a macro that expands to '(' or by using {} in the
macro expression; like this:
${mktmp text (to dump to file}
Since the temporary file is opened when the macro containing
the text diversion expression is expanded, diversions may be
nested and any diversions that are created as part of ':='
macro expansions persist for the duration of the ddmmaakkee run.
The diversion text may contain the same escape codes as
those described in the MACROS section. Thus if the _d_a_t_a
text is to contain new lines they must be inserted using the
\n escape sequence. For example the expression:
all:
cat $(mktmp this is a\n\
test of the text diversion\n)
is replaced by:
Version 3.9 PL0 UW 23
DMAKE(p) Unsupported Free Software DMAKE(p)
cat /tmp/mk12294AA
where the temporary file contains two lines both of which
are terminated by a new-line. If the _d_a_t_a text spans multi-
ple lines in the makefile then each line must be continued
via the use of a \. A second more illustrative example gen-
erates a response file to an MSDOS link command:
OBJ = fred.obj mary.obj joe.obj
all : $(OBJ)
link @$(mktmp $(^:t"+\n")\n)
The result of making `all' in the second example is the com-
mand:
link @/tmp/mk02394AA
where the temporary file contains:
fred.obj+
mary.obj+
joe.obj
The last line of the file is terminated by a new-line which
is inserted due to the \n found at the end of the _d_a_t_a
string.
If the optional _f_i_l_e specifier is present then its expanded
value is the name of the temporary file to create. Whenever
a $(mktmp ...) macro is expanded the macro $(TMPFILE) is set
to a new temporary file name. Thus the construct:
$(mktmp,$(TMPFILE) data)
is completely equivalent to not specifying the $(TMPFILE)
optional argument. Another example that would be useful for
MSDOS users with a Turbo-C compiler
$(mktmp,turboc.cfg $(CFLAGS))
will place the contents of CFLAGS into a local _t_u_r_b_o_c_._c_f_g
file. The second optional argument, _t_e_x_t, if present alters
the name of the value returned by the $(mktmp ...) macro.
Under MS-DOS text diversions may be a problem. Many DOS
tools require that path names which contain directories use
the \ character to delimit the directories. Some users how-
ever wish to use the '/' to delimit pathnames and use
environments that allow them to do so. The macro USESHELL
is set to "yes" if the current recipe is forced to use a
shell via the .USESHELL or '+' directives, otherwise its
value is "no". The ddmmaakkee startup files define the macro
Version 3.9 PL0 UW 24
DMAKE(p) Unsupported Free Software DMAKE(p)
DIVFILE whose value is either the value of TMPFILE or the
value of TMPFILE edited to replace any '/' characters to the
appropriate value based on the current shell and whether it
will be used to execute the recipe.
Previous versions of ddmmaakkee defined text diversions using <+,
+> strings, where <+ started a text diversion and +> ter-
minated one. ddmmaakkee is backward compatible with this con-
struct only if the <+ and +> appear literally on the same
recipe line or in the same macro value string. In such
instances the expression:
<+data+>
is mapped to:
$(mktmp data)
which is fully output compatible with the earlier construct.
<+, +> constructs whose text spans multiple lines must be
converted by hand to use $(mktmp ...).
If the environment variable TMPDIR is defined then the tem-
porary file is placed into the directory specified by that
variable. A makefile can modify the location of temporary
files by defining a macro named TMPDIR and exporting it
using the .EXPORT special target.
SSPPEECCIIAALL TTAARRGGEETTSS
This section describes the special targets that are recog-
nized by ddmmaakkee. Some are affected by attributes and others
are not.
..EERRRROORR If defined then the recipe associated with
this target is executed whenever an error con-
dition is detected by ddmmaakkee. All attributes
that can be used with any other target may be
used with this target. Any prerequisites of
this target will be brought up to date during
its processing. NOTE: errors will be ignored
while making this target, in extreme cases
this may cause some problems.
..EEXXIITT If this target is encountered while parsing a
makefile then the parsing of the makefile is
immediately terminated at that point.
..EEXXPPOORRTT All prerequisites associated with this target
are assumed to correspond to macro names and
they and their values are exported to the
environment as environment strings at the
point in the makefile at which this target
Version 3.9 PL0 UW 25
DMAKE(p) Unsupported Free Software DMAKE(p)
appears. Any attributes specified with this
target are ignored. Only macros which have
been assigned a value in the makefile prior to
the export directive are exported, macros as
yet undefined or macros whose value contains
any of the characters "+=:*" are not exported.
is suppre
..IIMMPPOORRTT Prerequisite names specified for this target
are searched for in the environment and
defined as macros with their value taken from
the environment. If the special name ..EEVVEERRYY----
TTHHIINNGG is used as a prerequisite name then all
environment variables defined in the environ-
ment are imported. The functionality of the
-
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -