📄 wmake.gml
字号:
$(CC) $(CFLAGS) $*&sysper.c
&sysper.c.obj:
$(CC) $(CFLAGS) /c $*&sysper.c
&sysper.cpp.exe:
$(CPP) $(CPPFLAGS) $*&sysper.cpp
&sysper.cpp.obj:
$(CPP) $(CPPFLAGS) /c $*&sysper.cpp
&sysper.cxx.exe:
$(CXX) $(CXXFLAGS) $*&sysper.cxx
&sysper.cxx.obj:
$(CXX) $(CXXFLAGS) $*&sysper.cxx
&sysper.bas.obj:
$(BC) $(BFLAGS) $*&sysper.bas
&sysper.cbl.exe:
$(COBOL) $(COBFLAGS) $*&sysper.cbl, $*.exe;
&sysper.cbl.obj:
$(COBOL) $(COBFLAGS) $*&sysper.cbl;
&sysper.f.exe:
$(FOR) $(FFLAGS) $*&sysper.f
&sysper.f.obj:
$(FOR) /c $(FFLAGS) $*&sysper.f
&sysper.f90.exe:
$(FOR) $(FFLAGS) $*&sysper.f90
&sysper.f90.obj:
$(FOR) /c $(FFLAGS) $*&sysper.f90
&sysper.for.exe:
$(FOR) $(FFLAGS) $*&sysper.for
&sysper.for.obj:
$(FOR) /c $(FFLAGS) $*&sysper.for
&sysper.pas.exe:
$(PASCAL) $(PFLAGS) $*&sysper.pas
&sysper.pas.obj:
$(PASCAL) /c $(PFLAGS) $*&sysper.pas
&sysper.rc.res:
$(RC) $(RFLAGS) /r $*
.millust end
.pc
For OS/2, the
.id __MSDOS__
macro will be replaced by
.id __OS2__
and for Windows NT, the
.id __MSDOS__
macro will be replaced by
.id __NT__.
.np
For UNIX make compatibility (when you use the "u" option), the
following default definition is established.
.millust begin
&sysper.EXTENSIONS: .exe .obj .c .y .l .f
%MAKEFLAGS=$(%MAKEFLAGS) $(__MAKEOPTS__)
MAKE=<name of file containing &makcmdup>
YACC=yacc
YFLAGS=
LEX=lex
LFLAGS=
LDFLAGS=
CC=cl
FC=fl
&sysper.asm.exe:
$(AS) $(AFLAGS) $*&sysper.asm
&sysper.c.exe:
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
&sysper.f.exe:
$(FC) $(FFLAGS) $(LDFLAGS) -o $@ $<
&sysper.c.obj:
$(CC) $(CFLAGS) -c $<
&sysper.f.obj:
$(FC) $(FFLAGS) -c $<
&sysper.y.obj:
$(YACC) $(YFLAGS) $<
$(CC) $(CFLAGS) -c y.tab.c
del y.tab.c
move y.tab.obj $@
&sysper.l.obj:
$(LEX) $(LFLAGS) $<
$(CC) $(CFLAGS) -c lex.yy.c
del lex.yy.c
move lex.yy.obj $@
&sysper.y.c:
$(YACC) $(YFLAGS) $<
move y.tab.c $@
&sysper.l.c:
$(LEX) $(LFLAGS) $<
move lex.yy.c $@
.millust end
The "r" option will disable these definitions before processing any
makefiles.
:OPT name='s'
.ix '&makcmdup options' 's'
silent mode - do not print commands before execution
.np
The "s" option is equivalent to the
.id &sysper.SILENT
directive.
:OPT name='sn'
.ix '&makcmdup options' 'sn'
noisy mode - always print commands before execution
.np
The "sn" option overrules all silencing controls.
It can be used to assist in debugging a makefile.
:OPT name='t'
.ix '&makcmdup options' 't'
touch files instead of executing commands
.np
.ix '&makcmdup' 'touch'
.ix 'touch'
.ix '&tchcmdup'
Sometimes there are changes which are purely cosmetic (adding a
comment to a source file) that will cause targets to be updated
needlessly thus wasting computer resources.
The "t" option will make files appear younger without altering their
contents.
The "t" option is useful but should be used with caution.
:OPT name='u'
.ix '&makcmdup options' 'u'
.ix '&makcmdup' 'UNIX compatibility mode'
.ix 'UNIX compatibility mode in &maksname'
UNIX compatibility mode
.np
The "u" option will indicate to &maksname that the line continuation
character should be a backslash "\" rather than an ampersand "&".
:OPT name='v'
.ix '&makcmdup options' 'v'
The "v" option enables a verbose listing of inline temporary files.
:OPT name='y'
.ix '&makcmdup options' 'y'
The "y" option enables the display of a progress line denoting which
dependent file has caused a target to be updated. This is a useful
option for helping to debug makefiles.
:OPT name='z'
.ix '&makcmdup options' 'z'
.ix '&makcmdup' 'target deletion prompt'
.ix 'target deletion prompt'
.ix '&makcmdup directives' '.HOLD'
.ix 'HOLD' '&makcmdup directive'
do not erase target after error/interrupt (disables prompting)
.np
The "z" option will indicate to &maksname that if an error or interrupt
occurs during makefile processing then the current target being made
should not be deleted.
The
.id &sysper.HOLD
directive in a makefile has the same effect as the "z" option.
:eOPTLIST.
.*
.section Special Macros
.*
.np
.ix '&makcmdup' 'special macros'
&makname has many different special macros.
Here are some of the simpler ones.
.begpoint $compact $break
:DTHD.Macro
:DDHD.Expansion
.point $$
.ix '&makcmdup special macros' '$$'
represents the character "$"
.point $#
.ix '&makcmdup special macros' '$#'
represents the character "#"
.point $@
.ix '&makcmdup special macros' '$@'
full file name of the target
.point $*
.ix '&makcmdup special macros' '$*'
target with the extension removed
.point $<
.ix '&makcmdup special macros' '$<'
list of all dependents
.point $?
.ix '&makcmdup special macros' '$?'
list of dependents that are younger than the target
.endpoint
.pc
The following macros are for more sophisticated makefiles.
.begpoint $break $setptnt 14
:DTHD.Macro
:DDHD.Expansion
.point __MSDOS__
This macro is defined in the MS/DOS environment.
.point __NT__
This macro is defined in the Windows NT environment.
.point __OS2__
This macro is defined in the OS/2 environment.
.point __LINUX__
This macro is defined in the Linux environment.
.point __QNX__
This macro is defined in the QNX environment.
.point __UNIX__
This macro is defined in the Linux or QNX environment.
.point __MAKEOPTS__
contains all of the command line options that &makcmdup was invoked
with except for any use of the "f" or "n" options.
.point __MAKEFILES__
contains the names of all of the makefiles processed at the time of
expansion (includes the file currently being processed)
.point MAKE
contains the full name of the file that contains &makcmdup.
.point __VERSION__
contains the wmake version.
.endpoint
.pc
The next three tables contain macros that are valid during execution
of command lists for explicit rules, implicit rules, and the
.id &sysper.ERROR
directive.
The expansion is presented for the following example:
.exam begin
a:\dir\target.ext : b:\dir1\dep1.ex1 c:\dir2\dep2.ex2
.exam end
.begpoint $compact $break
:DTHD.Macro
:DDHD.Expansion
.point $^@
.ix '&makcmdup special macros' '$^ form'
.ix '&makcmdup special macros' '$^@'
a:\dir\target.ext
.point $^*
.ix '&makcmdup special macros' '$^*'
a:\dir\target
.point $^&
.ix '&makcmdup special macros' '$^&'
target
.point $^.
.ix '&makcmdup special macros' '$^.'
target.ext
.point $^:
.ix '&makcmdup special macros' '$^:'
a:\dir\
.endpoint
.begpoint $compact $break
:DTHD.Macro
:DDHD.Expansion
.point $[@
.ix '&makcmdup special macros' '$[ form'
.ix '&makcmdup special macros' '$[@'
b:\dir1\dep1.ex1
.point $[*
.ix '&makcmdup special macros' '$[*'
b:\dir1\dep1
.point $[&
.ix '&makcmdup special macros' '$[&'
dep1
.point $[.
.ix '&makcmdup special macros' '$[.'
dep1.ex1
.point $[:
.ix '&makcmdup special macros' '$[:'
b:\dir1\
.endpoint
.begpoint $compact $break
:DTHD.Macro
:DDHD.Expansion
.point $]@
.ix '&makcmdup special macros' '$] form'
.ix '&makcmdup special macros' '$]@'
c:\dir2\dep2.ex2
.point $]*
.ix '&makcmdup special macros' '$]*'
c:\dir2\dep2
.point $]&
.ix '&makcmdup special macros' '$]&'
dep2
.point $].
.ix '&makcmdup special macros' '$].'
dep2.ex2
.point $]:
.ix '&makcmdup special macros' '$]:'
c:\dir2\
.endpoint
.*
.endlevel
.*
.section Dependency Declarations
.*
.np
.ix '&makcmdup' 'dependency'
.ix 'dependency'
In order for &makname to be effective, a list of file dependencies
must be declared.
.ix '&makcmdup' 'declarations'
.ix 'declarations'
.ix '&makcmdup' 'MAKEFILE'
.ix 'MAKEFILE'
The declarations may be entered into a text file of any name but
&maksname will read a file called "MAKEFILE" by default if it is
invoked as follows:
.ix 'invoking &makname'
.ix '&makcmdup command line' 'invoking &makcmdup'
.exam begin
C>&makcmd
.exam end
.pc
.ix '&makcmdup options' 'f'
If you want to use a file that is not called "MAKEFILE" then the
command line option "f" will cause &maksname to read the specified file
instead of the default "MAKEFILE".
.ix 'invoking &makname'
.ix '&makcmdup command line' 'invoking &makcmdup'
.exam begin
C>&makcmd /f myfile
.exam end
.np
We will now go through an example to illustrate how &maksname may be
used for a simple application.
Suppose we have an input file, a report file, and a report generator
program then we may declare a dependency as follows:
.ix '&makcmdup' 'MAKEFILE comments'
.ix 'MAKEFILE comments'
.millust begin
#
# (a comment in a makefile starts with a "#")
# simple dependency declaration
#
balance.lst : ledger.dat
doreport
.millust end
.pc
Note that the dependency declaration starts at the beginning of a line
while commands always have at least one blank or tab before them.
.ix '&makcmdup' 'single colon explicit rule'
.ix 'single colon explicit rule'
.ix '&makcmdup' '":" explicit rule'
.ix 'colon (:)' 'explicit rule in &makcmdup'
.ix '&makcmdup' 'explicit rule'
.ix 'explicit rule'
This form of a dependency declaration is called an
.us explicit rule.
.ix '&makcmdup' 'target'
.ix 'target'
The file "BALANCE.LST" is called the
.us target
of the rule.
.ix '&makcmdup' 'rule command list'
.ix 'rule command list'
.ix '&makcmdup' 'dependent'
.ix 'dependent'
The
.us dependent
of the rule is the file "LEDGER.DAT" while "DOREPORT" forms one line
of the
.us rule command list.
The dependent is separated from the target by a colon.
.hint
A good habit to develop is to always put spaces around the colon so
that it will not be confused with drive specifications (e.g., a:).
.ehint
.np
The explicit rule declaration indicates to &maksname that the program
"DOREPORT" should be executed if "LEDGER.DAT" is younger than
"BALANCE.LST" or if "BALANCE.LST" does not yet exist.
In general, if the dependent file has a more recent modification date
and time than the target file then &makname will execute the
specified command.
.ix '&makcmdup' 'dependent'
.ix 'dependent'
.ix '&makcmdup' 'Feldman, S.I.'
.ix 'Feldman, S.I.'
.ix '&makcmdup' 'Bell Laboratories'
.ix 'Bell Laboratories'
.ix '&makcmdup' 'UNIX'
.ix 'UNIX'
.remark
The terminology employed here is used by S.I.Feldman of Bell
Laboratories in
.us Make - A Program for Maintaining Computer Programs.
http://www.softlab.ntua.gr/facilities/documentation/unix/docs/make.txt
has a copy of this seminal article.
Confusion often arises from the use of the word "dependent".
In this context, it means "a subordinate part".
In the example, "LEDGER.DAT" is a subordinate part of the report
"BALANCE.LST".
.eremark
.*
.section Multiple Dependents
.*
.np
Suppose that our report "BALANCE.LST" becomes out-of-date if any of
the files "LEDGER.DAT", "SALES.DAT" or "PURCHASE.DAT" are modified.
We may modify the dependency rule as follows:
.millust begin
#
# multiple dependents rule
#
balance.lst : ledger.dat sales.dat purchase.dat
doreport
.millust end
.pc
.ix '&makcmdup' 'multiple dependents'
.ix 'multiple dependents'
This is an example of a rule with multiple dependents.
In this situation, the program "DOREPORT" should be executed if any of
"LEDGER.DAT", "SALES.DAT" or "PURCHASE.DAT" are younger than
"BALANCE.LST" or if "BALANCE.LST" does not yet exist.
In cases where there are multiple dependents,
if any of the dependent files has a more recent modification date and
time than the target file then &makname will execute the specified
command.
.*
.section Multiple Targets
.*
.np
Suppose that the "DOREPORT" program produces two reports.
If both of these reports require updating as a result of modification
to the dependent files, we could change the rule as follows:
.millust begin
#
# multiple targets and multiple dependents rule
#
balance.lst summary.lst : ledger.dat sales.dat purchase.dat
doreport
.millust end
.pc
.ix '&makcmdup' 'multiple targets'
.ix 'multiple targets'
Suppose that you entered the command:
.millust begin
&makcmd
.millust end
.pc
which causes &maksname to start processing the rules described in
"MAKEFILE".
In the case where multiple targets are listed in the makefile,
&maksname will, by default, process only the first target it
encounters.
In the example, Make will check the date and time of "BALANCE.LST"
against its dependents since this is the first target listed.
.np
To indicate that some other target should be processed, the target is
specified as an argument to the Make command.
.exam begin
&makcmd summary.lst
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -