📄 wmake.gml
字号:
@echo updating first target
next : .symbolic
@echo updating next target
.millust end
.pc
In the above example, &maksname will not automatically update "target",
despite the fact that it is the first one listed.
.*
.section *refid=extensions Defining Recognized File Extensions (.EXTENSIONS)
.*
.ix '&makcmdup directives' '.EXTENSIONS'
.ix 'EXTENSIONS' '&makcmdup directive'
The
.id &sysper.EXTENSIONS
directive and its synonym, the
.id &sysper.SUFFIXES
directive declare which extensions are allowed to be used in implicit
rules and how these extensions are ordered.
.id &sysper.EXTENSIONS
is the traditional Watcom name;
.id &sysper.SUFFIXES
is the corresponding POSIX name.
The default
.id &sysper.EXTENSIONS
declaration is:
.code begin
&sysper.EXTENSIONS:
&sysper.EXTENSIONS: .exe .nlm .dsk .lan .exp .lib .obj &
.i .asm .c .cpp .cxx .cc .for .pas .cob &
.h .hpp .hxx .hh .fi .mif .inc
.code end
.pc
A
.id &sysper.EXTENSIONS
directive with an empty list will clear the
.id &sysper.EXTENSIONS
list and any previously defined implicit rules.
Any subsequent
.id &sysper.EXTENSIONS
directives will add extensions to the end of the list.
.hint
The default
.id &sysper.EXTENSIONS
declaration could have been coded as:
.np
:cmt. .millust
&sysper.EXTENSIONS:
.br
&sysper.EXTENSIONS: .exe
.br
&sysper.EXTENSIONS: .nlm .dsk .lan .exp
.br
&sysper.EXTENSIONS: .lib
.br
&sysper.EXTENSIONS: .obj
.br
&sysper.EXTENSIONS: .i .asm .c .cpp .cxx .cc
.br
&sysper.EXTENSIONS: .for .pas .cob
.br
&sysper.EXTENSIONS: .h .hpp .hxx .hh .fi .mif .inc
.br
&sysper.EXTENSIONS: .inc
:cmt. .emillust
.np
with identical results.
.ehint
.pc
&maksname will not allow any implicit rule declarations that use
extensions that are not in the current
.id &sysper.EXTENSIONS
list.
.millust begin
#
# .extensions and .suffixes directives
#
&sysper.suffixes : # Clear list
&sysper.extensions : .foo .bar
&sysper.bar.foo:
copy $< $@
fubar.foo:
fubar.bar: .existsonly
wtouch $@
.millust end
.pc
The first time this example runs, &maksname creates fubar.foo.
This example always ensures that fubar.foo is a copy of fubar.bar.
Note the implicit connection beween the two files.
.*
.section Approximate Timestamp Matching (.FUZZY)
.*
.ix '&makcmdup directives' '.FUZZY'
.ix 'FUZZY' '&makcmdup directive'
The
.id &sysper.FUZZY
directive allows
.ix '&makcmdup directives' '.AUTODEPEND'
.ix 'AUTODEPEND' '&makcmdup directive'
.id &sysper.AUTODEPEND
times to be out by a minute without considering a target out of date.
It is only useful in conjunction with the
.ix '&makcmdup directives' '.JUST_ENOUGH'
.ix 'JUST_ENOUGH' '&makcmdup directive'
.id &sysper.JUST_ENOUGH
directive when &maksname is calculating the timestamp to set the target to.
.*
.section Preserving Targets After Error (.HOLD)
.*
.np
.ix '&makcmdup directives' '.HOLD'
.ix 'HOLD' '&makcmdup directive'
.ix '&makcmdup' 'return codes'
.ix 'return codes'
Most operating system utilities and programs have special return codes
that indicate error conditions.
&makname will check the return code for every command executed.
If the return code is non-zero, &maksname will stop processing the
current rule and optionally delete the current target being updated.
By default, &maksname will prompt for deletion of the current target.
The
.id &sysper.HOLD
directive indicates to &maksname that the target should not be deleted
if an error occurs during the execution of the associated command
list.
No prompt is issued in this case.
.ix '&makcmdup directives' '.PRECIOUS'
.ix 'PRECIOUS' '&makcmdup directive'
The
.id &sysper.HOLD
directive is similar to
.id &sysper.PRECIOUS
but applies to all targets listed in the makefile.
Here is an example of the
.id &sysper.HOLD
directive:
.millust begin
#
# .HOLD example
#
&sysper.HOLD
balance.lst : ledger.dat sales.dat purchase.dat
doreport
.millust end
.pc
If the program "DOREPORT" executes and its return code is non-zero
then &maksname will not delete "BALANCE.LST".
.*
.section Ignoring Return Codes (.IGNORE)
.*
.np
.ix '&makcmdup directives' '.IGNORE'
.ix '&makcmdup command prefix' '-'
.ix 'IGNORE' '&makcmdup directive'
.ix '&makcmdup' 'ignoring return codes'
.ix 'ignoring return codes'
Some programs do not have meaningful return codes so for these
programs we want to ignore the return code completely.
There are different ways to ignore return codes namely,
.autopoint
.point
.ix '&makcmdup options' 'i'
use the command line option "i"
.point
put a "&minus" in front of specific commands, or
.point
use the
.id &sysper.IGNORE
directive.
.endpoint
.np
In the following example, the rule:
.millust begin
#
# ignore return code example
#
balance.lst : ledger.dat sales.dat purchase.dat
-doreport
.millust end
.pc
will ignore the return status from the program "DOREPORT".
Using the dash in front of the command is the preferred method for
ignoring return codes because it allows &maksname to check all the
other return codes.
.np
The
.id &sysper.IGNORE
directive is used as follows:
.millust begin
#
# .IGNORE example
#
&sysper.IGNORE
balance.lst : ledger.dat sales.dat purchase.dat
doreport
.millust end
.pc
Using the
.id &sysper.IGNORE
directive will cause &maksname to ignore the return code for every
command.
The "i" command line option and the
.id &sysper.IGNORE
directive prohibit &maksname from performing any error checking on the
commands executed and, as such, should be used with caution.
.np
Another way to handle non-zero return codes is to continue processing
targets which do not depend on the target that had a non-zero return
code during execution of its associated command list.
There are two ways of indicating to &maksname that processing should
continue after a non-zero return code:
.autopoint
.point
use the command line option "k"
.point
use the
.id &sysper.CONTINUE
directive.
.endpoint
.*
.section Minimising Target Timestamp (.JUST_ENOUGH)
.*
.ix '&makcmdup directives' '.JUST_ENOUGH'
.ix 'JUST_ENOUGH' '&makcmdup directive'
The
.id &sysper.JUST_ENOUGH
directive is equivalent to the "j" command line option.
The timestamps of created targets are set to be the same as those of their
youngest dependendents.
.millust begin
#
# .JUST_ENOUGH example
#
&sysper.just_enough
&sysper.c.exe:
wcl386 -zq $<
hello.exe:
.millust end
.pc
hello.exe is given the same timestamp as hello.c, and not the usual timestamp
corresponding to when hello.exe was built.
.*
.section Updating Targets Multiple Times (.MULTIPLE)
.*
.ix '&makcmdup directives' '.MULTIPLE'
.ix 'MULTIPLE' '&makcmdup directive'
The
.id &sysper.MULTIPLE
directive is used to update a target multiple times. Normally, &maksname
will only update each target once while processing a makefile. The
.id &sysper.MULTIPLE
directive is useful if a target needs to be updated more than once, for
instance in case the target is destroyed during processing of other targets.
Consider the following example:
.millust begin
#
# example not using .multiple
#
all: targ1 targ2
target:
wtouch target
targ1: target
rm target
wtouch targ1
targ2: target
rm target
wtouch targ2
.millust end
.pc
This makefile will fail because "target" is destroyed when updating "targ1",
and later is implicitly expected to exist when updating "targ2". Using the
.id &sysper.MULTIPLE
directive will work around this problem:
.millust begin
#
# .MULTIPLE example
#
all : targ1 targ2
target : .multiple
wtouch target
targ1 : target
rm target
wtouch targ1
targ2 : target
rm target
wtouch targ2
.millust end
.pc
Now &maksname will attempt to update "target" again when updating "targ2",
discover that "target" doesn't exist, and recreate it.
.*
.section Ignoring Target Timestamp (.NOCHECK)
.*
.ix '&makcmdup directives' '.NOCHECK'
.ix 'NOCHECK' '&makcmdup directive'
The
.id &sysper.NOCHECK
directive is used to disable target existence checks in a makefile.
See the section entitled
:HDREF refid='clo'.
for a full description of its use.
.*
.section Cache Search Path (.OPTIMIZE)
.*
.ix '&makcmdup directives' '.OPTIMIZE'
.ix 'OPTIMIZE' '&makcmdup directive'
The
.id &sysper.OPTIMIZE
directive and the equivalent "o" command line option cause &maksname
to use a circular path search.
If a file is found in a particular directory, that directory will be
the first searched for the next file.
See the section entitled
:HDREF refid='clo'.
for a full description of its use.
.*
.section Preserving Targets (.PRECIOUS)
.*
.np
.ix '&makcmdup directives' '.PRECIOUS'
.ix 'PRECIOUS' '&makcmdup directive'
.ix '&makcmdup' 'return codes'
.ix 'return codes'
Most operating system utilities and programs have special return codes
that indicate error conditions.
&makname will check the return code for every command executed.
If the return code is non-zero, &maksname will stop processing the
current rule and optionally delete the current target being updated.
If a file is precious enough that this treatment of return codes is
not wanted then the
.id &sysper.PRECIOUS
directive may be used.
The
.id &sysper.PRECIOUS
directive indicates to &maksname that the target should not be deleted
if an error occurs during the execution of the associated command
list.
Here is an example of the
.id &sysper.PRECIOUS
directive:
.code begin
#
# .PRECIOUS example
#
balance summary : sales.dat purchase.dat .PRECIOUS
doreport
.code end
.pc
If the program "DOREPORT" executes and its return code is non-zero
then &maksname will not attempt to delete "BALANCE" or "SUMMARY".
If only one of the files is precious then the makefile could be coded
as follows:
.millust begin
#
# .PRECIOUS example
#
balance : .PRECIOUS
balance summary : sales.dat purchase.dat
doreport
.millust end
.pc
The file "BALANCE.LST" will not be deleted if an error occurs while
the program "DOREPORT" is executing.
.*
.section Name Command Sequence (.PROCEDURE)
.*
.ix '&makcmdup directives' '.PROCEDURE'
.ix 'PROCEDURE' '&makcmdup directive'
The
.id &sysper.PROCEDURE
directive may be used to construct "procedures" in a makefile.
.millust begin
#
# .procedure example
#
all: .symbolic
@%make proc
proc: .procedure
@echo Executing procedure "proc"
.millust end
.*
.section Re-Checking Target Timestamp (.RECHECK)
.*
.ix '&makcmdup directives' '.RECHECK'
.ix 'RECHECK' '&makcmdup directive'
Make will re-check the target's timestamp, rather than assuming it was updated
by its command list. This is useful if the target is built by another make-
style tool, as in the following example:
.millust begin
#
# .RECHECK example
#
foo.gz : foo
gzip foo
foo : .ALWAYS .RECHECK
nant -buildfile:foo.build
.millust end
.pc
foo's command list will always be run, but foo will only be compressed if the
timestamp is actually changed.
.*
.section Suppressing Terminal Output (.SILENT)
.*
.np
.ix '&makcmdup directives' '.SILENT'
.ix '&makcmdup command prefix' '@'
.ix 'SILENT' '&makcmdup directive'
As commands are executed, &makname will print out the current command
before it is executed.
.ix '&makcmdup' 'suppressing output'
.ix 'suppressing output'
It is possible to execute the makefile without having the commands
printed.
There are three ways to inhibit the printing of the commands before
they are executed, namely:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -