home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume15 / dmake-3.6 / part11 < prev    next >
Text File  |  1990-10-14  |  40KB  |  1,019 lines

  1. Newsgroups: comp.sources.misc
  2. X-UNIX-From: dvadura@watdragon.waterloo.edu
  3. subject: v15i063: dmake version 3.6 (part 11/25)
  4. from: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  5. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  6.  
  7. Posting-number: Volume 15, Issue 63
  8. Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  9. Archive-name: dmake-3.6/part11
  10.  
  11. #!/bin/sh
  12. # this is part 11 of a multipart archive
  13. # do not concatenate these parts, unpack them in order with /bin/sh
  14. # file man/dmake.tf continued
  15. #
  16. CurArch=11
  17. if test ! -r s2_seq_.tmp
  18. then echo "Please unpack part 1 first!"
  19.      exit 1; fi
  20. ( read Scheck
  21.   if test "$Scheck" != $CurArch
  22.   then echo "Please unpack part $Scheck next!"
  23.        exit 1;
  24.   else exit 0; fi
  25. ) < s2_seq_.tmp || exit 1
  26. echo "x - Continuing file man/dmake.tf"
  27. sed 's/^X//' << 'SHAR_EOF' >> man/dmake.tf
  28. Xthe recipe may not span across multiple makefiles.
  29. XAny targets and prerequisites found on a target definition line are taken
  30. Xto be white space separated tokens.
  31. XThe rule operator (\fIop\fP in SYNTAX section) is also considered
  32. Xto be a token but does not require
  33. Xwhite space to precede or follow it.  Since the rule operator begins with a `:',
  34. Xtraditional versions of make do not allow the `:' character to
  35. Xform a valid target name.  \fBdmake\fP allows `:' to be present in
  36. Xtarget/prerequisite names as long as the entire target/prerequisite name is
  37. Xquoted.  For example:
  38. X.sp
  39. X\ta:fred : test
  40. X.sp
  41. Xwould be parsed as TARGET = a, PREREQUISITES are fred, :, and test, which
  42. Xis not what was intended.  To fix this you must write:
  43. X.sp
  44. X\t"a:fred" : test
  45. X.sp
  46. XWhich will be parsed as expected.
  47. XSee the EXAMPLES section for how to apply this to a list of targets.
  48. X.SH ATTRIBUTES
  49. X.B dmake
  50. Xdefines several target attributes.  Attributes may be
  51. Xassigned to a single target, a group of targets, or to all targets in the
  52. Xmakefile.  Attributes are used to modify
  53. X\fBdmake\fP actions during target update.
  54. XThe recognized attributes are:
  55. X.sp
  56. X.IP \fB.EPILOG\fP 1.2i
  57. XInsert shell epilog code when executing a group recipe associated with
  58. Xany target having this attribute set.
  59. X.IP \fB.IGNORE\fP 1.2i
  60. XIgnore an error when trying to make any target with this attribute set.
  61. X.IP \fB.LIBRARY\fP 1.2i
  62. XTarget is a library.
  63. X.IP \fB.MKSARGS\fP 1.2i
  64. XIf in an MSDOS environment then use MKS extended argument passing
  65. Xconventions to pass arguments to commands.  Non-MSDOS
  66. Xenvironments ignore this attribute.
  67. X.IP \fB.NOINFER\fP 1.2i
  68. XAny target with this attribute set will not be subjected
  69. Xto transitive closure if it is inferred as a prerequisite 
  70. Xof a target whose recipe and prerequisites are being inferred.
  71. X(i.e. the inference algorithm will not use any prerequisite with this attribute 
  72. Xset, as a target)
  73. X.IP \fB.PRECIOUS\fP 1.2i
  74. XDo not remove this target under any circumstances.
  75. XSet by default for any targets whose corresponding files exist in the file
  76. Xsystem prior to the execution of \fBdmake\fP.
  77. X.IP \fB.PROLOG\fP 1.2i
  78. XInsert shell prolog code when executing a group recipe associated with
  79. Xany target having this attribute set.
  80. X.IP \fB.SEQUENTIAL\fP 1.2i
  81. XForce a sequential make of the associated target's prerequisites.
  82. X.IP \fB.SETDIR\fP 1.2i
  83. XChange current working directory to specified directory when making the
  84. Xassociated target.  You must
  85. Xspecify the directory at the time the attribute is specified.  To do this
  86. Xsimply give \fI.SETDIR=path\fP as the attribute.  \fIpath\fP is expanded and
  87. Xthe result is used as the value of the directory to change to.
  88. XIf path is surrounded by single quotes then path is not expanded, and is used
  89. Xliterally as the directory name.
  90. XIf the \fIpath\fP contains any `:' characters then the entire attribute string
  91. Xmust be quoted using ".
  92. XIf a target having this attribute set also has the .IGNORE
  93. Xattribute set then if the change to the specified directory fails it will be
  94. Xignored, and no error message will be issued.
  95. X.IP \fB.SILENT\fP 1.2i
  96. XDo not echo the recipe lines when making any target with this attribute set,
  97. Xand do not issue any warnings.
  98. X.IP \fB.SWAP\fP 1.2i
  99. XUnder MSDOS
  100. Xwhen making a target with this attribute set swap the \fBdmake\fP executable
  101. Xto disk prior to executing the recipe line.
  102. X.IP \fB.SYMBOL\fP 1.2i
  103. XTarget is a library member and is an entry point into a module in the
  104. Xlibrary.  This attribute is used only when searching a library for a target.
  105. XTargets of the form lib((entry)) have this attribute set automatically.
  106. X.IP \fB.USESHELL\fP 1.2i
  107. XForce each recipe line of a target to be executed using a shell.
  108. XSpecifying this attribute is equivalent to specifying the '+' character at the
  109. Xstart of each line of a non-group recipe.
  110. X.IP \fB.UPDATEALL\fP 1.2i
  111. XIndicates that all the targets listed in this rule are updated by the
  112. Xexecution of the accompanying recipe.
  113. XA common example is the production of the
  114. X.I y.tab.c
  115. Xand
  116. X.I y.tab.h
  117. Xfiles by
  118. X.B yacc
  119. Xwhen it is run on a grammar.  Specifying .UPDATEALL in such a rule
  120. Xprevents the running of yacc twice, once for the y.tab.c file and once
  121. Xfor the y.tab.h file.
  122. X.sp
  123. X.PP
  124. XAll attributes are user setable and except for .UPDATEALL and .MKSARGS
  125. Xmay be used in one of two forms.
  126. XThe .MKSARGS attribute is restricted to use as a global attribute, and
  127. Xthe use of the .UPDATEALL attribute is restricted to rules of the second
  128. Xform only.
  129. X.sp
  130. X\tATTRIBUTE_LIST : \fItargets\fP
  131. X.sp
  132. Xassigns the attributes specified by ATTRIBUTE_LIST to each target in
  133. X.I targets
  134. Xor
  135. X.sp
  136. X\t\fItargets\fP ATTRIBUTE_LIST : ...
  137. X.sp
  138. Xassigns the attributes specified by ATTRIBUTE_LIST to each target in
  139. X.I targets.
  140. XIn the first form if
  141. X.I targets
  142. Xis empty (ie. a NULL list), then the
  143. Xlist of attributes will apply to all targets in the makefile
  144. X(this is equivalent to the common Make construct of \fI".IGNORE :"\fP
  145. Xbut has been modified to the notion of an attribute instead of
  146. Xa special target).
  147. XNot all of the attributes have global meaning.
  148. XIn particular, .LIBRARY, .SYMBOL, and .UPDATEALL
  149. Xhave no assigned global meaning.
  150. X.PP
  151. XAny attribute may be used with any target, even with the special targets.
  152. XSome combinations are useless (e.g. .INCLUDE .PRECIOUS: ... ),
  153. Xwhile others are useful (e.g. .INCLUDE .IGNORE : "file.mk" will not complain
  154. Xif file.mk cannot be found using the include file search rules,
  155. Xsee the section on SPECIAL TARGETS for a description of .INCLUDE).
  156. XIf a specified attribute will not be used with the special target a warning
  157. Xis issued and the attribute is ignored.
  158. X.SH MACROS
  159. X.B dmake
  160. Xsupports six types of macro assignment.
  161. X.sp
  162. X.IP "\fBMACRO = LINE\fP" 1.55i
  163. XThis is the most common and familiar form of macro assignment.  It assigns
  164. XLINE literally as the value of MACRO.
  165. XFuture expansions of MACRO recursively expand it's value.
  166. X.IP "\fBMACRO *= LINE\fP" 1.55i
  167. XThis form behaves exactly as the simple '=' form with the exception that if
  168. XMACRO already has a value then the assignment is not performed.
  169. X.IP "\fBMACRO := LINE\fP" 1.55i
  170. XThis form differs from the simple '=' form in that it expands LINE
  171. Xprior to assigning it as the value of MACRO.
  172. XFuture expansions of MACRO do not recursively expand it's value.
  173. X.IP "\fBMACRO *:= LINE\fP" 1.55i
  174. XThis form behaves exactly as the ':=' form with the exception that if
  175. XMACRO already has a value then the assignment and expansion are not performed.
  176. X.IP "\fBMACRO += LINE\fP" 1.55i
  177. XThis form of macro assignment allows macro values to grow.  It takes the
  178. Xliteral value of LINE and appends it to the previous value of MACRO separating
  179. Xthe two by a single space.
  180. XFuture expansions of MACRO recursively expand it's value.
  181. X.IP "\fBMACRO +:= LINE\fP" 1.55i
  182. XThis form is similar to the '+=' form except that the value of LINE is expanded
  183. Xprior to being added to the value of MACRO.
  184. X.PP
  185. XMacro expressions specified on the command line allow the macro value
  186. Xto be redefined within the makefile only if the macro is defined using
  187. Xthe '+=' and '+:=' operators.  Other operators will define a macro that cannot
  188. Xbe further modified.
  189. X.PP
  190. XWhen \fBdmake\fP defines a non-environment macro it strips leading and
  191. Xtrailing white space from the macro value.
  192. XMacros imported from the environment via either the .IMPORT special
  193. Xtarget (see the SPECIAL TARGETS section), or the \fB-e\fP, or \fB-E\fP flags
  194. Xare an exception to this rule.  Their values are
  195. Xalways taken literally and white space is never stripped.
  196. XIn addition, macros defined using the .IMPORT special target do
  197. Xnot have their values expanded when they are used within a makefile.
  198. XIn contrast, environment macros that are imported
  199. Xdue to the specification of the \fB-e\fP or \fB-E\fP flags
  200. Xare subject to expansion when used.
  201. X.PP
  202. XTo specify a macro expansion
  203. Xenclose the name in () or {} and precede it with a dollar sign $.
  204. XThus $(TEST) represents an expansion of the macro variable named TEST.
  205. XIf TEST is
  206. Xdefined then $(TEST) is replaced by its expanded value.  If TEST is not
  207. Xdefined then $(TEST) expands to the NULL string (this is equivalent to
  208. Xdefining a macro as 'TEST=' ).  A short form may be used for single character
  209. Xnamed macros.  In this case the parentheses are optional, and $(I) is
  210. Xequivalent to $I.
  211. XMacro expansion is recursive, hence, if the value string contains an expression
  212. Xrepresenting a macro expansion, the expansion is performed.  Circular macro
  213. Xexpansions are detected and cause an error to be issued.
  214. X.PP
  215. XWhen defining a macro the given macro name is first expanded before being used
  216. Xto define the macro.  Thus it is possible to define macros whose names
  217. Xdepend on values of other macros.  For example, suppose
  218. X.sp
  219. X\tCWD = $(PWD:b)
  220. X.sp
  221. Xis defined, then the value of $(CWD) is the name of the current directory.
  222. XThis can be used to define macros specific to this directory, for
  223. Xexample:
  224. X.sp
  225. X\t_$(CWD).prt = list of files to print...
  226. X.sp
  227. XThe actual name of the defined macro is a function of the current directory.
  228. XA construct such as this is useful when processing a hierarchy of directories
  229. Xusing .SETDIR attributed targets and a collection of small distributed
  230. Xmakefile stubs.
  231. X.PP
  232. XMacro variables may be defined within the makefile, on the command
  233. Xline, or imported from the environment.
  234. X.PP
  235. X.B \fBdmake\fR
  236. Xsupports several non-standard macro expansions:
  237. XThe first is of the form:
  238. X.RS
  239. X.IP \fI$(macro_name:modifier_list:modifier_list:...)\fR
  240. X.RE
  241. X.LP
  242. Xwhere
  243. X.I modifier_list
  244. Xis chosen from the set { D or d, F or f, B or b, S or s, T or t } and
  245. X.RS
  246. X.sp
  247. X.Is "d "
  248. X.Ii "d "
  249. X\- directory portion of all path names
  250. X.Ii "f"
  251. X\- file (including suffix) portion of path names
  252. X.Ii "b"
  253. X\- file (not including suffix) portion of path names
  254. X.Ii "s"
  255. X\- simple pattern substitution
  256. X.Ii "t"
  257. X\- tokenization.
  258. X.sp
  259. X.RE
  260. XThus if we have the example:
  261. X.LP
  262. X\ttest = d1/d2/d3/a.out f.out d1/k.out
  263. X.LP
  264. XThe following macro expansions produce the values on the right of '-->' after
  265. Xexpansion.
  266. X.RS
  267. X.sp
  268. X.Is "$(test:s/out/in/:f)  "
  269. X.Ii "$(test:d)"
  270. X--> d1/d2/d3/ d1/
  271. X.Ii "$(test:b)"
  272. X--> a f k
  273. X.Ii "$(test:f)"
  274. X--> a.out f.out k.out
  275. X.Ii "${test:db}"
  276. X--> d1/d2/d3/a f d1/k
  277. X.Ii "${test:s/out/in/:f}"
  278. X--> a.in f.in k.in
  279. X.Ii $(test:f:t"+")
  280. X--> a.out+f.out+k.out
  281. X.RE
  282. X.PP
  283. XIf a token ends in a string composed from the value of the macro DIRBRKSTR
  284. X(ie. ends in a directory separator string, e.g. '/' in UNIX) and you use the
  285. X\fB:d\fP modifier then the expansion returns the directory name less the
  286. Xfinal directory separator string.  Thus successive pairs of :d modifiers
  287. Xeach remove a level of directory in the token string.
  288. X.PP
  289. XThe tokenization modifier takes all white space separated tokens from the
  290. Xmacro value and separates them by the quoted separator string.  The separator
  291. Xstring may contain the following escape codes \\a => <bel>,
  292. X\&\\b => <backspace>, \\f => <formfeed>, \\n => <nl>, \\r => <cr>,
  293. X\&\\t => <tab>, \\v => <vertical tab>, \\" => ", and \\xxx => <xxx> where
  294. Xxxx is the octal representation of a character.  Thus the
  295. Xexpansion:
  296. X.LP
  297. X.RS
  298. X.nf
  299. X$(test:f:t"+\\n")
  300. X.RE
  301. Xproduces:
  302. X.RS
  303. Xa.out+
  304. Xf.out+
  305. Xk.out
  306. X.fi
  307. X.RE
  308. X.PP
  309. XThe second non-standard form of macro expansion allows for recursive macros.
  310. XIt is possible to specify a $(\fImacro_name\fR) or ${\fImacro_name\fR} expansion
  311. Xwhere \fImacro_name\fR contains more $( ... ) or ${ ... } macro expansions
  312. Xitself.
  313. X.PP
  314. XFor example $(CC$(_HOST)$(_COMPILER)) will first expand CC$(_HOST)$(_COMPILER)
  315. Xto get a result and use that result as the name of the macro to expand.
  316. XThis is useful for writing a makefile for more than one target
  317. Xenvironment.  As an example consider the following hypothetical case. 
  318. XSuppose that _HOST and _COMPILER are imported from the environment
  319. Xand are set to represent the host machine type and the host compiler
  320. Xrespectively.
  321. X.RS
  322. X.sp
  323. X.nf
  324. XCFLAGS_VAX_CC = -c -O    # _HOST == "_VAX", _COMPILER == "_CC"
  325. XCFLAGS_PC_MSC = -c -ML    # _HOST == "_PC",  _COMPILER == "_MSC"
  326. X.sp
  327. X# redefine CFLAGS macro as:
  328. X.sp
  329. XCFLAGS := $(CFLAGS$(_HOST)$(_COMPILER))
  330. X.fi
  331. X.sp
  332. X.RE
  333. XThis causes CFLAGS to take on a value that corresponds to the
  334. Xenvironment in which the make is being invoked.
  335. X.PP
  336. XThe final non-standard macro expansion is of the form:
  337. X.RS
  338. X.sp
  339. Xstring1{token_list}string2
  340. X.RE
  341. X.LP
  342. Xwhere string1, string2 and token_list are expanded.  After expansion,
  343. Xstring1 is prepended to each token found in token_list and
  344. Xstring2 is appended to each resulting token from the previous prepend.
  345. Xstring1 and string2 are not delimited by white space
  346. Xwhereas the tokens in token_list are.  A null token in the token list 
  347. Xis specified using "".
  348. XThus using another example we have:
  349. X.RS
  350. X.sp
  351. X.Is "test/{ f1  ""f2"" """" }.o    "
  352. X.Ii "test/{f1 f2}.o"
  353. X--> test/f1.o test/f2.o
  354. X.Ii "test/ {f1 f2}.o"
  355. X--> test/ f1.o f2.o
  356. X.Ii "test/{f1 f2} .o"
  357. X--> test/f1 test/f2 .o
  358. X.Ii "test/{ f1  ""f2"" """" }.o"
  359. X--> test/f1.o test/f2.o test/.o
  360. X.sp
  361. X.Ii and
  362. X.sp
  363. X.Is "test/{ d1 d2 }/{ f1 f2 }.o --> "
  364. X.Ii "test/{ d1 d2 }/{ f1 f2 }.o --> "
  365. Xtest/d1/f1.o test/d1/f2.o
  366. Xtest/d2/f1.o test/d2/f2.o
  367. X.sp
  368. X.RE
  369. XSee the SPECIAL MACROS section for a description of the special macros that
  370. X\fBdmake\fP defines and understands.
  371. X.SH "RULES AND TARGETS"
  372. XA makefile contains a series of entries that specify dependencies.
  373. XSuch entries are called \fItarget/prerequisite\fP or \fIrule\fP definitions.
  374. XEach rule definition
  375. Xis optionally followed by a set of lines that provide a recipe for updating
  376. Xany targets defined by the rule.
  377. XWhenever
  378. X.B dmake
  379. Xattempts to bring a target up to date and an explicit recipe is provided with
  380. Xa rule defining the target, that recipe is used to update the
  381. Xtarget.  A rule definition begins with a line having the following syntax:
  382. X.sp
  383. X.RS
  384. X.nf
  385. X\fI<targets>\fP [\fI<attributes>\fP] \fI<ruleop>\fP [\fI<prerequisites>\fP] [;\fI<recipe>\fP]
  386. X.fi
  387. X.RE
  388. X.sp
  389. X.I targets
  390. Xis a non-empty list of targets.  If the target is a
  391. Xspecial target (see SPECIAL TARGETS section below) then it must appear alone
  392. Xon the rule line.  For example:
  393. X.sp
  394. X.RS
  395. X\&.IMPORT .ERROR : ...
  396. X.RE
  397. X.sp
  398. Xis not allowed since both .IMPORT and .ERROR are special targets.
  399. XSpecial targets are not used in the construction of the dependency graph and
  400. Xwill not be made.
  401. X.PP
  402. X.I attributes
  403. Xis a possibly empty list of attributes.  Any attribute defined in the
  404. XATTRIBUTES section above may be specified.  All attributes will be applied to
  405. Xthe list of named targets in the rule definition.  No other targets will
  406. Xbe affected.
  407. X.sp
  408. X.IP NOTE: 0.75i
  409. XAs stated earlier,
  410. Xif both the target list and prerequisite list are empty but the attributes
  411. Xlist is not, then the specified attributes affect all targets in the makefile.
  412. X.sp
  413. X.PP
  414. X.I ruleop
  415. Xis a separator which is used to identify the targets from the prerequisites.
  416. XOptionally it also provides a facility for modifying the way in which
  417. X.B dmake
  418. Xhandles the making of the associated targets.
  419. XIn its simplest form the operator is a single ':', and need not be separated
  420. Xby white space from its neighbouring tokens.  It may additionally be followed
  421. Xby any of the modifiers { !, ^, -, : }, where:
  422. X.sp
  423. X.IP \fB!\fP
  424. Xsays execute the recipe for the associated targets once for each out of date
  425. Xprerequisite.  Ordinarily the recipe is executed
  426. Xonce for all out of date prerequisites at the same time.
  427. X.IP \fB^\fP
  428. Xsays to insert the specified prerequisites, if any, before any
  429. Xother prerequisites already associated with the specified targets.
  430. XIn general, it is not useful to specify ^ with an empty
  431. Xlist of prerequisites.
  432. X.IP \fB-\fP
  433. Xsays to clear the previous list of prerequisites before adding
  434. Xthe new prerequisites.  Thus,
  435. X.sp
  436. X\t.SUFFIXES :
  437. X.br
  438. X\t.SUFFIXES : .a .b
  439. X.sp
  440. Xcan be replaced by
  441. X.sp
  442. X\t.SUFFIXES :- .a .b
  443. X.sp
  444. Xhowever the old form still works as expected.  NOTE:  .SUFFIXES is ignored by
  445. X.B dmake
  446. Xit is used here simply as an example.
  447. X.IP \fB:\fP
  448. XWhen the rule operator is not modified by a second ':'
  449. Xonly one set of rules may be specified for making a target.
  450. XMultiple definitions may be used to add to the
  451. Xlist of prerequisites that a target depends on.
  452. XHowever, if a target is multiply defined
  453. Xonly one definition may specify a recipe
  454. Xfor making the target.
  455. X.sp
  456. XWhen a target's rule operator is modified by a second ':'
  457. X(:: for example) then this definition may not be the only
  458. Xdefinition with a recipe for the target.  There may be other :: target
  459. Xdefinition lines that specify a different set of prerequisites with a
  460. Xdifferent recipe for updating the target.  
  461. XAny such target is made if any of the definitions
  462. Xfind it to be out of date
  463. Xwith respect to the related prerequisites
  464. Xand the corresponding recipe is used to update the
  465. Xtarget.
  466. X.sp 
  467. XIn the following simple example, each rule has a `::' \fIruleop\fP.  In such an
  468. Xoperator we call the first `:' the operator, and the second `:' the modifier.
  469. X.sp
  470. X.nf
  471. Xa.o :: a.c b.h
  472. X   first recipe for making a.o
  473. X
  474. Xa.o :: a.y b.h
  475. X   second recipe for making a.o
  476. X.fi
  477. X.sp
  478. XIf a.o is found to be out of date with respect to a.c then the first recipe
  479. Xis used to make a.o.  If it is found out of date with respect to a.y then
  480. Xthe second recipe is used.  If a.o is out of date with respect to
  481. Xb.h then both recipes are invoked to make a.o.
  482. XIn the last case the order of invocation corresponds to the order in which the
  483. Xrule definitions appear in the makefile.
  484. X.PP
  485. XTargets defined using a single `:' operator
  486. Xwith a recipe may be redefined again with a new recipe by using a
  487. X`:' operator with a `:' modifier.
  488. XThis is equivalent to a target having been
  489. Xinitially defined with a rule using a `:' modifier.
  490. XOnce a target is defined using a `:'
  491. Xmodifier it may not be defined again with a recipe using only the `:' operator
  492. Xwith no `:' modifier.  In both cases the use of a `:' modifier creates a new
  493. Xlist of prerequisites and makes it the current prerequisite list for the target.
  494. XThe `:' operator with no recipe always modifies the current list
  495. Xof prerequisites.
  496. XThus assuming each of the following definitions has a recipe attached, then:
  497. X.RS
  498. X.sp
  499. X.nf
  500. Xjoe :  fred ...    (1)
  501. Xjoe :: more ...    (2)
  502. X.sp
  503. Xand
  504. X.sp
  505. Xjoe :: fred ...    (3)
  506. Xjoe :: more ...    (4)
  507. X.sp
  508. X.fi
  509. X.RE
  510. Xare legal and mean:  add the recipe associated with (2), or (4) to the set
  511. Xof recipes for joe, placing them after existing recipes for
  512. Xmaking joe.
  513. XThe constructs:
  514. X.RS
  515. X.sp
  516. X.nf
  517. Xjoe :: fred ...    (5)
  518. Xjoe : more ...    (6)
  519. X.sp
  520. Xand
  521. X.sp
  522. Xjoe : fred ...    (7)
  523. Xjoe : more ...    (8)
  524. X.sp
  525. X.fi
  526. X.RE
  527. Xare errors since we have two sets of perfectly good recipes for
  528. Xmaking the target.
  529. X.PP
  530. X.I prerequisites
  531. Xis a possibly empty list of targets that must be brought up to date before
  532. Xmaking the current target.
  533. X.PP
  534. X.I recipe
  535. Xis a short form and allows the user to specify short rule definitions
  536. Xon a single line.
  537. XIt is taken to be the first recipe line in a larger recipe
  538. Xif additional lines follow the rule definition.
  539. XIf the semi-colon is present but the recipe line is empty (ie. null string)
  540. Xthen it is taken
  541. Xto be an empty rule.  Any target so defined causes the
  542. X.I "Don't know how to make ..."
  543. Xerror message to be suppressed when
  544. X.B dmake
  545. Xtries to make the target and fails.
  546. XThis silence is maintained for rules that are terminated
  547. Xby a semicolon and have no following recipe lines, for targets listed on the
  548. Xcommand line, and for the first target found in the makefile.
  549. X.SH "RECIPES"
  550. XThe traditional format used by most versions of Make defines the recipe
  551. Xlines as arbitrary strings that may contain macro expansions.  They
  552. Xfollow a rule definition line and may be spaced
  553. Xapart by comment or blank lines.
  554. XThe list of recipe lines defining the recipe is terminated by a new target
  555. Xdefinition, a macro definition, or end-of-file.
  556. XEach recipe line
  557. X.B MUST
  558. Xbegin with a \fB<TAB>\fP character which
  559. Xmay optionally be followed with one or all
  560. Xof the characters
  561. X.IR "'@%+\-'" "."
  562. XThe
  563. X.I "'\-'"
  564. Xindicates that non-zero exit values (ie. errors)
  565. Xare to be ignored when this recipe line is executed, the
  566. X.I "'\+'"
  567. Xindicates that the current recipe line is to be executed using the shell, the
  568. X.I "'%'"
  569. Xindicates that
  570. X.B dmake
  571. Xshould swap itself out to secondary storage (MSDOS only) before running the
  572. Xrecipe and the
  573. X.I "'@'"
  574. Xindicates that the recipe line should NOT be echoed to the terminal prior to
  575. Xbeing executed.  Each switch is off by default
  576. X(ie. by default, errors are significant, commands are echoed, no swapping is
  577. Xdone and a shell is
  578. Xused only if the recipe line contains a character found in the value of the
  579. XSHELLMETAS macro).
  580. XGlobal settings activated via command line options or special attribute or
  581. Xtarget names may also affect these settings.
  582. XAn example recipe:
  583. X.sp
  584. X.RS
  585. X.nf
  586. Xtarget :
  587. X\tfirst recipe line
  588. X\tsecond recipe line, executed independently of the first.
  589. X\t@a recipe line that is not echoed
  590. X\t\-and one that has errors ignored
  591. X\t%and one that causes dmake to swap out
  592. X\t\+and one that is executed using a shell.
  593. X.fi
  594. X.RE
  595. X.PP
  596. XThe second and new format of the recipe block begins the block with the
  597. Xcharacter '[' (the open group character) in the last non-white space
  598. Xposition of a line, and terminates the
  599. Xblock with the character ']' (the close group character)
  600. Xin the first non-white space position of a line.
  601. XIn this form each recipe line need not have a leading TAB.  This is
  602. Xcalled a recipe group.  Groups so defined are fed intact as a single
  603. Xunit to a shell for execution whenever the corresponding target needs to
  604. Xbe updated.  If the open group character '[' is preceded
  605. Xby one or all of \-, @ or %
  606. Xthen they apply to the entire group in the same way that they
  607. Xapply to single recipe lines.  You may also specify '+' but it is
  608. Xredundant as a shell is already being used to run the recipe.
  609. XSee the MAKING TARGETS section for a description of how
  610. X.B dmake
  611. Xinvokes recipes.
  612. XHere is an example of a group recipe:
  613. X.sp
  614. X.RS
  615. X.nf
  616. Xtarget :
  617. X[
  618. X\tfirst recipe line
  619. X\tsecond recipe line
  620. X\tall of these recipe lines are fed to a
  621. X\tsingle copy of a shell for execution.
  622. X]
  623. X.fi
  624. X.RE
  625. X.sp
  626. X.SH "TEXT DIVERSIONS"
  627. X.B dmake
  628. Xsupports the notion of text diversions.
  629. XIf a recipe line contains the macro expression
  630. X.RS
  631. X.sp
  632. X$(mktmp[,\fIname_modifier\fP] \fIdata\fP)
  633. X.sp
  634. X.RE
  635. Xthen all text contained in the \fIdata\fP expression is expanded and
  636. Xis written to a new temporary file.  The name of that file is then returned
  637. Xas the value of the macro expansion and is substituted for the text of the
  638. Xmacro expression if no \fIname_modifier\fP is present.
  639. X.PP
  640. X.I data
  641. Xcan be any text and must be separated from the 'mktmp' portion of the
  642. Xmacro name by white-space.  The only restriction on the data text is that
  643. Xit must contain an balanced number of parentheses of the same kind as are
  644. Xused to initiate the $(mktmp ...) expression.  For example:
  645. X.sp
  646. X\t$(mktmp $(XXX))
  647. X.sp
  648. Xis legal and works as expected, but:
  649. X.sp
  650. X\t$(mktmp text (to dump to file)
  651. X.sp
  652. Xis not legal.  You can achieve what you wish by either defining a macro that
  653. Xexpands to '(' or by using {} in the macro expression; like this:
  654. X.sp
  655. X\t${mktmp text (to dump to file}
  656. X.sp
  657. Xwhich works as expected.  Since the temporary file is opened when the
  658. Xmacro containg the text diversion expression is expanded, diversions may
  659. Xnow be nested and any diversions that are created as part of ':=' macro
  660. Xexpansions persist for the duration of the
  661. X.B dmake
  662. Xrun.
  663. XThe diversion text may contain
  664. Xthe same escape codes as those described in the MACROS section.
  665. XThus if the \fIdata\fP text is to contain new lines they must be inserted
  666. Xusing the \\n escape sequence.  For example the expression:
  667. X.RS
  668. X.sp
  669. X.nf
  670. Xall:
  671. X    cat $(mktmp this is a\\n\\
  672. X    test of the text diversion\\n)
  673. X.fi
  674. X.sp
  675. X.RE
  676. Xis replaced by:
  677. X.RS
  678. X.sp
  679. Xcat /tmp/mk12294AA
  680. X.sp
  681. X.RE
  682. Xwhere the temporary file contains two lines both of which are terminated
  683. Xby a new-line.  If the \fIdata\fP text spans multiple lines in the makefile
  684. Xthen each line must be continued via the use of a \\.
  685. XA second more illustrative example generates a response file to an MSDOS
  686. Xlink command:
  687. X.RS
  688. X.sp
  689. X.nf
  690. XOBJ = fred.obj mary.obj joe.obj
  691. Xall : $(OBJ)
  692. X    link @$(mktmp $(^:t"+\\n")\\n)
  693. X.fi
  694. X.sp
  695. X.RE
  696. XThe result of making `all' in the second example is the command:
  697. X.RS
  698. X.sp
  699. Xlink @/tmp/mk02394AA
  700. X.sp
  701. X.RE
  702. Xwhere the temporary file contains:
  703. X.RS
  704. X.sp
  705. X.nf
  706. Xfred.obj+
  707. Xmary.obj+
  708. Xjoe.obj
  709. X.fi
  710. X.sp
  711. X.RE
  712. XThe last line of the file is terminated by a new-line which is inserted
  713. Xdue to the \\n found at the end of the \fIdata\fP string.
  714. X.PP
  715. XIf the optional 
  716. X.I name_modifier
  717. Xis supplied in the diversion expression then the returned value of the 
  718. Xexpression is the expanded value of \fIname_modifier\fP.  Together with
  719. Xthe special macros TMPFILE and USESHELL this can be
  720. Xused to alter the name of the temporary file returned as the result of the
  721. X$(mktmp ...) expansion.
  722. X.PP
  723. XUnder MS-DOS text diversions may be a problem.  Many DOS tools require
  724. Xthat path names which contain directories use the \\ character to delimit
  725. Xthe directories.  Some users however wish to use the '/' to delimit pathnames
  726. Xon their system and use environments that allow them to do so.  These
  727. Xenvironments usually accept the \\ delimited path names as well.
  728. XIn order to allow the user the most flexibility
  729. X.B dmake
  730. Xdefines three macros that can be used when text diversion file names are being
  731. Xplaced into the recipe text to be executed.  The macro TMPFILE contains
  732. Xthe name of the most recently opened temporary file, and
  733. Xthe macro, USESHELL, is set to "yes" if the
  734. Xcurrent recipe is forced to use a shell via the .USESHELL or '+' directives,
  735. Xotherwise its value is "no".
  736. XIn the absence of a \fIname_modifier\fP in the diversion expression the result
  737. Xof expanding the diversion expression is the value of TMPFILE.
  738. XThe
  739. X.B dmake
  740. Xstartup files define the macro DIVFILE whose value is either the
  741. Xvalue of TMPFILE or the value of TMPFILE editted to replace any '/' characters
  742. Xto the appropriate value based on the current shell and whether it will be
  743. Xused to execute the recipe.
  744. X.PP
  745. XPrevious versions of
  746. X.B dmake
  747. Xdefined text diversions using <+, +> strings,
  748. Xwhere <+ started a text diversion and +> terminated one.
  749. X.B dmake
  750. Xis backward compatible with this construct if the <+ and +> appear literally
  751. Xon the same recipe line or in the same macro value string.  In such instances
  752. Xthe expression:
  753. X.sp
  754. X\t<+data text+>
  755. X.sp
  756. Xis mapped to:
  757. X.sp
  758. X\t$(mktmp data text)
  759. X.sp
  760. Xwhich is fully output compatible with the earlier construct.  <+, +>
  761. Xconstructs whose text spans multiple lines must be converted by hand to use
  762. X$(mktmp ...).
  763. X.PP
  764. XIf the environment variable TMPDIR is defined then the
  765. Xtemporary file is placed into the directory specified by that variable.
  766. XA makefile can modify the location of temporary files by
  767. Xdefining a macro named TMPDIR and exporting it using the .EXPORT special
  768. Xtarget.
  769. X.SH "SPECIAL TARGETS"
  770. XThis section describes the special targets that are recognized by \fBdmake\fP.
  771. XSome are affected by attributes and others are not.
  772. X.IP \fB.ERROR\fP 1.4i
  773. XIf defined then the recipe associated with this target is executed
  774. Xwhenever an error condition is detected by \fBdmake\fP.  All attributes that
  775. Xcan be used with any other target may be used with this target.  Any
  776. Xprerequisites of this target will be brought up to date during it's processing.
  777. XNOTE:  errors will be ignored while making this target, in extreme cases this
  778. Xmay cause some problems.
  779. X.IP \fB.EXPORT\fP 1.4i
  780. XAll prerequisites associated with this target are assumed to
  781. Xcorrespond to macro names and they and their values
  782. Xare exported to the environment as environment strings at the point in
  783. Xthe makefile at which this target appears.
  784. XAny attributes specified with this target are ignored.
  785. XOnly macros which have been assigned a value in the makefile prior to the
  786. Xexport directive are exported, macros as yet undefined are not exported.
  787. X.IP \fB.IMPORT\fP 1.4i
  788. XPrerequisite names specified for this target are searched for in the
  789. Xenvironment and defined as macros with their value taken from the environment.
  790. XIf the name cannot be found in the environment an error message is issued.
  791. X\&.IMPORT accepts the .IGNORE attribute.  When given, it causes \fBdmake\fP
  792. Xto ignore the above error.
  793. XSee the MACROS section for a description of the processing of imported macro
  794. Xvalues.
  795. X.IP \fB.INCLUDE\fP 1.4i
  796. XParse another makefile just as if it had been located at the point of the
  797. X\&.INCLUDE in the current makefile.  The list of prerequisites gives the list of
  798. Xmakefiles to try to read.  If the list contains multiple makefiles then they
  799. Xare read in order from left to right.  The following search rules are used
  800. Xwhen trying to locate the file.  If the filename is surrounded by " or just
  801. Xby itself then it is searched for in the current directory.  If it is not
  802. Xfound it is then searched for in each of the directories specified for the
  803. X\&.INCLUDEDIRS special target.  If the file name is surrounded by < and >, (ie.
  804. X<my_spiffy_new_makefile>) then it is searched for only in the directories
  805. Xgiven by the .INCLUDEDIRS special target.  In both cases if the file name is a
  806. Xfully qualified name starting at the root of the file system then it is only
  807. Xsearched for once, and the .INCLUDEDIRS list is ignored.  .INCLUDE accepts
  808. Xthe .IGNORE and .SETDIR attributes.  If .IGNORE attribute is given and the file
  809. Xcannot be found then \fBdmake\fP continues processing,
  810. Xotherwise an error message is generated.
  811. XThe .SETDIR attribute causes
  812. X.B dmake
  813. Xto change directories to the specified directory prior to attempting the
  814. Xinclude operation.
  815. X.IP \fB.INCLUDEDIRS\fP 1.4i
  816. XThe list of prerequisites specified for this target defines the set of
  817. Xdirectories to search when trying to include a makefile.
  818. X.IP \fB.MAKEFILES\fP 1.4i
  819. XThe list of prerequisites is the set of files to try to read as the default
  820. Xmakefile.  By default this target is defined as: 
  821. X.sp
  822. X\t\&.MAKEFILES : makefile.mk Makefile makefile
  823. X.sp
  824. X.IP \fB.SOURCE\fP 1.4i
  825. XThe prerequisite list of this target defines a set of directories to check
  826. Xwhen trying to locate a target file name.  See the section on BINDING of
  827. Xtargets for more information.
  828. X.IP \fB.SOURCE.suff\fP 1.4i
  829. XThe same as .SOURCE, except that the .SOURCE.suff list is searched first when
  830. Xtrying to locate a file matching the a target whose name ends in the suffix
  831. X\&.suff.
  832. X.IP \fB.REMOVE\fP 1.4i
  833. XThe recipe of this target is used whenever \fBdmake\fP needs to remove
  834. Xintermediate targets that were made but do not need to be kept around.
  835. XSuch targets result from the application of transitive closure on the
  836. Xdependency graph.
  837. X.PP
  838. XIn addition to the special targets above,
  839. Xseveral other forms of targets are recognized and are considered special,
  840. Xtheir exact form and use is defined in the sections that follow.
  841. X.SH "SPECIAL MACROS"
  842. X.B dmake
  843. Xdefines a number of special macros.  They are divided into three classes:
  844. Xcontrol macros, run-time macros, and function macros.
  845. XThe control macros are used by
  846. X.B dmake
  847. Xto configure it's actions, and are the preferred method of doing so.
  848. XIn the case when a control macro has the same function as a special 
  849. Xtarget or attribute they share the same name as the special target or
  850. Xattribute.
  851. XThe run-time macros are defined when
  852. X.B dmake
  853. Xmakes targets and may be used by the user inside recipes.
  854. XThe function macros provide higher level functions dealing with macro
  855. Xexpansion and diversion file processing.
  856. X.SH "CONTROL MACROS"
  857. XTo use the control macros simply assign them a value just like any other
  858. Xmacro.  The control macros are divided into three groups:
  859. Xstring valued macros, character valued macros, and boolean valued macros.
  860. X.PP
  861. XThe following are all of the string valued macros.
  862. XThis list is divided into two groups.  The first group gives the string
  863. Xvalued macros that are defined internally and cannot be directly set by the
  864. Xuser.
  865. X.IP \fBDIRBRKSTR\fP 1.4i
  866. XContains the string of chars used to terminate
  867. Xthe name of a directory in a pathname.
  868. XUnder UNIX it's value is "/", under MSDOS it's value is "/\\:".
  869. X.IP \fBINCDEPTH\fP 1.4i
  870. XThis macro's value is a string of digits representing
  871. Xthe current depth of makefile inclusion.
  872. XIn the first makefile level this value is zero.
  873. X.IP \fBMFLAGS\fP 1.4i
  874. XIs the list of flags
  875. Xthat were given on the command line including a leading switch character.
  876. XThe -f flag is not included in this list.
  877. X.IP \fBMAKECMD\fP 1.4i
  878. XIs the name with which \fBdmake\fP was invoked.
  879. X.IP \fBMAKEDIR\fP 1.4i
  880. XIs the full path to the initial directory in which
  881. X.B dmake
  882. Xwas invoked.
  883. X.IP \fBMAKEFILE\fP 1.4i
  884. XContains the string "-f \fImakefile\fP" where, \fImakefile\fP is the name
  885. Xof initial user makefile that was first read.
  886. X.IP \fBMAKEFLAGS\fP 1.4i
  887. XIs the same as $(MFLAGS) but has no leading switch
  888. Xcharacter. (ie. MFLAGS = -$(MAKEFLAGS))
  889. X.IP \fBMAKEMACROS\fP 1.4i
  890. XContains the complete list of macro expressions that were specified on the
  891. Xcommand line.
  892. X.IP \fBMAKETARGETS\fP 1.4i
  893. XContains the name(s) of the target(s), if any, that were
  894. Xspecified on the command line.
  895. X.IP \fBMAXPROCESSLIMIT\fP 1.4i
  896. XIs a numeric string representing the maximum number of processes that 
  897. X\fBdmake\fP can use when making targets using parallel mode.
  898. X.IP \fBNULL\fP 1.4i
  899. XIs permanently defined to be the NULL string.
  900. XThis is useful when comparing a conditional expression to an NULL value.
  901. X.IP \fBPWD\fP 1.4i
  902. XIs the full path to the
  903. Xcurrent directory in which make is executing.
  904. X.IP \fBTMPFILE\fP 1.4i
  905. XIs set to the name of the most recent temporary file opened by \fBdmake\fP.
  906. XTemporary files are used for text diversions and for group recipe processing.
  907. X.IP \fBTMD\fP 1.4i
  908. XStands for "To Make Dir", and
  909. Xis the path from the present directory (value of $(PWD)) to the directory
  910. Xthat \fBdmake\fP was started up in (value of $(MAKEDIR)).
  911. XThis macro is modified when .SETDIR attributes are processed.
  912. X.IP \fBUSESHELL\fP 1.4i
  913. XThe value of this macro is set to "yes" if the current recipe is forced to
  914. Xuse a shell for its execution via the .USESHELL or '+' directives, its value
  915. Xis "no" otherwise.
  916. X.sp
  917. X.PP
  918. XThe second group of string valued macros control
  919. X.B dmake
  920. Xbehavior and may be set by the user.
  921. X.IP \fB.SETDIR\fP 1.6i
  922. XIf this macro is assigned a value then \fBdmake\fP will
  923. Xchange to the directory given by that value before making any targets.  This
  924. Xmacro is equivalent to the .SETDIR attribute.  Thus the two lines:
  925. X.sp
  926. X\&.SETDIR=fred/hello :
  927. X.sp
  928. X\&.SETDIR := fred/hello
  929. X.sp
  930. Xare completely equivalent.  The difference being that the first is processed
  931. Xas a rule definition and the other as a macro.
  932. X.IP \fBAUGMAKE\fP 1.6i
  933. XIf set to a non NULL value will enable the transformation of special
  934. Xmeta targets to support special AUGMAKE inferences.
  935. X.IP \fBDIRSEPSTR\fP 1.6i
  936. XContains the string that is used to separate directory components when
  937. Xpath names are constructed.  It is defined with a default value at startup.
  938. X.IP \fBDIVFILE\fP 1.6i
  939. XIs defined in the startup file and gives the name that should be used for
  940. Xthe diversion file name when specified as the name modifier in
  941. X$(mktmp ...) expansions, see the TEXT DIVERSION section for details.
  942. X.IP \fBGROUPFLAGS\fP 1.6i
  943. XThis macro gives the set of flags to pass to the shell when
  944. Xinvoking it to execute a group recipe.  The value of the macro is the
  945. Xlist of flags with a leading switch indicator.  (ie. `-' under UNIX)
  946. X.IP \fBGROUPSHELL\fP 1.6i
  947. XThis macro defines the full
  948. Xpath to the executable image to be used as the shell when
  949. Xprocessing group recipes.  This macro must be defined if group recipes are
  950. Xused.  It is assigned a default value in the startup makefile.  Under UNIX
  951. Xthis value is /bin/sh.
  952. X.IP \fBGROUPSUFFIX\fP 1.6i
  953. XIf defined, this macro gives the string to use as a suffix
  954. Xwhen creating group recipe files to be handed to the command interpreter.
  955. XFor example, if it is defined as .sh, then all
  956. Xtemporary files created by \fBdmake\fP will end in the suffix .sh.
  957. XUnder MSDOS if you are using command.com as your GROUPSHELL, then this suffix
  958. Xmust be set to .bat in order for group recipes to function correctly.
  959. X.IP \fBMAKE\fP 1.6i
  960. XIs defined in the startup file by default.
  961. XThe string $(MAKE) is recognized when
  962. Xusing the -n option for single line recipes.  Initially this macro is defined
  963. Xto have the value "$(MAKECMD) $(MFLAGS)".
  964. X.IP \fBMAKESTARTUP\fP 1.6i
  965. XThis macro defines the full path to the initial startup
  966. Xmakefile.  Use the \fB-V\fP command line option to discover it's initial
  967. Xvalue.
  968. X.IP \fBMAXLINELENGTH\fP 1.6i
  969. XThis macro defines the maximum size of a single line of
  970. Xmakefile input text.  The size is specified as a number, the default value
  971. Xis defined internally and is shown via the \fB-V\fP option.
  972. XA buffer of this size plus 2 is allocated for reading makefile text.  The
  973. Xbuffer is freed before any targets are made, thereby allowing files containing
  974. Xlong input lines to be processed without consuming memory during the actual
  975. Xmake.
  976. X.IP \fBMAXPROCESS\fP 1.6i
  977. XSpecify the maximum number of child processes to use when making targets.
  978. XThe default value of this macro is "1" and it's value cannot exceed the value
  979. Xof the macro MAXPROCESSLIMIT.  Setting the value of MAXPROCESS on the command
  980. Xline or in the makefile is equivalent to supplying a corresponding value to
  981. Xthe -P flag on the command line.
  982. X.IP \fBPREP\fP 1.6i
  983. XThis macro defines the number of iterations to be expanded
  984. Xautomatically when processing % rule definitions of the form:
  985. X.sp
  986. X% : %.suff
  987. X.sp
  988. XSee the sections on PERCENT(%) RULES for details on how PREP is used.
  989. X.IP \fBSHELL\fP 1.6i
  990. XThis macro defines the full path to the executable
  991. Ximage to be used as the shell when
  992. Xprocessing single line recipes.  This macro must be defined if recipes
  993. Xrequiring the shell for execution are to be used.
  994. XIt is assigned a default value in the startup makefile.
  995. XUnder UNIX this value is /bin/sh.
  996. X.IP \fBSHELLFLAGS\fP 1.6i
  997. XThis macro gives the set of flags to pass to the shell when
  998. Xinvoking it to execute a single line recipe.  The value of the macro is the
  999. Xlist of flags with a leading switch indicator.  (ie. `-' under UNIX)
  1000. X.IP \fBSHELLMETAS\fP 1.6i
  1001. XEach time
  1002. X.B dmake
  1003. Xexecutes a single recipe line (not a group recipe) the line is
  1004. Xsearched for any occurrence of a character defined in the value of SHELLMETAS.
  1005. XIf such a character is found the recipe line is defined to require a shell
  1006. Xto ensure it's correct execution.  In such instances
  1007. Xa shell is used to invoke the recipe line.
  1008. XIf no match is found the recipe line is executed without the use of a shell.
  1009. X.sp
  1010. X.PP
  1011. XThere is only one character valued macro defined by \fBdmake\fP:
  1012. X\fBSWITCHAR\fP contains the switch character used
  1013. SHAR_EOF
  1014. echo "End of part 11"
  1015. echo "File man/dmake.tf is continued in part 12"
  1016. echo "12" > s2_seq_.tmp
  1017. exit 0
  1018.  
  1019.