home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume19 / dmake / part16 < prev    next >
Encoding:
Text File  |  1991-05-11  |  40.4 KB  |  1,007 lines

  1. Newsgroups: comp.sources.misc
  2. From: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  3. Subject:  v19i037:  dmake - dmake version 3.7, Part16/37
  4. Message-ID: <1991May12.001943.9251@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 631a7404276e2c65db69b24d73303b6d
  6. Date: Sun, 12 May 1991 00:19:43 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  10. Posting-number: Volume 19, Issue 37
  11. Archive-name: dmake/part16
  12. Supersedes: dmake-3.6: Volume 15, Issue 52-77
  13.  
  14. ---- Cut Here and feed the following to sh ----
  15. #!/bin/sh
  16. # this is dmake.shar.16 (part 16 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file dmake/man/dmake.p continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 16; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test -f _shar_wnt_.tmp; then
  33. sed 's/^X//' << 'SHAR_EOF' >> 'dmake/man/dmake.p' &&
  34. X                 prerequisites or targets) then the effect is
  35. X                 equivalent to specifying --TT on the command line.
  36. X
  37. X     ..NNOOSSTTAATTEE    Any target with this attribute set will not have
  38. X                 command line flag information stored in the
  39. X                 state file if .KEEP_STATE has been enabled.
  40. X
  41. X     ..PPHHOONNYY      Any target with this attribute set will have its
  42. X                 recipe executed each time the target is made
  43. X                 even if a file matching the target name can be
  44. X                 located.  Any targets that have a .PHONY attri-
  45. X                 buted target as a prerequisite will be made each
  46. X                 time the .PHONY attributed prerequisite is made.
  47. X
  48. X     ..PPRREECCIIOOUUSS   Do not remove associated target under any cir-
  49. X                 cumstances.  Set by default for any targets
  50. X                 whose corresponding files exist in the file sys-
  51. X                 tem prior to the execution of ddmmaakkee.
  52. X
  53. X     ..PPRROOLLOOGG     Insert shell prolog code when executing a group
  54. X                 recipe associated with any target having this
  55. X                 attribute set.
  56. X
  57. X     ..SSEEQQUUEENNTTIIAALL Force a sequential make of the associated
  58. X                 target's prerequisites.
  59. X
  60. X     ..SSEETTDDIIRR     Change current working directory to specified
  61. X                 directory when making the associated target.
  62. X                 You must specify the directory at the time the
  63. X                 attribute is specified.  To do this simply give
  64. X                 _._S_E_T_D_I_R_=_p_a_t_h as the attribute.  _p_a_t_h is expanded
  65. X                 and the result is used as the value of the
  66. X                 directory to change to.  If path is surrounded
  67. X
  68. X
  69. X
  70. Version 3.70                    UW                             10
  71. X
  72. X
  73. X
  74. X
  75. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  76. X
  77. X
  78. X
  79. X                 by single quotes then path is not expanded, and
  80. X                 is used literally as the directory name.  If the
  81. X                 _p_a_t_h contains any `:' characters then the entire
  82. X                 attribute string must be quoted using ".  If a
  83. X                 target having this attribute set also has the
  84. X                 .IGNORE attribute set then if the change to the
  85. X                 specified directory fails it will be ignored,
  86. X                 and no error message will be issued.
  87. X
  88. X     ..SSIILLEENNTT     Do not echo the recipe lines when making any
  89. X                 target with this attribute set, and do not issue
  90. X                 any warnings.
  91. X
  92. X     ..SSWWAAPP       Under MSDOS when making a target with this
  93. X                 attribute set swap the ddmmaakkee executable to disk
  94. X                 prior to executing the recipe line.  Also see
  95. X                 the '%' recipe line flag defined in the RECIPES
  96. X                 section.
  97. X
  98. X     ..SSYYMMBBOOLL     Target is a library member and is an entry point
  99. X                 into a module in the library.  This attribute is
  100. X                 used only when searching a library for a target.
  101. X                 Targets of the form lib((entry)) have this
  102. X                 attribute set automatically.
  103. X
  104. X     ..UUSSEESSHHEELLLL   Force each recipe line of a target to be exe-
  105. X                 cuted using a shell.  Specifying this attribute
  106. X                 is equivalent to specifying the '+' character at
  107. X                 the start of each line of a non-group recipe.
  108. X
  109. X     ..UUPPDDAATTEEAALLLL  Indicates that all the targets listed in this
  110. X                 rule are updated by the execution of the accom-
  111. X                 panying recipe.  A common example is the produc-
  112. X                 tion of the _y_._t_a_b_._c and _y_._t_a_b_._h files by yyaacccc
  113. X                 when it is run on a grammar.  Specifying
  114. X                 .UPDATEALL in such a rule prevents the running
  115. X                 of yacc twice, once for the y.tab.c file and
  116. X                 once for the y.tab.h file.
  117. X
  118. X
  119. X     All attributes are user setable and except for .UPDATEALL,
  120. X     .SETDIR and .MKSARGS may be used in one of two forms.  The
  121. X     .MKSARGS attribute is restricted to use as a global attri-
  122. X     bute, and the use of the .UPDATEALL and .SETDIR attributes
  123. X     is restricted to rules of the second form only.
  124. X
  125. X          ATTRIBUTE_LIST : _t_a_r_g_e_t_s
  126. X
  127. X     assigns the attributes specified by ATTRIBUTE_LIST to each
  128. X     target in _t_a_r_g_e_t_s or
  129. X
  130. X          _t_a_r_g_e_t_s ATTRIBUTE_LIST : ...
  131. X
  132. X
  133. X
  134. Version 3.70                    UW                             11
  135. X
  136. X
  137. X
  138. X
  139. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  140. X
  141. X
  142. X
  143. X     assigns the attributes specified by ATTRIBUTE_LIST to each
  144. X     target in _t_a_r_g_e_t_s_. In the first form if _t_a_r_g_e_t_s is empty
  145. X     (ie. a NULL list), then the list of attributes will apply to
  146. X     all targets in the makefile (this is equivalent to the com-
  147. X     mon Make construct of _"_._I_G_N_O_R_E _:_" but has been modified to
  148. X     the notion of an attribute instead of a special target).
  149. X     Not all of the attributes have global meaning.  In particu-
  150. X     lar, .LIBRARY, .SYMBOL, and .UPDATEALL have no assigned glo-
  151. X     bal meaning.
  152. X
  153. X     Any attribute may be used with any target, even with the
  154. X     special targets.  Some combinations are useless (e.g.
  155. X     .INCLUDE .PRECIOUS: ... ), while others are useful (e.g.
  156. X     .INCLUDE .IGNORE : "file.mk" will not complain if file.mk
  157. X     cannot be found using the include file search rules, see the
  158. X     section on SPECIAL TARGETS for a description of .INCLUDE).
  159. X     If a specified attribute will not be used with the special
  160. X     target a warning is issued and the attribute is ignored.
  161. X
  162. MMAACCRROOSS
  163. X     ddmmaakkee supports six types of macro assignment.
  164. X
  165. X
  166. X     MMAACCRROO == LLIINNEE    This is the most common and familiar form of
  167. X                     macro assignment.  It assigns LINE literally
  168. X                     as the value of MACRO.  Future expansions of
  169. X                     MACRO recursively expand its value.
  170. X
  171. X     MMAACCRROO **== LLIINNEE   This form behaves exactly as the simple '='
  172. X                     form with the exception that if MACRO
  173. X                     already has a value then the assignment is
  174. X                     not performed.
  175. X
  176. X     MMAACCRROO ::== LLIINNEE   This form differs from the simple '=' form
  177. X                     in that it expands LINE prior to assigning
  178. X                     it as the value of MACRO.  Future expansions
  179. X                     of MACRO do not recursively expand its
  180. X                     value.
  181. X
  182. X     MMAACCRROO **::== LLIINNEE  This form behaves exactly as the ':=' form
  183. X                     with the exception that if MACRO already has
  184. X                     a value then the assignment and expansion
  185. X                     are not performed.
  186. X
  187. X     MMAACCRROO ++== LLIINNEE   This form of macro assignment allows macro
  188. X                     values to grow.  It takes the literal value
  189. X                     of LINE and appends it to the previous value
  190. X                     of MACRO separating the two by a single
  191. X                     space.  Future expansions of MACRO recur-
  192. X                     sively expand its value.
  193. X
  194. X
  195. X
  196. X
  197. X
  198. Version 3.70                    UW                             12
  199. X
  200. X
  201. X
  202. X
  203. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  204. X
  205. X
  206. X
  207. X     MMAACCRROO ++::== LLIINNEE  This form is similar to the '+=' form except
  208. X                     that the value of LINE is expanded prior to
  209. X                     being added to the value of MACRO.
  210. X
  211. X     Macro expressions specified on the command line allow the
  212. X     macro value to be redefined within the makefile only if the
  213. X     macro is defined using the '+=' and '+:=' operators.  Other
  214. X     operators will define a macro that cannot be further modi-
  215. X     fied.
  216. X
  217. X     When ddmmaakkee defines a non-environment macro it strips leading
  218. X     and trailing white space from the macro value.  Macros
  219. X     imported from the environment via either the .IMPORT special
  220. X     target (see the SPECIAL TARGETS section), or the --ee, or --EE
  221. X     flags are an exception to this rule.  Their values are
  222. X     always taken literally and white space is never stripped.
  223. X     In addition, named macros defined using the .IMPORT special
  224. X     target do not have their values expanded when they are used
  225. X     within a makefile.  In contrast, environment macros that are
  226. X     imported due to the specification of the --ee or --EE flags are
  227. X     subject to expansion when used.
  228. X
  229. X     To specify a macro expansion enclose the name in () or {}
  230. X     and precede it with a dollar sign $.  Thus $(TEST)
  231. X     represents an expansion of the macro variable named TEST.
  232. X     If TEST is defined then $(TEST) is replaced by its expanded
  233. X     value.  If TEST is not defined then $(TEST) expands to the
  234. X     NULL string (this is equivalent to defining a macro as
  235. X     'TEST=' ).  A short form may be used for single character
  236. X     named macros.  In this case the parentheses are optional,
  237. X     and $(I) is equivalent to $I.  Macro expansion is recursive,
  238. X     hence, if the value string contains an expression represent-
  239. X     ing a macro expansion, the expansion is performed.  Circular
  240. X     macro expansions are detected and cause an error to be
  241. X     issued.
  242. X
  243. X     When defining a macro the given macro name is first expanded
  244. X     before being used to define the macro.  Thus it is possible
  245. X     to define macros whose names depend on values of other mac-
  246. X     ros.  For example, suppose CWD is defined as
  247. X
  248. X          CWD = $(PWD:b)
  249. X
  250. X     then the value of $(CWD) is the name of the current direc-
  251. X     tory.  This can be used to define macros specific to this
  252. X     directory, for example:
  253. X
  254. X          _$(CWD).prt = list of files to print...
  255. X
  256. X     The actual name of the defined macro is a function of the
  257. X     current directory.  A construct such as this is useful when
  258. X     processing a hierarchy of directories using .SETDIR
  259. X
  260. X
  261. X
  262. Version 3.70                    UW                             13
  263. X
  264. X
  265. X
  266. X
  267. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  268. X
  269. X
  270. X
  271. X     attributed targets and a collection of small distributed
  272. X     makefile stubs.
  273. X
  274. X     Macro variables may be defined within the makefile, on the
  275. X     command line, or imported from the environment.
  276. X
  277. X     ddmmaakkee supports several non-standard macro expansions: The
  278. X     first is of the form:
  279. X
  280. X          _$_(_m_a_c_r_o___n_a_m_e_:_m_o_d_i_f_i_e_r___l_i_s_t_:_m_o_d_i_f_i_e_r___l_i_s_t_:_._._._)
  281. X
  282. X     where _m_o_d_i_f_i_e_r___l_i_s_t is chosen from the set { D or d, F or f,
  283. X     B or b, S or s, T or t } and
  284. X
  285. X          d - directory portion of all path names
  286. X          f - file (including suffix) portion of path names
  287. X          b - file (not including suffix) portion of path names
  288. X          s - simple pattern substitution
  289. X          t - tokenization.
  290. X
  291. X     Thus if we have the example:
  292. X
  293. X          test = d1/d2/d3/a.out f.out d1/k.out
  294. X
  295. X     The following macro expansions produce the values on the
  296. X     right of '-->' after expansion.
  297. X
  298. X          $(test:d)            --> d1/d2/d3/ d1/
  299. X          $(test:b)            --> a f k
  300. X          $(test:f)            --> a.out f.out k.out
  301. X          ${test:db}           --> d1/d2/d3/a f d1/k
  302. X          ${test:s/out/in/:f}  --> a.in f.in k.in
  303. X          $(test:f:t"+")       --> a.out+f.out+k.out
  304. X
  305. X     If a token ends in a string composed from the value of the
  306. X     macro DIRBRKSTR (ie. ends in a directory separator string,
  307. X     e.g. '/' in UNIX) and you use the ::dd modifier then the
  308. X     expansion returns the directory name less the final direc-
  309. X     tory separator string.  Thus successive pairs of :d modif-
  310. X     iers each remove a level of directory in the token string.
  311. X
  312. X     The tokenization modifier takes all white space separated
  313. X     tokens from the macro value and separates them by the quoted
  314. X     separator string.  The separator string may contain the fol-
  315. X     lowing escape codes \a => <bel>, \b => <backspace>, \f =>
  316. X     <formfeed>, \n => <nl>, \r => <cr>, \t => <tab>, \v =>
  317. X     <vertical tab>, \" => ", and \xxx => <xxx> where xxx is the
  318. X     octal representation of a character.  Thus the expansion:
  319. X
  320. X          $(test:f:t"+\n")
  321. X     produces:
  322. X          a.out+
  323. X
  324. X
  325. X
  326. Version 3.70                    UW                             14
  327. X
  328. X
  329. X
  330. X
  331. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  332. X
  333. X
  334. X
  335. X          f.out+
  336. X          k.out
  337. X
  338. X     The second non-standard form of macro expansion allows for
  339. X     recursive macros.  It is possible to specify a $(_m_a_c_r_o___n_a_m_e)
  340. X     or ${_m_a_c_r_o___n_a_m_e} expansion where _m_a_c_r_o___n_a_m_e contains more $(
  341. X     ... ) or ${ ... } macro expansions itself.
  342. X
  343. X     For example $(CC$(_HOST)$(_COMPILER)) will first expand
  344. X     CC$(_HOST)$(_COMPILER) to get a result and use that result
  345. X     as the name of the macro to expand.  This is useful for
  346. X     writing a makefile for more than one target environment.  As
  347. X     an example consider the following hypothetical case. Suppose
  348. X     that _HOST and _COMPILER are imported from the environment
  349. X     and are set to represent the host machine type and the host
  350. X     compiler respectively.
  351. X
  352. X          CFLAGS_VAX_CC = -c -O    # _HOST == "_VAX", _COMPILER == "_CC"
  353. X          CFLAGS_PC_MSC = -c -ML   # _HOST == "_PC",  _COMPILER == "_MSC"
  354. X
  355. X          # redefine CFLAGS macro as:
  356. X
  357. X          CFLAGS := $(CFLAGS$(_HOST)$(_COMPILER))
  358. X
  359. X     This causes CFLAGS to take on a value that corresponds to
  360. X     the environment in which the make is being invoked.
  361. X
  362. X     The final non-standard macro expansion is of the form:
  363. X
  364. X          string1{token_list}string2
  365. X
  366. X     where string1, string2 and token_list are expanded.  After
  367. X     expansion, string1 is prepended to each token found in
  368. X     token_list and string2 is appended to each resulting token
  369. X     from the previous prepend.  string1 and string2 are not del-
  370. X     imited by white space whereas the tokens in token_list are.
  371. X     A null token in the token list is specified using "".  Thus
  372. X     using another example we have:
  373. X
  374. X          test/{f1 f2}.o     --> test/f1.o test/f2.o
  375. X          test/ {f1 f2}.o    --> test/ f1.o f2.o
  376. X          test/{f1 f2} .o    --> test/f1 test/f2 .o
  377. X          test/{"f1"  ""}.o  --> test/f1.o test/.o
  378. X
  379. X          and
  380. X
  381. X          test/{d1 d2}/{f1 f2}.o --> test/d1/f1.o test/d1/f2.o
  382. X                                     test/d2/f1.o test/d2/f2.o
  383. X
  384. X     This last expansion is activated only when the first charac-
  385. X     ters of _t_o_k_e_n___l_i_s_t appear immediately after the opening '{'
  386. X     with no intervening white space.  The reason for this
  387. X
  388. X
  389. X
  390. Version 3.70                    UW                             15
  391. X
  392. X
  393. X
  394. X
  395. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  396. X
  397. X
  398. X
  399. X     restriction is the following incompatibility with Bourne
  400. X     Shell recipes.  The line
  401. X
  402. X          { echo hello;}
  403. X
  404. X     is valid /bin/sh syntax; while
  405. X
  406. X          {echo hello;}
  407. X
  408. X     is not.  Hence the latter triggers the enhanced macro expan-
  409. X     sion while the former causes it to be suppressed.  See the
  410. X     SPECIAL MACROS section for a description of the special mac-
  411. X     ros that ddmmaakkee defines and understands.
  412. X
  413. RRUULLEESS AANNDD TTAARRGGEETTSS
  414. X     A makefile contains a series of entries that specify depen-
  415. X     dencies.  Such entries are called _t_a_r_g_e_t_/_p_r_e_r_e_q_u_i_s_i_t_e or
  416. X     _r_u_l_e definitions.  Each rule definition is optionally fol-
  417. X     lowed by a set of lines that provide a recipe for updating
  418. X     any targets defined by the rule.  Whenever ddmmaakkee attempts to
  419. X     bring a target up to date and an explicit recipe is provided
  420. X     with a rule defining the target, that recipe is used to
  421. X     update the target.  A rule definition begins with a line
  422. X     having the following syntax:
  423. X
  424. X          _<_t_a_r_g_e_t_s_> [_<_a_t_t_r_i_b_u_t_e_s_>] _<_r_u_l_e_o_p_> [_<_p_r_e_r_e_q_u_i_s_i_t_e_s_>] [;_<_r_e_c_i_p_e_>]
  425. X
  426. X     _t_a_r_g_e_t_s is a non-empty list of targets.  If the target is a
  427. X     special target (see SPECIAL TARGETS section below) then it
  428. X     must appear alone on the rule line.  For example:
  429. X
  430. X          .IMPORT .ERROR : ...
  431. X
  432. X     is not allowed since both .IMPORT and .ERROR are special
  433. X     targets.  Special targets are not used in the construction
  434. X     of the dependency graph and will not be made.
  435. X
  436. X     _a_t_t_r_i_b_u_t_e_s is a possibly empty list of attributes.  Any
  437. X     attribute defined in the ATTRIBUTES section above may be
  438. X     specified.  All attributes will be applied to the list of
  439. X     named targets in the rule definition.  No other targets will
  440. X     be affected.
  441. X
  442. X
  443. X     NOTE:   As stated earlier, if both the target list and
  444. X             prerequisite list are empty but the attributes list
  445. X             is not, then the specified attributes affect all
  446. X             targets in the makefile.
  447. X
  448. X
  449. X     _r_u_l_e_o_p is a separator which is used to identify the targets
  450. X     from the prerequisites.  Optionally it also provides a
  451. X
  452. X
  453. X
  454. Version 3.70                    UW                             16
  455. X
  456. X
  457. X
  458. X
  459. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  460. X
  461. X
  462. X
  463. X     facility for modifying the way in which ddmmaakkee handles the
  464. X     making of the associated targets.  In its simplest form the
  465. X     operator is a single ':', and need not be separated by white
  466. X     space from its neighboring tokens.  It may additionally be
  467. X     followed by any of the modifiers { !, ^, -, : }, where:
  468. X
  469. X
  470. X     !!    says execute the recipe for the associated targets once
  471. X          for each out of date prerequisite.  Ordinarily the
  472. X          recipe is executed once for all out of date prere-
  473. X          quisites at the same time.
  474. X
  475. X     ^^    says to insert the specified prerequisites, if any,
  476. X          before any other prerequisites already associated with
  477. X          the specified targets.  In general, it is not useful to
  478. X          specify ^ with an empty list of prerequisites.
  479. X
  480. X     --    says to clear the previous list of prerequisites before
  481. X          adding the new prerequisites.  Thus,
  482. X
  483. X               .SUFFIXES :
  484. X               .SUFFIXES : .a .b
  485. X
  486. X          can be replaced by
  487. X
  488. X               .SUFFIXES :- .a .b
  489. X
  490. X          however the old form still works as expected.  NOTE:
  491. X          .SUFFIXES is ignored by ddmmaakkee it is used here simply as
  492. X          an example.
  493. X
  494. X     ::    When the rule operator is not modified by a second ':'
  495. X          only one set of rules may be specified for making a
  496. X          target.  Multiple definitions may be used to add to the
  497. X          list of prerequisites that a target depends on.  How-
  498. X          ever, if a target is multiply defined only one defini-
  499. X          tion may specify a recipe for making the target.
  500. X
  501. X          When a target's rule operator is modified by a second
  502. X          ':' (:: for example) then this definition may not be
  503. X          the only definition with a recipe for the target.
  504. X          There may be other :: target definition lines that
  505. X          specify a different set of prerequisites with a dif-
  506. X          ferent recipe for updating the target. Any such target
  507. X          is made if any of the definitions find it to be out of
  508. X          date with respect to the related prerequisites and the
  509. X          corresponding recipe is used to update the target.
  510. X
  511. X          In the following simple example, each rule has a `::'
  512. X          _r_u_l_e_o_p.  In such an operator we call the first `:' the
  513. X          operator, and the second `:' the modifier.
  514. X
  515. X
  516. X
  517. X
  518. Version 3.70                    UW                             17
  519. X
  520. X
  521. X
  522. X
  523. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  524. X
  525. X
  526. X
  527. X          a.o :: a.c b.h
  528. X             first recipe for making a.o
  529. X
  530. X          a.o :: a.y b.h
  531. X             second recipe for making a.o
  532. X
  533. X          If a.o is found to be out of date with respect to a.c
  534. X          then the first recipe is used to make a.o.  If it is
  535. X          found out of date with respect to a.y then the second
  536. X          recipe is used.  If a.o is out of date with respect to
  537. X          b.h then both recipes are invoked to make a.o.  In the
  538. X          last case the order of invocation corresponds to the
  539. X          order in which the rule definitions appear in the
  540. X          makefile.
  541. X
  542. X     Targets defined using a single `:' operator with a recipe
  543. X     may be redefined again with a new recipe by using a `:'
  544. X     operator with a `:' modifier.  This is equivalent to a tar-
  545. X     get having been initially defined with a rule using a `:'
  546. X     modifier.  Once a target is defined using a `:' modifier it
  547. X     may not be defined again with a recipe using only the `:'
  548. X     operator with no `:' modifier.  In both cases the use of a
  549. X     `:' modifier creates a new list of prerequisites and makes
  550. X     it the current prerequisite list for the target.  The `:'
  551. X     operator with no recipe always modifies the current list of
  552. X     prerequisites.  Thus assuming each of the following defini-
  553. X     tions has a recipe attached, then:
  554. X
  555. X          joe :  fred ...     (1)
  556. X          joe :: more ...     (2)
  557. X
  558. X          and
  559. X
  560. X          joe :: fred ...     (3)
  561. X          joe :: more ...     (4)
  562. X
  563. X     are legal and mean:  add the recipe associated with (2), or
  564. X     (4) to the set of recipes for joe, placing them after exist-
  565. X     ing recipes for making joe.  The constructs:
  566. X
  567. X          joe :: fred ...     (5)
  568. X          joe : more ... (6)
  569. X
  570. X          and
  571. X
  572. X          joe : fred ... (7)
  573. X          joe : more ... (8)
  574. X
  575. X     are errors since we have two sets of perfectly good recipes
  576. X     for making the target.
  577. X
  578. X
  579. X
  580. X
  581. X
  582. Version 3.70                    UW                             18
  583. X
  584. X
  585. X
  586. X
  587. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  588. X
  589. X
  590. X
  591. X     _p_r_e_r_e_q_u_i_s_i_t_e_s is a possibly empty list of targets that must
  592. X     be brought up to date before making the current target.
  593. X
  594. X     _r_e_c_i_p_e is a short form and allows the user to specify short
  595. X     rule definitions on a single line.  It is taken to be the
  596. X     first recipe line in a larger recipe if additional lines
  597. X     follow the rule definition.  If the semi-colon is present
  598. X     but the recipe line is empty (ie. null string) then it is
  599. X     taken to be an empty rule.  Any target so defined causes the
  600. X     _D_o_n_'_t _k_n_o_w _h_o_w _t_o _m_a_k_e _._._. error message to be suppressed
  601. X     when ddmmaakkee tries to make the target and fails.  This silence
  602. X     is maintained for rules that are terminated by a semicolon
  603. X     and have no following recipe lines, for targets listed on
  604. X     the command line, for the first target found in the
  605. X     makefile, and for any target having no recipe but containing
  606. X     a list of prerequisites (see the COMPATIBILITY section for
  607. X     an exception to this rule if the AUGMAKE (--AA) flag was
  608. X     specified.
  609. X
  610. RREECCIIPPEESS
  611. X     The traditional format used by most versions of Make defines
  612. X     the recipe lines as arbitrary strings that may contain macro
  613. X     expansions.  They follow a rule definition line and may be
  614. X     spaced apart by comment or blank lines.  The list of recipe
  615. X     lines defining the recipe is terminated by a new target
  616. X     definition, a macro definition, or end-of-file.  Each recipe
  617. X     line MMUUSSTT begin with a <<TTAABB>> character which may optionally
  618. X     be followed with one or all of the characters _'_@_%_+_-_'.  The
  619. X     _'_-_' indicates that non-zero exit values (ie. errors) are to
  620. X     be ignored when this recipe line is executed, the _'_+_' indi-
  621. X     cates that the current recipe line is to be executed using
  622. X     the shell, the _'_%_' indicates that ddmmaakkee should swap itself
  623. X     out to secondary storage (MSDOS only) before running the
  624. X     recipe and the _'_@_' indicates that the recipe line should NOT
  625. X     be echoed to the terminal prior to being executed.  Each
  626. X     switch is off by default (ie. by default, errors are signi-
  627. X     ficant, commands are echoed, no swapping is done and a shell
  628. X     is used only if the recipe line contains a character found
  629. X     in the value of the SHELLMETAS macro).  Global settings
  630. X     activated via command line options or special attribute or
  631. X     target names may also affect these settings.  An example
  632. X     recipe:
  633. X
  634. X          target :
  635. X               first recipe line
  636. X               second recipe line, executed independently of the first.
  637. X               @a recipe line that is not echoed
  638. X               -and one that has errors ignored
  639. X               %and one that causes dmake to swap out
  640. X               +and one that is executed using a shell.
  641. X
  642. X
  643. X
  644. X
  645. X
  646. Version 3.70                    UW                             19
  647. X
  648. X
  649. X
  650. X
  651. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  652. X
  653. X
  654. X
  655. X     The second and new format of the recipe block begins the
  656. X     block with the character '[' (the open group character) in
  657. X     the last non-white space position of a line, and terminates
  658. X     the block with the character ']' (the close group character)
  659. X     in the first non-white space position of a line.  In this
  660. X     form each recipe line need not have a leading TAB.  This is
  661. X     called a recipe group.  Groups so defined are fed intact as
  662. X     a single unit to a shell for execution whenever the
  663. X     corresponding target needs to be updated.  If the open group
  664. X     character '[' is preceded by one or all of -, @ or % then
  665. X     they apply to the entire group in the same way that they
  666. X     apply to single recipe lines.  You may also specify '+' but
  667. X     it is redundant as a shell is already being used to run the
  668. X     recipe.  See the MAKING TARGETS section for a description of
  669. X     how ddmmaakkee invokes recipes.  Here is an example of a group
  670. X     recipe:
  671. X
  672. X          target :
  673. X          [
  674. X               first recipe line
  675. X               second recipe line
  676. X               all of these recipe lines are fed to a
  677. X               single copy of a shell for execution.
  678. X          ]
  679. X
  680. X
  681. TTEEXXTT DDIIVVEERRSSIIOONNSS
  682. X     ddmmaakkee supports the notion of text diversions.  If a recipe
  683. X     line contains the macro expression
  684. X
  685. X          $(mktmp[,[_f_i_l_e][,_t_e_x_t]] _d_a_t_a)
  686. X
  687. X     then all text contained in the _d_a_t_a expression is expanded
  688. X     and is written to a temporary file.  The return value of the
  689. X     macro is the name of the temporary file.
  690. X
  691. X     _d_a_t_a can be any text and must be separated from the 'mktmp'
  692. X     portion of the macro name by white-space.  The only restric-
  693. X     tion on the data text is that it must contain a balanced
  694. X     number of parentheses of the same kind as are used to ini-
  695. X     tiate the $(mktmp ...) expression.  For example:
  696. X
  697. X          $(mktmp $(XXX))
  698. X
  699. X     is legal and works as expected, but:
  700. X
  701. X          $(mktmp text (to dump to file)
  702. X
  703. X     is not legal.  You can achieve what you wish by either
  704. X     defining a macro that expands to '(' or by using {} in the
  705. X     macro expression; like this:
  706. X
  707. X
  708. X
  709. X
  710. Version 3.70                    UW                             20
  711. X
  712. X
  713. X
  714. X
  715. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  716. X
  717. X
  718. X
  719. X          ${mktmp text (to dump to file}
  720. X
  721. X     Since the temporary file is opened when the macro containing
  722. X     the text diversion expression is expanded, diversions may
  723. X     now be nested and any diversions that are created as part of
  724. X     ':=' macro expansions persist for the duration of the ddmmaakkee
  725. X     run.  The diversion text may contain the same escape codes
  726. X     as those described in the MACROS section.  Thus if the _d_a_t_a
  727. X     text is to contain new lines they must be inserted using the
  728. X     \n escape sequence.  For example the expression:
  729. X
  730. X          all:
  731. X               cat $(mktmp this is a\n\
  732. X               test of the text diversion\n)
  733. X
  734. X     is replaced by:
  735. X
  736. X          cat /tmp/mk12294AA
  737. X
  738. X     where the temporary file contains two lines both of which
  739. X     are terminated by a new-line.  If the _d_a_t_a text spans multi-
  740. X     ple lines in the makefile then each line must be continued
  741. X     via the use of a \.  A second more illustrative example gen-
  742. X     erates a response file to an MSDOS link command:
  743. X
  744. X          OBJ = fred.obj mary.obj joe.obj
  745. X          all : $(OBJ)
  746. X               link @$(mktmp $(^:t"+\n")\n)
  747. X
  748. X     The result of making `all' in the second example is the com-
  749. X     mand:
  750. X
  751. X          link @/tmp/mk02394AA
  752. X
  753. X     where the temporary file contains:
  754. X
  755. X          fred.obj+
  756. X          mary.obj+
  757. X          joe.obj
  758. X
  759. X     The last line of the file is terminated by a new-line which
  760. X     is inserted due to the \n found at the end of the _d_a_t_a
  761. X     string.
  762. X
  763. X     If the optional _f_i_l_e specifier is present then its expanded
  764. X     value is the name of the temporary file to create.  Whenever
  765. X     a $(mktmp ...) macro is expanded the macro $(TMPFILE) is set
  766. X     to a new temporary file name.  Thus the construct:
  767. X
  768. X          $(mktmp,$(TMPFILE) data)
  769. X
  770. X     is completely equivalent to not specifying the $(TMPFILE)
  771. X
  772. X
  773. X
  774. Version 3.70                    UW                             21
  775. X
  776. X
  777. X
  778. X
  779. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  780. X
  781. X
  782. X
  783. X     optional argument.  Another example that would be useful for
  784. X     MSDOS users with a Turbo-C compiler
  785. X
  786. X          $(mktmp,turboc.cfg $(CFLAGS))
  787. X
  788. X     will place the contents of CFLAGS into a local _t_u_r_b_o_c_._c_f_g
  789. X     file.  The second optional argument, _t_e_x_t, if present alters
  790. X     the name of the value returned by the $(mktmp ...) macro.
  791. X
  792. X     Under MS-DOS text diversions may be a problem.  Many DOS
  793. X     tools require that path names which contain directories use
  794. X     the \ character to delimit the directories.  Some users how-
  795. X     ever wish to use the '/' to delimit pathnames and use
  796. X     environments that allow them to do so.  The macro USESHELL
  797. X     is set to "yes" if the current recipe is forced to use a
  798. X     shell via the .USESHELL or '+' directives, otherwise its
  799. X     value is "no".  The ddmmaakkee startup files define the macro
  800. X     DIVFILE whose value is either the value of TMPFILE or the
  801. X     value of TMPFILE edited to replace any '/' characters to the
  802. X     appropriate value based on the current shell and whether it
  803. X     will be used to execute the recipe.
  804. X
  805. X     Previous versions of ddmmaakkee defined text diversions using <+,
  806. X     +> strings, where <+ started a text diversion and +> ter-
  807. X     minated one.  ddmmaakkee is backward compatible with this con-
  808. X     struct if the <+ and +> appear literally on the same recipe
  809. X     line or in the same macro value string.  In such instances
  810. X     the expression:
  811. X
  812. X          <+data+>
  813. X
  814. X     is mapped to:
  815. X
  816. X          $(mktmp data)
  817. X
  818. X     which is fully output compatible with the earlier construct.
  819. X     <+, +> constructs whose text spans multiple lines must be
  820. X     converted by hand to use $(mktmp ...).
  821. X
  822. X     If the environment variable TMPDIR is defined then the tem-
  823. X     porary file is placed into the directory specified by that
  824. X     variable.  A makefile can modify the location of temporary
  825. X     files by defining a macro named TMPDIR and exporting it
  826. X     using the .EXPORT special target.
  827. X
  828. SSPPEECCIIAALL TTAARRGGEETTSS
  829. X     This section describes the special targets that are recog-
  830. X     nized by ddmmaakkee.  Some are affected by attributes and others
  831. X     are not.
  832. X
  833. X     ..EERRRROORR        If defined then the recipe associated with
  834. X                   this target is executed whenever an error
  835. X
  836. X
  837. X
  838. Version 3.70                    UW                             22
  839. X
  840. X
  841. X
  842. X
  843. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  844. X
  845. X
  846. X
  847. X                   condition is detected by ddmmaakkee.  All attri-
  848. X                   butes that can be used with any other target
  849. X                   may be used with this target.  Any prere-
  850. X                   quisites of this target will be brought up to
  851. X                   date during its processing.  NOTE:  errors
  852. X                   will be ignored while making this target, in
  853. X                   extreme cases this may cause some problems.
  854. X
  855. X     ..EEXXPPOORRTT       All prerequisites associated with this target
  856. X                   are assumed to correspond to macro names and
  857. X                   they and their values are exported to the
  858. X                   environment as environment strings at the
  859. X                   point in the makefile at which this target
  860. X                   appears.  Any attributes specified with this
  861. X                   target are ignored.  Only macros which have
  862. X                   been assigned a value in the makefile prior to
  863. X                   the export directive are exported, macros as
  864. X                   yet undefined are not exported.
  865. X
  866. X     ..IIMMPPOORRTT       Prerequisite names specified for this target
  867. X                   are searched for in the environment and
  868. X                   defined as macros with their value taken from
  869. X                   the environment.  If the special name ..EEVVEERRYY----
  870. X                   TTHHIINNGG is used as a prerequisite name then all
  871. X                   environment variables defined in the environ-
  872. X                   ment are imported.  The functionality of the
  873. X                   --ee flag can be forced by placing the construct
  874. X                   _._I_M_P_O_R_T _: _._E_V_E_R_Y_T_H_I_N_G at the start of a
  875. X                   makefile.  Similarly, by placing the construct
  876. X                   at the end, one can emulate the effect of the
  877. X                   --EE command line flag.  If a prerequisite name
  878. X                   cannot be found in the environment an error
  879. X                   message is issued.  .IMPORT accepts the
  880. X                   .IGNORE attribute.  When given, it causes
  881. X                   ddmmaakkee to ignore the above error.  See the MAC-
  882. X                   ROS section for a description of the process-
  883. X                   ing of imported macro values.
  884. X
  885. X     ..IINNCCLLUUDDEE      Parse another makefile just as if it had been
  886. X                   located at the point of the .INCLUDE in the
  887. X                   current makefile.  The list of prerequisites
  888. X                   gives the list of makefiles to try to read.
  889. X                   If the list contains multiple makefiles then
  890. X                   they are read in order from left to right.
  891. X                   The following search rules are used when try-
  892. X                   ing to locate the file.  If the filename is
  893. X                   surrounded by " or just by itself then it is
  894. X                   searched for in the current directory.  If it
  895. X                   is not found it is then searched for in each
  896. X                   of the directories specified for the .INCLU-
  897. X                   DEDIRS special target.  If the file name is
  898. X                   surrounded by < and >, (ie.
  899. X
  900. X
  901. X
  902. Version 3.70                    UW                             23
  903. X
  904. X
  905. X
  906. X
  907. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  908. X
  909. X
  910. X
  911. X                   <my_spiffy_new_makefile>) then it is searched
  912. X                   for only in the directories given by the
  913. X                   .INCLUDEDIRS special target.  In both cases if
  914. X                   the file name is a fully qualified name start-
  915. X                   ing at the root of the file system then it is
  916. X                   only searched for once, and the .INCLUDEDIRS
  917. X                   list is ignored.  .INCLUDE accepts the .IGNORE
  918. X                   and .SETDIR attributes.  If .IGNORE attribute
  919. X                   is given and the file cannot be found then
  920. X                   ddmmaakkee continues processing, otherwise an error
  921. X                   message is generated.  The .SETDIR attribute
  922. X                   causes ddmmaakkee to change directories to the
  923. X                   specified directory prior to attempting the
  924. X                   include operation.
  925. X
  926. X     ..IINNCCLLUUDDEEDDIIRRSS  The list of prerequisites specified for this
  927. X                   target defines the set of directories to
  928. X                   search when trying to include a makefile.
  929. X
  930. X     ..KKEEEEPP__SSTTAATTEE   This special target is a synonym for the macro
  931. X                   definition
  932. X
  933. X                        .KEEP_STATE := _state.mk
  934. X
  935. X                   It's effect is to turn on STATE keeping and to
  936. X                   define ___s_t_a_t_e_._m_k as the state file.
  937. X
  938. X     ..MMAAKKEEFFIILLEESS    The list of prerequisites is the set of files
  939. X                   to try to read as the default makefile.  By
  940. X                   default this target is defined as:
  941. X
  942. X                        .MAKEFILES : makefile.mk Makefile
  943. X                   makefile
  944. X
  945. X
  946. X     ..SSOOUURRCCEE       The prerequisite list of this target defines a
  947. X                   set of directories to check when trying to
  948. X                   locate a target file name.  See the section on
  949. X                   BINDING of targets for more information.
  950. X
  951. X     ..SSOOUURRCCEE..ssuuffff  The same as .SOURCE, except that the
  952. X                   .SOURCE.suff list is searched first when try-
  953. X                   ing to locate a file matching the a target
  954. X                   whose name ends in the suffix .suff.
  955. X
  956. X     ..RREEMMOOVVEE       The recipe of this target is used whenever
  957. X                   ddmmaakkee needs to remove intermediate targets
  958. X                   that were made but do not need to be kept
  959. X                   around.  Such targets result from the applica-
  960. X                   tion of transitive closure on the dependency
  961. X                   graph.
  962. X
  963. X
  964. X
  965. X
  966. Version 3.70                    UW                             24
  967. X
  968. X
  969. X
  970. X
  971. DMAKE(p)             Unsupported Free Software            DMAKE(p)
  972. X
  973. X
  974. X
  975. X     In addition to the special targets above, several other
  976. X     forms of targets are recognized and are considered special,
  977. X     their exact form and use is defined in the sections that
  978. X     follow.
  979. X
  980. SSPPEECCIIAALL MMAACCRROOSS
  981. X     ddmmaakkee defines a number of special macros.  They are divided
  982. X     into three classes: control macros, run-time macros, and
  983. X     function macros.  The control macros are used by ddmmaakkee to
  984. X     configure its actions, and are the preferred method of doing
  985. X     so.  In the case when a control macro has the same function
  986. X     as a special target or attribute they share the same name as
  987. X     the special target or attribute.  The run-time macros are
  988. X     defined when ddmmaakkee makes targets and may be used by the user
  989. X     inside recipes.  The function macros provide higher level
  990. X     functions dealing with macro expansion and diversion file
  991. X     processing.
  992. X
  993. CCOONNTTRROOLL MMAACCRROOSS
  994. SHAR_EOF
  995. true || echo 'restore of dmake/man/dmake.p failed'
  996. fi
  997. echo 'End of part 16, continue with part 17'
  998. echo 17 > _shar_seq_.tmp
  999. exit 0
  1000.  
  1001. exit 0 # Just in case...
  1002. -- 
  1003. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1004. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1005. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1006. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1007.