home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-07-26 | 38.6 KB | 1,113 lines |
- Newsgroups: comp.sources.misc
- subject: v14i022: dmake version 3.5 part 12/21
- From: dvadura@watdragon.waterloo.edu (Dennis Vadura)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 14, Issue 22
- Submitted-by: dvadura@watdragon.waterloo.edu (Dennis Vadura)
- Archive-name: dmake/part12
-
- #!/bin/sh
- # this is part 12 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file man/dmake.p continued
- #
- CurArch=12
- if test ! -r s2_seq_.tmp
- then echo "Please unpack part 1 first!"
- exit 1; fi
- ( read Scheck
- if test "$Scheck" != $CurArch
- then echo "Please unpack part $Scheck next!"
- exit 1;
- else exit 0; fi
- ) < s2_seq_.tmp || exit 1
- echo "x - Continuing file man/dmake.p"
- sed 's/^X//' << 'SHAR_EOF' >> man/dmake.p
- X will be needed to help handle the smaller differences in the
- X two environments.
- X
- X NOTE: Unlike UNIX, MSDOS ddooeess maintain cd requests cross
- X single recipe lines. This is not portable, and your
- X makefiles will not work the same way if you depend on it.
- X Use the .IF ... .ELSE ... .END conditionals to supply dif-
- X ferent make scripts as necessary.
- X
- XFFIILLEESS
- X Makefile, makefile, startup.mk (use dmake -V to tell you
- X where the startup file is)
- X
- XSSEEEE AALLSSOO
- X sh(1), csh(1), touch(1), f77(1), pc(1), cc(1)
- X 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_-
- X _g_r_a_m_s
- X
- XAAUUTTHHOORR
- X Dennis Vadura, CS Dept. University of Waterloo.
- X dvadura@watdragon.uwaterloo.ca
- X Many thanks to Carl Seger for his helpful suggestions, and
- X to Trevor John Thompson for his many excellent ideas and
- X
- X
- X
- XVersion 3.50 UW 40
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X informative bug reports.
- X
- XBBUUGGSS
- X Some system commands return non-zero status inappropriately.
- X Use --ii (`-' within the makefile) to overcome the difficulty.
- X
- X Some systems do not have easily accessible time stamps for
- X library members (MSDOS, AMIGA, etc) for these ddmmaakkee uses the
- X time stamp of the library instead and prints a warning the
- X first time it does so. This is almost always ok, except
- X when multiple makefiles update a single library file. In
- X these instances it is possible to miss an update if one is
- X not careful.
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- XVersion 3.50 UW 41
- SHAR_EOF
- echo "File man/dmake.p is complete"
- chmod 0640 man/dmake.p || echo "restore of man/dmake.p fails"
- echo "x - extracting man/dmake.nc (Text)"
- sed 's/^X//' << 'SHAR_EOF' > man/dmake.nc &&
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- XNAME
- X dmake - maintain program groups, or interdependent files
- X
- XSYNOPSIS
- X dmake [-AeEhiknpqersStTuvVx] [-P#] [macro[+][:]=value] [-f
- X file] [target ...]
- X
- XDESCRIPTION
- X dmake executes commands found in an external file called a
- X makefile to update one or more target names. Each target
- X may depend on zero or more prerequisite targets. If any of
- X the target's prerequisites is newer than the target or if
- X the target itself does not exist, then dmake will attempt to
- X make the target.
- X
- X If no -f command line option is present then dmake searches
- X for an existing makefile from the list of prerequisites
- X specified for the special target .MAKEFILES (see the STARTUP
- X section for more details). If "-" is the name of the file
- X specified to the -f flag then dmake uses standard input as
- X the source of the makefile text.
- X
- X Any macro definitions (arguments with embedded "=" signs)
- X that appear on the command line are processed first and
- X supersede definitions for macros of the same name found
- X within the makefile. It is impossible for definitions found
- X inside the makefile to redefine any macro defined on the
- X command line.
- X
- X If no target names are specified on the command line, then
- X dmake uses the first non-special target found in the
- X makefile as the default target. See the SPECIAL TARGETS
- X section for the list of special targets and their function.
- X dmake is a re-implementation of the UNIX Make utility with
- X significant enhancements. Makefiles written for most previ-
- X ous versions of make will be handled correctly by dmake.
- X Known differences between dmake and other versions of make
- X are discussed in the COMPATIBILITY section found at the end
- X of this document.
- X
- XOPTIONS
- X -A Enable AUGMAKE special inference rule transformations
- X (see the "PERCENT(%) RULES" section), these are set to
- X off by default.
- X
- X -e Read the environment and define all strings of the form
- X 'ENV-VAR=evalue' defined within as macros whose name is
- X ENV-VAR, and whose value is 'evalue'. The environment
- X is processed prior to processing the user specified
- X makefile thereby allowing definitions in the makefile
- X to override definitions in the environment.
- X
- X
- X
- X
- XVersion 3.50 UW 1
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X -E Same as -e, except that the environment is processed
- X after the user specified makefile has been processed
- X (thus definitions in the environment override defini-
- X tions in the makefile). The -e and -E options are
- X mutually exclusive. If both are given the latter one
- X takes effect.
- X
- X -f file
- X Use file as the source for the makefile text. Only one
- X -f option is allowed.
- X
- X -h Print the command summary for dmake.
- X
- X -i Tells dmake to ignore errors, and continue making other
- X targets. This is equivalent to the .IGNORE attribute
- X or macro.
- X
- X -k Causes dmake to ignore errors caused by command execu-
- X tion and to make all targets not depending on targets
- X that could not be made. Ordinarily dmake stops after a
- X command returns a non-zero status, specifying -k causes
- X dmake to ignore the error and continue to make as much
- X as possible.
- X
- X -n Causes dmake to print out what it would have executed,
- X but does not actually execute the commands. A special
- X check is made for the string "$(MAKE)" inside a recipe
- X line, if found, the line is expanded and invoked,
- X thereby enabling recursive makes to give a full
- X description of all that they will do. The check for
- X "$(MAKE)" is disabled inside group recipes.
- X
- X -p Print out a version of the digested makefile in human
- X readable form. (useful for debugging, but cannot be
- X re-read by dmake)
- X
- X -P# On systems that support multi-processing cause dmake to
- X use # concurrent child processes to make targets. See
- X the "MULTI PROCESSING" section for more information.
- X
- X -q Check and see if the target is up to date. Exits with
- X code 0 if up to date, 1 otherwise.
- X
- X -r Tells dmake not to read the initial startup makefile,
- X see STARTUP section for more details.
- X
- X -s Tells dmake to do all its work silently and not echo
- X the commands it is executing to stdout (also suppresses
- X warnings). This is equivalent to the .SILENT attri-
- X bute or macro.
- X
- X
- X
- X
- X
- XVersion 3.50 UW 2
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X -S Force sequential execution of recipes on architectures
- X which support concurrent makes. For backward compati-
- X bility with old makefiles that have nasty side-effect
- X prerequisite dependencies.
- X
- X -t Causes dmake to touch the targets and bring them up to
- X date without executing any commands.
- X
- X -T Tells dmake to not perform transitive closure on the
- X inference graph.
- X
- X -u Force an unconditional update. (ie. do everything that
- X would be done if everything that a target depended on
- X was out of date)
- X
- X -v Verbose flag, when making targets print to stdout what
- X we are going to make and what we think it's timestamp
- X is.
- X
- X -V Print the version of dmake, and values of builtin mac-
- X ros.
- X
- X -x Upon processing the user makefile export all non-
- X internally defined macros to the user's environment.
- X This option together with the -e option allows SYSV
- X AUGMAKE recursive makes to function as expected.
- X
- XINDEX
- X Here is a list of the sections that follow and a short
- X description of each. Perhaps you won't have to read the
- X whole man page to find what you need.
- X
- X STARTUP Describes dmake initialization.
- X
- X SYNTAX Describes the syntax of makefile expres-
- X sions.
- X
- X ATTRIBUTES Describes the notion of attributes and
- X how they are used when making targets.
- X
- X MACROS Defining and expanding macros.
- X
- X RULES AND TARGETS How to define targets and their prere-
- X quisites.
- X
- X RECIPES How to tell dmake how to make a target.
- X
- X TEXT DIVERSIONS How to use text diversions for long argu-
- X ment lists in recipes.
- X
- X SPECIAL TARGETS Some targets are special.
- X
- X
- X
- X
- XVersion 3.50 UW 3
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X SPECIAL MACROS Macros used by dmake to alter the pro-
- X cessing of the makefile, and those
- X defined by dmake for the user.
- X
- X DYNAMIC PREREQUISITES
- X Processing of prerequisites which contain
- X macro expansions in their name.
- X
- X BINDING TARGETS The rules that dmake uses to bind a tar-
- X get to an existing file in the file sys-
- X tem.
- X
- X PERCENT(%) RULES Specification of recipes to be used by
- X the inference algorithm.
- X
- X MAKING INFERENCES The rules that dmake uses when inferring
- X how to make a target which had no expli-
- X cit recipe. This and the previous sec-
- X tion are really a single section in the
- X text below.
- X
- X MAKING TARGETS How dmake makes targets other than
- X libraries.
- X
- X MAKING LIBRARIES How dmake makes libraries.
- X
- X MULTI PROCESSING Discussion of dmake's parallel make
- X facilities for architectures that support
- X them.
- X
- X CONDITIONALS Conditional expressions which control the
- X processing of the makefile.
- X
- X EXAMPLES Some hopefully useful examples.
- X
- X COMPATIBILITY How dmake compares with previous versions
- X of make.
- X
- X LIMITS Limitations of dmake.
- X
- X PORTABILITY Comments on writing portable makefiles.
- X
- X FILES Files used by dmake.
- X
- X SEE ALSO Other related programs, and man pages.
- X
- X AUTHOR The guy responsible for this thing.
- X
- X BUGS Hope not.
- X
- X
- X
- X
- X
- X
- XVersion 3.50 UW 4
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- XSTARTUP
- X When dmake begins execution it first processes the command
- X line and then it processes an initial startup-makefile.
- X This is followed by an attempt to locate and process a user
- X supplied makefile. The startup file defines the default
- X values of all required control macros and the set of default
- X rules for making inferences. When searching for the startup
- X makefile, dmake searches the following locations, in order,
- X until a startup file is located:
- X
- X 1. The location given as the value of the macro MAK-
- X ESTARTUP defined on the command line.
- X
- X 2. The location given as the value of the environment
- X variable MAKESTARTUP defined in the current
- X environment.
- X
- X 3. The location given as the value of the macro MAK-
- X ESTARTUP defined internally within dmake.
- X
- X The above search is disabled by specifying the -r option on
- X the command line. An error is issued if a startup makefile
- X cannot be found and the -r option was not specified. A user
- X may substitute a custom startup file by defining the MAKES-
- X TARTUP environment variable or by redefining the MAKESTARTUP
- X macro on the command line. To find out where dmake looks
- X for the default startup file, check your environment or
- X issue the command "dmake -V" to determine the builtin value
- X of MAKESTARTUP.
- X
- X A similar search is performed to locate a default user
- X makefile when no -f command line option is specified. The
- X special target .MAKEFILES is internally defined by default.
- X This target's prerequisite list specifies the names of files
- X and the order that dmake will use to search for them when
- X attempting to locate the default makefile. A typical defin-
- X ition for this target is:
- X
- X .MAKEFILES : makefile.mk Makefile makefile
- X
- X dmake will first look for makefile.mk and then the others.
- X If a prerequisite cannot be found dmake will try to make it
- X before going on to the next prerequisite. For example,
- X makefile.mk can be checked out of an RCS file if the proper
- X rules for doing so are defined in the startup file.
- X
- XSYNTAX
- X This section is a summary of the syntax of makefile state-
- X ments. The description is given in a style similar to BNF,
- X where { } enclose items that may appear zero or more times,
- X and [ ] enclose items that are optional. Alternative pro-
- X ductions for a left hand side are indicated by '->', and
- X
- X
- X
- XVersion 3.50 UW 5
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X newlines are significant. All symbols in bold type are text
- X or names representing text supplied by the user.
- X
- X
- X
- X Makefile -> { Statement }
- X
- X Statement -> Macro-Definition
- X -> Conditional
- X -> Rule-Definition
- X -> Attribute-Definition
- X
- X Macro-Definition -> MACRO = LINE
- X -> MACRO := LINE
- X -> MACRO += LINE
- X -> MACRO +:= LINE
- X
- X Conditional -> .IF expression
- X Makefile
- X [ .ELSE
- X Makefile ]
- X .END
- X
- X expression -> LINE
- X -> STRING == LINE
- X -> STRING != LINE
- X
- X
- X Rule-Definition -> target-definition
- X [ recipe ]
- X
- X target-definition -> targets [attrs] op { PREREQUISITE } [; rcp-line]
- X
- X targets -> target { targets }
- X -> "target" { targets }
- X
- X target -> special-target
- X -> TARGET
- X
- X attrs -> attribute { attrs }
- X -> "attribute" { attrs }
- X
- X op -> : { modifier }
- X
- X modifier -> :
- X -> ^
- X -> !
- X -> -
- X
- X recipe -> { TAB rcp-line }
- X -> [@][-] [
- X { LINE }
- X
- X
- X
- XVersion 3.50 UW 6
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X ]
- X
- X rcp-line -> [@][-] LINE
- X
- X
- X Attribute-Definition -> attrs : targets
- X
- X
- X attribute -> .EPILOG
- X -> .IGNORE
- X -> .LIBRARY
- X -> .NOINFER
- X -> .PRECIOUS
- X -> .PROLOG
- X -> .SETDIR=path
- X -> .SILENT
- X -> .SEQUENTIAL
- X -> .SYMBOL
- X -> .UPDATEALL
- X
- X special-target -> .ERROR
- X -> .EXPORT
- X -> .GROUPEPILOG
- X -> .GROUPPROLOG
- X -> .IMPORT
- X -> .INCLUDE
- X -> .INCLUDEDIRS
- X -> .MAKEFILES
- X -> .REMOVE
- X -> .SOURCE
- X -> .SOURCE.suffix
- X -> .suffix1.suffix2
- X
- X
- X Where, TAB represents a <tab> character, STRING represents
- X an arbitrary sequence of characters, and LINE represents a
- X possibly empty sequence of characters terminated by a non-
- X escaped (not immediately preceded by a backslash '\') new-
- X line character. MACRO, PREREQUISITE, and TARGET each
- X represent a string of characters not including space or tab
- X which respectively form the name of a macro, prerequisite or
- X target. The name may itself be a macro expansion expres-
- X sion. A LINE can be continued over several physical lines
- X by terminating it with a single backslash character. Com-
- X ments are initiated by the pound '#' character and extend to
- X the end of line. All comment text is discarded, a '#' may
- X be placed into the makefile text by escaping it with '\'
- X (ie. \# translates to # when it is parsed). A group of con-
- X tinued lines may be commented out by placing a single # at
- X the start of the first line of the group. A continued line
- X may not span more than one makefile.
- X
- X
- X
- X
- XVersion 3.50 UW 7
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X white space is defined to be any combination of <space>,
- X <tab>, and the sequence \<nl> when \<nl> is used to ter-
- X minate a LINE. When processing macro definition lines, any
- X amount of white space is allowed on either side of the macro
- X operator (=, :=, += or +:=), and white space is stripped
- X from both before and after the macro value string. The
- X sequence \<nl> is treated as white space during recipe
- X expansion and is deleted from the final recipe string. You
- X must escape the \<nl> with a \ in order to get a \<nl> at
- X the end of a recipe line. The \<nl> sequence is always
- X deleted from macro values.
- X
- X When processing target definition lines, the recipe for a
- X target must, in general, follow the first definition of the
- X target (See the RULES AND TARGETS section for an exception),
- X and the recipe may not span across multiple makefiles. Any
- X targets and prerequisites found on a target definition line
- X are taken to be white space separated tokens. The rule
- X operator (op in SYNTAX section) is also considered to be a
- X token but does not require white space to precede or follow
- X it. Since the rule operator begins with a `:', traditional
- X versions of make do not allow the `:' character to form a
- X valid target name. dmake allows `:' to be present in
- X target/prerequisite names as long as the entire
- X target/prerequisite name is quoted. For example:
- X
- X a:fred : test
- X
- X would be parsed as TARGET = a, PREREQUISITES are fred, :,
- X and test, which is not what was intended. To fix this you
- X must write:
- X
- X "a:fred" : test
- X
- X Which will be parsed as expected. See the EXAMPLES section
- X for how to apply this to a list of targets.
- X
- XATTRIBUTES
- X dmake defines several target attributes. Attributes may be
- X assigned to a single target, a group of targets, or to all
- X targets in the makefile. Attributes are used to modify
- X dmake actions during target update. The recognized attri-
- X butes are:
- X
- X
- X .EPILOG Insert shell epilog code when executing a group
- X recipe associated with any target having this
- X attribute set.
- X
- X .IGNORE Ignore an error when trying to make any target
- X with this attribute set.
- X
- X
- X
- X
- XVersion 3.50 UW 8
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X .LIBRARY Target is a library.
- X
- X .NOINFER Any target with this attribute set will not be
- X subjected to transitive closure if it is
- X inferred as a prerequisite of a target whose
- X recipe and prerequisites are being inferred.
- X (i.e. the inference search will not use any
- X prerequisite with this attribute set, as a tar-
- X get)
- X
- X .PRECIOUS Do not remove this target under any cir-
- X cumstances. Set by default for any targets
- X whose corresponding files exist in the file sys-
- X tem prior to the execution of dmake.
- X
- X .PROLOG Insert shell prolog code when executing a group
- X recipe associated with any target having this
- X attribute set.
- X
- X .SEQUENTIAL Force a sequential make of the associated
- X target's prerequisites.
- X
- X .SETDIR Change current working directory to specified
- X directory when making associated target. The
- X syntax of this attribute is different from the
- X others. You must specify the directory at the
- X time the attribute is specified. To do this
- X simply give .SETDIR=path as the attribute. path
- X is expanded and the result is used as the value
- X of the directory to change to. If path is sur-
- X rounded by single quotes then path is not
- X expanded, and is used literally as the directory
- X name. If the path contains any `:' characters
- X then the entire attribute string must be quoted
- X using ". If a target having this attribute set
- X also has the .IGNORE attribute set then if the
- X change to the specified directory fails it will
- X be ignored, and no error message will be issued.
- X
- X .SILENT Do not echo the recipe lines when making any
- X target with this attribute set, and do not issue
- X any warnings.
- X
- X .SYMBOL Target is a library member and is an entry point
- X into a module in the library. This attribute is
- X used only when searching a library for a target.
- X Targets of the form lib((entry)) have this
- X attribute set automatically.
- X
- X .UPDATEALL Indicates that all the targets listed in this
- X rule are updated by the execution of the accom-
- X panying recipe. A common example is the
- X
- X
- X
- XVersion 3.50 UW 9
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X production of the y.tab.c and y.tab.h files by
- X yacc when it is run on a grammar. Specifying
- X .UPDATEALL in such a rule prevents the running
- X of yacc twice, once for the y.tab.c file and
- X once for the y.tab.h file.
- X
- X
- X All attributes are user setable and may be used in one of
- X two forms (except .UPDATEALL, use of this attribute in a
- X rule of the first form is illegal)
- X
- X ATTRIBUTE_LIST : targets
- X
- X assigns the attributes specified by ATTRIBUTE_LIST to each
- X target in targets or
- X
- X targets ATTRIBUTE_LIST : ...
- X
- X assigns the attributes specified by ATTRIBUTE_LIST to each
- X target in targets. In the first form if targets is empty
- X (ie. a NULL list), then the list of attributes will apply to
- X all targets in the makefile (this is equivalent to the com-
- X mon Make construct of ".IGNORE :" but has been modified to
- X the notion of an attribute instead of a special target).
- X Not all of the attributes have global meaning. In particu-
- X lar, .LIBRARY, .SYMBOL, and .UPDATEALL have no assigned glo-
- X bal meaning.
- X
- X Any attribute may be used with any target, even with the
- X special targets. Some combinations are useless (e.g.
- X .INCLUDE .PRECIOUS: ... ), while others are useful (e.g.
- X .INCLUDE .IGNORE : "file.mk" will not complain if file.mk
- X cannot be found using the include file search rules, see the
- X section on SPECIAL TARGETS for a description of .INCLUDE).
- X If a specified attribute will not be used with the special
- X target a warning is issued and the attribute is ignored.
- X
- XMACROS
- X dmake supports four types of macro assignment. The first
- X and most familiar is the usual assignment:
- X
- X MACRO = LINE
- X
- X which causes LINE to be assigned without expansion, as the
- X value of MACRO. The second form:
- X
- X MACRO := LINE
- X
- X is new and indicates that LINE should be expanded prior to
- X being assigned as the value of MACRO. Future expansions of
- X MACRO do not have the value expanded since it was expanded
- X when the macro was defined. The third form of macro
- X
- X
- X
- XVersion 3.50 UW 10
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X assignment allows macro values to grow:
- X
- X MACRO += LINE
- X
- X adds the value of LINE to the previous value of MACRO
- X separating the two by a single space (LINE is not expanded).
- X The final form:
- X
- X MACRO +:= LINE
- X
- X is similar to +=, with the difference that the value of LINE
- X is expanded before being added to the previous value of
- X MACRO.
- X
- X When dmake defines a non-environment macro it strips leading
- X and trailing white space from the macro value. Macros
- X imported from the environment via either the .IMPORT special
- X target (see the SPECIAL TARGETS section), or the -e, or -E
- X flags are an exception to this rule. Their values are
- X always taken literally and white space is never stripped.
- X In addition, macros defined using the .IMPORT special target
- X do not have their values expanded when they are used within
- X a makefile. In contrast, environment macros that are
- X imported due to the specification of the -e or -E flags are
- X subject to expansion when used.
- X
- X To specify a macro expansion enclose the name in () or {}
- X and precede it with a dollar sign $. Thus $(TEST)
- X represents an expansion of the macro variable named TEST.
- X If TEST is defined then $(TEST) is replaced by its expanded
- X value. If TEST is not defined then $(TEST) expands to the
- X NULL string (this is equivalent to defining a macro as
- X 'TEST=' ). A short form may be used for single character
- X named macros. In this case the parentheses are optional,
- X and $(I) is equivalent to $I. Macro expansion is recursive,
- X hence if the value string contains an expression represent-
- X ing a macro expansion, the expansion is performed. Circular
- X macro expansions are detected and cause an error to be
- X issued.
- X
- X When defining a macro the given macro name is first expanded
- X before being used to define the macro. Thus it is possible
- X to define macros whose names depend on values of other mac-
- X ros. For example, suppose
- X
- X CWD = $(PWD:b)
- X
- X is defined, then the value of $(CWD) is the name of the
- X current directory. This can be used to define macros
- X specific to this directory, for example:
- X
- X _$(CWD).prt = list of files to print...
- X
- X
- X
- XVersion 3.50 UW 11
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X The actual name of the defined macro is a function of the
- X current directory. A construct such as this is useful when
- X processing a hierarchy of directories using .SETDIR attri-
- X buted targets and a collection of small distributed makefile
- X stubs.
- X
- X Macro variables may be defined within the makefile, on the
- X command line, or imported from the environment.
- X
- X dmake supports several non-standard macro expansions: The
- X first is of the form:
- X
- X $(macro_name:modifier_list:modifier_list:...)
- X
- X where modifier_list is chosen from the set { D or d, F or f,
- X B or b, S or s, T or t } and
- X
- X d - directory portion of all path names
- X f - file (including suffix) portion of path names
- X b - file (not including suffix) portion of path names
- X s - simple pattern substitution
- X t - tokenization.
- X
- X Thus if we have the example:
- X
- X test = d1/d2/d3/a.out f.out d1/k.out
- X
- X The following macro expansions produce the values on the
- X right of '-->' after expansion.
- X
- X $(test:d) --> d1/d2/d3/ d1/
- X $(test:b) --> a f k
- X $(test:f) --> a.out f.out k.out
- X ${test:db} --> d1/d2/d3/a f d1/k
- X ${test:s/out/in/:f} --> a.in f.in k.in
- X $(test:f:t"+") --> a.out+f.out+k.out
- X
- X If a token ends in a string composed from the value of the
- X macro DIRBRKSTR (ie. ends in a directory separator string,
- X e.g. '/' in UNIX) and you use the :d modifier then the
- X expansion returns the directory name less the final direc-
- X tory separator string. Thus successive pairs of :d modif-
- X iers each remove a level of directory in the token string.
- X
- X The tokenization modifier takes all white space separated
- X tokens from the macro value and separates them by the quoted
- X separator string. The separator string may contain the fol-
- X lowing escape codes \a => <bel>, \b => <backspace>, \f =>
- X <formfeed>, \n => <nl>, \r => <cr>, \t => <tab>, \v =>
- X <vertical tab>, \" => ", and \xxx => <xxx> where xxx is the
- X octal representation of a character. Thus the expansion:
- X
- X
- X
- X
- XVersion 3.50 UW 12
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X $(test:f:t"+\n")
- X
- X gives:
- X
- X a.out+
- X f.out+
- X k.out
- X
- X The second non-standard form of macro expansion allows for
- X recursive macros. It is possible to specify a $(macro_name)
- X or ${macro_name} expansion where macro_name contains more $(
- X ... ) or ${ ... } macro expansions itself.
- X
- X For example $(CC$(_HOST)$(_COMPILER)) will first expand
- X CC$(_HOST)$(_COMPILER) to get a result and use that result
- X as the name of the macro to expand. This is useful for
- X writing a makefile for more than one target environment. As
- X an example consider the following hypothetical case. Suppose
- X that _HOST and _COMPILER are imported from the environment
- X and are set to represent the host machine type and the host
- X compiler respectively.
- X
- X CFLAGS_VAX_CC = -c -O # _HOST == "_VAX", _COMPILER == "_CC"
- X CFLAGS_PC_MSC = -c -ML # _HOST == "_PC", _COMPILER == "_MSC"
- X
- X # redefine CFLAGS macro as:
- X
- X CFLAGS := $(CFLAGS$(_HOST)$(_COMPILER))
- X
- X This causes CFLAGS to take on a value that corresponds to
- X the environment in which the make is being invoked.
- X
- X The final non-standard macro expansion is of the form:
- X
- X string1{token_list}string2
- X
- X where string1, string2 and token_list are expanded. After
- X expansion, string1 is prepended to each token found in
- X token_list and string2 is appended to each resulting token
- X from the previous prepend. string1 and string2 are not del-
- X imited by white space whereas the tokens in token_list are.
- X A null token in the token list is specified using "". Thus
- X using another example we have:
- X
- X test/{f1 f2}.o --> test/f1.o test/f2.o
- X test/ {f1 f2}.o --> test/ f1.o f2.o
- X test/{f1 f2} .o --> test/f1 test/f2 .o
- X test/{ f1 "f2" "" }.o --> test/f1.o test/f2.o
- X test/.o
- X
- X and
- X
- X
- X
- X
- XVersion 3.50 UW 13
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X test/{ d1 d2 }/{ f1 f2 }.o --> test/d1/f1.o
- X test/d1/f2.o
- X test/d2/f1.o
- X test/d2/f2.o
- X
- X See the SPECIAL MACROS section for a description of the spe-
- X cial macros that dmake defines and understands.
- X
- XRULES AND TARGETS
- X A makefile contains a series of entries that specify depen-
- X dencies. Such entries are called target/prerequisite or
- X rule definitions. Each rule definition is optionally fol-
- X lowed by a set of lines that provide a recipe for updating
- X any targets defined by the rule. Whenever dmake attempts to
- X bring a target up to date and an explicit recipe is provided
- X with a rule defining the target, that recipe is used to
- X update the target. A rule definition begins with a line
- X having the following syntax:
- X
- X <targets> [<attributes>] <ruleop> [<prerequisites>] [;<recipe>]
- X
- X targets is a non-empty list of targets. If the target is a
- X special target (see SPECIAL TARGETS section below) then it
- X must appear alone on the rule line. For example:
- X
- X .IMPORT .ERROR : ...
- X
- X is not allowed since both .IMPORT and .ERROR are special
- X targets. Special targets are not used in the construction
- X of the dependency graph and will not be made.
- X
- X attributes is a possibly empty list of attributes. Any
- X attribute defined in the ATTRIBUTES section above may be
- X specified. All attributes will be applied to the list of
- X named targets in the rule definition. No other targets will
- X be affected.
- X
- X
- X NOTE: As stated earlier, if both the target list and
- X prerequisite list are empty but the attributes list
- X is not, then the specified attributes affect all
- X targets in the makefile.
- X
- X
- X ruleop is a separator which is used to identify the targets
- X from the prerequisites. Optionally it also provides a
- X facility for modifying the way in which dmake handles the
- X making of the associated targets. In its simplest form the
- X operator is a single ':', and need not be separated by white
- X space from its neighboring tokens. It may additionally be
- X followed by any of the modifiers { !, ^, -, : }, where:
- X
- X
- X
- X
- XVersion 3.50 UW 14
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X ! says execute the recipe for the associated targets once
- X for each out of date prerequisite. Ordinarily the
- X recipe is executed once for all out of date prere-
- X quisites at the same time.
- X
- X ^ says to insert the specified prerequisites, if any,
- X before any other prerequisites already associated with
- X the specified targets. In general, it is not useful to
- X specify ^ with an empty list of prerequisites.
- X
- X - says to clear the previous list of prerequisites before
- X adding the new prerequisites. Thus,
- X
- X .SUFFIXES :
- X .SUFFIXES : .a .b
- X
- X can be replaced by
- X
- X .SUFFIXES :- .a .b
- X
- X however the old form still works as expected. NOTE:
- X .SUFFIXES is ignored by dmake it is used here simply as
- X an example.
- X
- X : When the rule operator is not modified by a second ':'
- X only one set of rules may be specified for making a
- X target. Multiple definitions may be used to add to the
- X list of prerequisites that a target depends on. How-
- X ever, if a target is multiply defined only one defini-
- X tion may specify a recipe for making the target.
- X
- X When a target's rule operator is modified by a second
- X ':' (:: for example) then this definition may not be
- X the only definition with a recipe for the target.
- X There may be other :: target definition lines that
- X specify a different set of prerequisites with a dif-
- X ferent recipe for updating the target. Any such target
- X is made if any of the definitions find it to be out of
- X date with respect to the related prerequisites and uses
- X the corresponding recipe to update the target.
- X
- X In the following simple example, each rule has a `::'
- X ruleop. In such an operator we call the first `:' the
- X operator, and the second `:' the modifier.
- X
- X a.o :: a.c b.h
- X first recipe for making a.o
- X
- X a.o :: a.y b.h
- X second recipe for making a.o
- X
- X If a.o is found to be out of date with respect to a.c
- X
- X
- X
- XVersion 3.50 UW 15
- X
- X
- X
- X
- XDMAKE(p) Unsupported Software DMAKE(p)
- X
- X
- X
- X then the first recipe is used to make a.o. If it is
- X found out of date with respect to a.y then the second
- X recipe is used. If a.o is out of date with respect to
- X b.h then both recipes are invoked to make a.o. In the
- X last case the order of invocation corresponds to the
- X order in which the rule definitions appear in the
- X makefile.
- X
- X Targets defined using a single `:' operator with a recipe
- X may be redefined again with a new recipe by using a `:'
- X operator with a `:' modifier. This is equivalent to a tar-
- X get having been initially defined with a rule using a `:'
- X modifier. Once a target is defined using a `:' modifier it
- X may not be defined again with a recipe using only the `:'
- X operator with no `:' modifier. In both cases the use of a
- X `:' modifier creates a new list of prerequisites and makes
- SHAR_EOF
- echo "End of part 12"
- echo "File man/dmake.nc is continued in part 13"
- echo "13" > s2_seq_.tmp
- exit 0
-
-