home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume19 / dmake / part01 next >
Encoding:
Text File  |  1991-05-10  |  41.7 KB  |  1,327 lines

  1. Newsgroups: comp.sources.misc
  2. From: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  3. Subject:  v19i022:  dmake - dmake version 3.7, Part01/37
  4. Message-ID: <1991May9.192530.23317@sparky.IMD.Sterling.COM>
  5. Date: Thu, 9 May 1991 19:25:30 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7.  
  8. Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
  9. Posting-number: Volume 19, Issue 22
  10. Archive-name: dmake/part01
  11. Supersedes: dmake-3.6: Volume 15, Issue 52-77
  12.  
  13. This is the DMAKE version 3.7 distribution.  DMAKE is a Make like tool that
  14. has been written by me and has been used by individuals at the University of
  15. Waterloo.  This release replaces the previous version 3.6 release which is no
  16. longer supported.  Please read the file 'readme/release' which accompanies
  17. this distribution and describes details of this release (This note is found
  18. in readme/cover).
  19.  
  20. dmake is different from other versions of make in that it supports significant
  21. enhancements (See the man page).  A short summary of the more important
  22. ones follows:
  23.  
  24.         . support for portable makefiles
  25.         . runs on many platforms (DOS, generic unix [sysv and bsd4.3],
  26.           apollo, OS/2, Atari, and many others)
  27.         . significantly enhanced macro facilities
  28.         . transitive closure on inference graph
  29.         . sophisticated inference algorithm
  30.         . support for traversing the file sytem both during making of targets
  31.           and during inference
  32.         . %-meta rules for specifying rules to be used for inferring
  33.           prerequisites
  34.         . highly configurable
  35.         . support for libraries
  36.         . parallel making of targets on architectures that support it
  37.         . attributed targets
  38.         . text diversions
  39.         . group recipes
  40.         . swapping itself to DISK under MSDOS
  41.         . supports MKS extended argument passing convention
  42.  
  43. All code found in this distribution is original and written by me except where
  44. noted in the source and the following:
  45.  
  46. - dbug/dbug package from Fred Fish  (dmake DEBUG=1, to make a debugging version
  47.   of dmake)
  48.  
  49. - malloc.c package in dbug/malloc from the NET, see the directory for
  50.   attribution.
  51.  
  52. -dennis
  53. ---- Cut Here and feed the following to sh ----
  54. #!/bin/sh
  55. # This is a shell archive (produced by shar 3.49)
  56. # To extract the files from this archive, save it to a file, remove
  57. # everything above the "!/bin/sh" line above, and type "sh file_name".
  58. #
  59. # made 05/07/1991 17:29 UTC by dvadura@watmsg
  60. # Source directory /u2/dvadura/t/dmake
  61. #
  62. # existing files will NOT be overwritten unless -c is specified
  63. #
  64. # This is part 1 of a multipart archive                                    
  65. # do not concatenate these parts, unpack them in order with /bin/sh        
  66. #
  67. # This shar contains:
  68. # length  mode       name
  69. # ------ ---------- ------------------------------------------
  70. #   7454 -rw-r----- dmake/_install
  71. #   1357 -rw-r----- dmake/_state.mk
  72. #   2243 -rw-r----- dmake/alloc.h
  73. #   1749 -rw-r----- dmake/basename.c
  74. #  13797 -rw-r----- dmake/dag.c
  75. #   2696 -rw-r----- dmake/db.h
  76. #    460 -rw-r----- dmake/dbug/README
  77. #   1955 -rw-r----- dmake/dbug/dbug.mk
  78. #  44504 -rw-r----- dmake/dbug/dbug/dbug.c
  79. #   6259 -rw-r----- dmake/dbug/dbug/dbug.h
  80. #  42893 -rw-r-x--- dmake/dbug/dbug/dbug.p
  81. #    106 -rw-r----- dmake/dbug/getwd.c
  82. #   1365 -rw-r----- dmake/dbug/malloc/Makefile
  83. #    369 -rw-r----- dmake/dbug/malloc/_changes
  84. #   4758 -rw-r----- dmake/dbug/malloc/_readme
  85. #   1481 -rw-r----- dmake/dbug/malloc/calloc.c
  86. #   2628 -rw-r----- dmake/dbug/malloc/debug.h
  87. #   3179 -rw-r----- dmake/dbug/malloc/dump.c
  88. #   4513 -rw-r----- dmake/dbug/malloc/free.c
  89. #   2022 -rw-r----- dmake/dbug/malloc/m_init.c
  90. #   1973 -rw-r----- dmake/dbug/malloc/m_perror.c
  91. #   6712 -rw-r----- dmake/dbug/malloc/malloc.3
  92. #  12765 -rw-r----- dmake/dbug/malloc/malloc.c
  93. #   2487 -rw-r----- dmake/dbug/malloc/malloc.h
  94. #   2281 -rw-r----- dmake/dbug/malloc/mallopt.c
  95. #   3505 -rw-r----- dmake/dbug/malloc/memory.c
  96. #   6308 -rw-r----- dmake/dbug/malloc/mlc_chk.c
  97. #   3449 -rw-r----- dmake/dbug/malloc/mlc_chn.c
  98. #      2 -rw-r----- dmake/dbug/malloc/patchlevel
  99. #   4659 -rw-r----- dmake/dbug/malloc/realloc.c
  100. #   9382 -rw-r----- dmake/dbug/malloc/string.c
  101. #  20192 -rw-r----- dmake/dbug/malloc/testmem.c
  102. #   3971 -rw-r----- dmake/dbug/malloc/testmlc.c
  103. #   2716 -rw-r----- dmake/dbug/malloc/tostring.c
  104. #    491 -rw-r----- dmake/dbug/malloc/tostring.h
  105. #  20025 -rw-r----- dmake/dmake.c
  106. #   8165 -rw-r----- dmake/dmake.h
  107. #   5857 -rw-r----- dmake/dmdump.c
  108. #   5809 -rw-r----- dmake/dmstring.c
  109. #  25368 -rw-r----- dmake/expand.c
  110. #   2089 -rw-r----- dmake/extern.h
  111. #   8398 -rw-r----- dmake/function.c
  112. #  13281 -rw-r----- dmake/getinp.c
  113. #   2324 -rw-r----- dmake/hash.c
  114. #   5479 -rw-r----- dmake/imacs.c
  115. #  24179 -rw-r----- dmake/infer.c
  116. #   1809 -rw-r----- dmake/itypes.h
  117. #   4771 -rw-r----- dmake/macparse.c
  118. #   5076 -rw-r----- dmake/make.bat
  119. #  27141 -rw-r----- dmake/make.c
  120. #   1124 -rw-r----- dmake/make.cmd
  121. #  10539 -rw-r----- dmake/makefile.mk
  122. #   2763 -rw-r----- dmake/makefile
  123. # 117216 -rw-r----- dmake/man/dmake.nc
  124. # 125280 -rw-r----- dmake/man/dmake.p
  125. #  97989 -rw-r----- dmake/man/dmake.tf
  126. #   2019 -rw-r----- dmake/msdos/_chdir.c
  127. #   1946 -rw-r----- dmake/msdos/arlib.c
  128. #   1901 -rw-r----- dmake/msdos/bccdos/config.h
  129. #   1400 -rw-r----- dmake/msdos/bccdos/config.mk
  130. #     17 -rw-r----- dmake/msdos/bccdos/lib.rsp
  131. #     17 -rw-r----- dmake/msdos/bccdos/libswp.rsp
  132. #   2868 -rw-r----- dmake/msdos/bccdos/mk.bat
  133. #   3018 -rw-r----- dmake/msdos/bccdos/mkswp.bat
  134. #    635 -rw-r----- dmake/msdos/bccdos/obj.rsp
  135. #    673 -rw-r----- dmake/msdos/bccdos/objswp.rsp
  136. #   5622 -rw-r----- dmake/msdos/bccdos/public.h
  137. #   3795 -rw-r----- dmake/msdos/bccdos/startup.mk
  138. #   1724 -rw-r----- dmake/msdos/bccdos/tempnam.c
  139. #    767 -rw-r----- dmake/msdos/bccdos/utime.c
  140. #   1663 -rw-r----- dmake/msdos/config.mk
  141. #   1776 -rw-r----- dmake/msdos/dirbrk.c
  142. #   1086 -rw-r----- dmake/msdos/dirlib.h
  143. #  37176 -rw-r----- dmake/msdos/exec.asm
  144. #    351 -rw-r----- dmake/msdos/exec.h
  145. #   3671 -rw-r----- dmake/msdos/exec.uue
  146. #   2140 -rw-r----- dmake/msdos/find.c
  147. #   2467 -rw-r----- dmake/msdos/mscdos/config.h
  148. #   2419 -rw-r----- dmake/msdos/mscdos/config.mk
  149. #      1 -rw-r----- dmake/msdos/mscdos/lib.rsp
  150. #      1 -rw-r----- dmake/msdos/mscdos/libswp.rsp
  151. #   2512 -rw-r----- dmake/msdos/mscdos/mk40.bat
  152. #   2654 -rw-r----- dmake/msdos/mscdos/mk40swp.bat
  153. #   2932 -rw-r----- dmake/msdos/mscdos/mk50.bat
  154. #   3088 -rw-r----- dmake/msdos/mscdos/mk50swp.bat
  155. #   2932 -rw-r----- dmake/msdos/mscdos/mk51.bat
  156. #   3088 -rw-r----- dmake/msdos/mscdos/mk51swp.bat
  157. #   2932 -rw-r----- dmake/msdos/mscdos/mk60.bat
  158. #   3088 -rw-r----- dmake/msdos/mscdos/mk60swp.bat
  159. #    593 -rw-r----- dmake/msdos/mscdos/obj.rsp
  160. #    631 -rw-r----- dmake/msdos/mscdos/objswp.rsp
  161. #     49 -rw-r----- dmake/msdos/mscdos/optoff.h
  162. #   5622 -rw-r----- dmake/msdos/mscdos/public.h
  163. #   3822 -rw-r----- dmake/msdos/mscdos/startup.mk
  164. #   1754 -rw-r----- dmake/msdos/mscdos/tempnam.c
  165. #   1640 -rw-r----- dmake/msdos/rmprq.c
  166. #   1951 -rw-r----- dmake/msdos/ruletab.c
  167. #   2611 -rw-r----- dmake/msdos/runargv.c
  168. #  12750 -rw-r----- dmake/msdos/spawn.c
  169. #    392 -rw-r----- dmake/msdos/startup.h
  170. #    373 -rw-r----- dmake/msdos/stdarg.h
  171. #    926 -rw-r----- dmake/msdos/switchar.c
  172. #    301 -rw-r----- dmake/msdos/sysintf.h
  173. #   1897 -rw-r----- dmake/msdos/tccdos/config.h
  174. #   1400 -rw-r----- dmake/msdos/tccdos/config.mk
  175. #     17 -rw-r----- dmake/msdos/tccdos/lib.rsp
  176. #     17 -rw-r----- dmake/msdos/tccdos/libswp.rsp
  177. #   2992 -rw-r----- dmake/msdos/tccdos/mk.bat
  178. #   3146 -rw-r----- dmake/msdos/tccdos/mkswp.bat
  179. #    635 -rw-r----- dmake/msdos/tccdos/obj.rsp
  180. #    673 -rw-r----- dmake/msdos/tccdos/objswp.rsp
  181. #   5622 -rw-r----- dmake/msdos/tccdos/public.h
  182. #   3795 -rw-r----- dmake/msdos/tccdos/startup.mk
  183. #   1724 -rw-r----- dmake/msdos/tccdos/tempnam.c
  184. #    767 -rw-r----- dmake/msdos/tccdos/utime.c
  185. #   1353 -rw-r----- dmake/msdos/tee.c
  186. #   1746 -rw-r----- dmake/os2/_chdir.c
  187. #   1536 -rw-r----- dmake/os2/config.mk
  188. #     24 -rw-r----- dmake/os2/dmake.bad
  189. #    427 -rw-r----- dmake/os2/dmake.cs
  190. #    121 -rw-r----- dmake/os2/dmake.def
  191. #   2414 -rw-r----- dmake/os2/mscdos/config.h
  192. #   2282 -rw-r----- dmake/os2/mscdos/config.mk
  193. #   3820 -rw-r----- dmake/os2/mscdos/dmake.ini
  194. #      1 -rw-r----- dmake/os2/mscdos/lib.rsp
  195. #   3330 -rw-r----- dmake/os2/mscdos/mk40.cmd
  196. #   3407 -rw-r----- dmake/os2/mscdos/mk50.cmd
  197. #   3407 -rw-r----- dmake/os2/mscdos/mk51.cmd
  198. #   3407 -rw-r----- dmake/os2/mscdos/mk60.cmd
  199. #    576 -rw-r----- dmake/os2/mscdos/obj.rsp
  200. #     49 -rw-r----- dmake/os2/mscdos/optoff.h
  201. #   5614 -rw-r----- dmake/os2/mscdos/public.h
  202. #    132 -rw-r----- dmake/os2/mscdos/startup.mk
  203. #   1919 -rw-r----- dmake/os2/mscdos/tempnam.c
  204. #   2098 -rw-r----- dmake/os2/ruletab.c
  205. #   7611 -rw-r----- dmake/os2/runargv.c
  206. #    384 -rw-r----- dmake/os2/startup.h
  207. #    373 -rw-r----- dmake/os2/stdarg.h
  208. #    904 -rw-r----- dmake/os2/switchar.c
  209. #    333 -rw-r----- dmake/os2/sysintf.h
  210. #   5207 -rw-r----- dmake/parse.c
  211. #     88 -rw-r----- dmake/patchlvl.h
  212. #   3063 -rw-r----- dmake/path.c
  213. #   7050 -rw-r----- dmake/percent.c
  214. #   2194 -rw-r----- dmake/quit.c
  215. #    626 -rw-r----- dmake/readme/atari.tos
  216. #   1988 -rw-r----- dmake/readme/cover
  217. #   5848 -rw-r----- dmake/readme/msdos
  218. #   5581 -rw-r----- dmake/readme/os2
  219. #  17984 -rw-r----- dmake/readme/release
  220. #  39277 -rw-r----- dmake/rulparse.c
  221. #   7761 -rw-r----- dmake/stat.c
  222. #   5520 -rw-r----- dmake/state.c
  223. #   1943 -rw-r----- dmake/stdmacs.h
  224. #   9748 -rw-r----- dmake/struct.h
  225. #  14629 -rw-r----- dmake/sysintf.c
  226. #  13294 -rw-r----- dmake/tos/arlib.c
  227. #   1874 -rw-r----- dmake/tos/config.h
  228. #   1262 -rw-r----- dmake/tos/config.mk
  229. #   1881 -rw-r----- dmake/tos/dirbrk.c
  230. #   1480 -rw-r----- dmake/tos/make.sh
  231. #   5553 -rw-r----- dmake/tos/public.h
  232. #   2923 -rw-r----- dmake/tos/putenv.c
  233. #   1716 -rw-r----- dmake/tos/rmprq.c
  234. #   1957 -rw-r----- dmake/tos/ruletab.c
  235. #   2542 -rw-r----- dmake/tos/runargv.c
  236. #    392 -rw-r----- dmake/tos/startup.h
  237. #   3233 -rw-r----- dmake/tos/startup.mk
  238. #    442 -rw-r----- dmake/tos/sysintf.h
  239. #   1506 -rw-r----- dmake/tos/tempnam.c
  240. #     46 -rw-r----- dmake/unix/386ix/ar.h
  241. #   1998 -rw-r----- dmake/unix/386ix/config.h
  242. #    745 -rw-r----- dmake/unix/386ix/config.mk
  243. #   2126 -rw-r----- dmake/unix/386ix/make.sh
  244. #   5521 -rw-r----- dmake/unix/386ix/public.h
  245. #   3221 -rw-r----- dmake/unix/386ix/startup.mk
  246. #    373 -rw-r----- dmake/unix/386ix/stdarg.h
  247. #    346 -rw-r----- dmake/unix/386ix/stdlib.h
  248. #    133 -rw-r----- dmake/unix/386ix/time.h
  249. #  14467 -rw-r----- dmake/unix/arlib.c
  250. #   2075 -rw-r----- dmake/unix/bsd43/config.h
  251. #    796 -rw-r----- dmake/unix/bsd43/config.mk
  252. #   2489 -rw-r----- dmake/unix/bsd43/make.sh
  253. #   5521 -rw-r----- dmake/unix/bsd43/public.h
  254. #   2930 -rw-r----- dmake/unix/bsd43/putenv.c
  255. #   1581 -rw-r----- dmake/unix/bsd43/setvbuf.c
  256. #   3221 -rw-r----- dmake/unix/bsd43/startup.mk
  257. #    409 -rw-r----- dmake/unix/bsd43/stdarg.h
  258. #    346 -rw-r----- dmake/unix/bsd43/stdlib.h
  259. #    292 -rw-r----- dmake/unix/bsd43/string.h
  260. #   1506 -rw-r----- dmake/unix/bsd43/tempnam.c
  261. #    808 -rw-r----- dmake/unix/bsd43/utime.c
  262. #    521 -rw-r----- dmake/unix/bsd43/uw/config.mk
  263. #   2977 -rw-r----- dmake/unix/bsd43/uw/make.sh
  264. #   5524 -rw-r----- dmake/unix/bsd43/uw/public.h
  265. #   3239 -rw-r----- dmake/unix/bsd43/uw/startup.mk
  266. #    317 -rw-r----- dmake/unix/bsd43/vf/config.mk
  267. #    782 -rw-r----- dmake/unix/bsd43/vf/ctype.h
  268. #   3196 -rw-r----- dmake/unix/bsd43/vf/make.sh
  269. #    137 -rw-r----- dmake/unix/bsd43/vf/memcpy.c
  270. #   5524 -rw-r----- dmake/unix/bsd43/vf/public.h
  271. #   3221 -rw-r----- dmake/unix/bsd43/vf/startup.mk
  272. #   1409 -rw-r----- dmake/unix/bsd43/vf/vfprintf.c
  273. #   1031 -rw-r----- dmake/unix/config.mk
  274. #   1812 -rw-r----- dmake/unix/dirbrk.c
  275. #   3504 -rw-r----- dmake/unix/explode.c
  276. #   3634 -rw-r----- dmake/unix/rmprq.c
  277. #   1939 -rw-r----- dmake/unix/ruletab.c
  278. #   6758 -rw-r----- dmake/unix/runargv.c
  279. #    412 -rw-r----- dmake/unix/startup.h
  280. #    441 -rw-r----- dmake/unix/sysintf.h
  281. #   1999 -rw-r----- dmake/unix/sysvr1/config.h
  282. #    761 -rw-r----- dmake/unix/sysvr1/config.mk
  283. #   2251 -rw-r----- dmake/unix/sysvr1/make.sh
  284. #   5522 -rw-r----- dmake/unix/sysvr1/public.h
  285. #   2931 -rw-r----- dmake/unix/sysvr1/putenv.c
  286. #   3221 -rw-r----- dmake/unix/sysvr1/startup.mk
  287. #    430 -rw-r----- dmake/unix/sysvr1/stdarg.h
  288. #    346 -rw-r----- dmake/unix/sysvr1/stdlib.h
  289. #    133 -rw-r----- dmake/unix/sysvr1/time.h
  290. #    934 -rw-r----- dmake/unix/sysvr1/vfprintf.c
  291. #   2106 -rw-r----- dmake/unix/sysvr3/config.h
  292. #    750 -rw-r----- dmake/unix/sysvr3/config.mk
  293. #   2153 -rw-r----- dmake/unix/sysvr3/make.sh
  294. #   5522 -rw-r----- dmake/unix/sysvr3/public.h
  295. #   3221 -rw-r----- dmake/unix/sysvr3/startup.mk
  296. #    469 -rw-r----- dmake/unix/sysvr3/stdarg.h
  297. #    428 -rw-r----- dmake/unix/sysvr3/stdlib.h
  298. #    133 -rw-r----- dmake/unix/sysvr3/time.h
  299. #   2015 -rw-r----- dmake/unix/sysvr4/config.h
  300. #    750 -rw-r----- dmake/unix/sysvr4/config.mk
  301. #   2153 -rw-r----- dmake/unix/sysvr4/make.sh
  302. #   5522 -rw-r----- dmake/unix/sysvr4/public.h
  303. #   3187 -rw-r----- dmake/unix/sysvr4/startup.mk
  304. #    819 -rw-r----- dmake/unix/sysvr4/stdarg.h
  305. #     53 -rw-r----- dmake/version.h
  306. #   4702 -rw-r----- dmake/vextern.h
  307. #  12487 -rw-r----- dmake/LICENSE
  308. #
  309. if test -r _shar_seq_.tmp; then
  310.     echo 'Must unpack archives in sequence!'
  311.     echo Please unpack part `cat _shar_seq_.tmp` next
  312.     exit 1
  313. fi
  314. # ============= dmake/_install ==============
  315. if test ! -d 'dmake'; then
  316.     mkdir 'dmake'
  317. fi
  318. if test -f 'dmake/_install' -a X"$1" != X"-c"; then
  319.     echo 'x - skipping dmake/_install (File already exists)'
  320.     rm -f _shar_wnt_.tmp
  321. else
  322. > _shar_wnt_.tmp
  323. sed 's/^X//' << 'SHAR_EOF' > 'dmake/_install' &&
  324. INSTALLATION INSTRUCTIONS
  325. X
  326. This file contains the instructions required to install and create the
  327. appropriate version of dmake.
  328. X
  329. NOTE:  If you use dmake to bootstrap a NEW DISTRIBUTED version or to remake
  330. X       it after applying a PATCH, it may be NECESSARY to use the batch
  331. X       script instead of dmake as some patches incorporate changes to the
  332. X       makefile.mk file and associated config.mk files that cannot be
  333. X       handled by earlier versions of dmake.  The use of the batch files
  334. X       is the ONLY supported method of making a new release or update
  335. X       version.
  336. X
  337. MAKING THE PROPER VERSION
  338. X
  339. The list of available versions of dmake has grown quite large.  The best
  340. method to determine what versions are available for your configuration is to
  341. simply issue the command 'make' in the source root directory.  Below is a
  342. partial list of the available versions to give an idea of what is supported.
  343. Note that this copy of the list is not maintained up to date.
  344. X
  345. X    bsd43       - Generic BSD 4.3 (eg, true BSD, apollo, sun OS4, SGI etc)
  346. X    bsd43uw       - Generic BSD 4.3 at U of Waterloo
  347. X    bsd43vf       - Generic BSD with no vfprintf in its library  (use this
  348. X             target if you are missing vfprintf function in your
  349. X             C library)
  350. X    sysvr3       - Generic SysV R3 UNIX
  351. X    sysvr1       - Generic SysV R1 UNIX
  352. X    386ix      - 386/ix (SysV R3), not tested
  353. X    dynix      - Sequent Symmetry dynix
  354. X    ultrix       - Ultrix 3.0 system
  355. X    mips       - Any MIPS box
  356. X        os2msc60   - OS/2 with MSC 6.0
  357. X    tos        - Atari-ST using GCC as compiler
  358. X        tcc        - DOS with tcc 2.0
  359. X        tccswp     - swapping DOS version with tcc 2.0
  360. X        msc60      - DOS with MSC 6.0
  361. X        msc60swp   - swapping DOS version with MSC 6.0
  362. X
  363. The file 'makefile' understands these targets and runs the appropriate script
  364. to create the correct version.
  365. X
  366. The source code is organized as follows:
  367. X
  368. X            dmake         [source for all common functions]
  369. X              |
  370. X              |
  371. X        ----------------------------
  372. X        |       |          |          |
  373. X       unix   tos      os2       msdos  [source for OS specific functions]
  374. X        |                |          |
  375. X  --------------------    mscdos    -------------------
  376. X  |         |        |              |       |         |
  377. 386ix     bsd43  sysvr[134]      tccdos   bccdos   mscdos  [source for OSRELEASE
  378. X        |                                specific functions]
  379. X    --------
  380. X    |      |
  381. X       uw      vf   [source for OSENVIRONMENT specific functions]
  382. X
  383. X
  384. Each of the directories (eg. bsd43, mscdos, tccdos, and sysvr3) contain source
  385. that is specific to that release of the OS (and possibly C-library)
  386. To make the apropriate versions of dmake, simply type the command
  387. X
  388. X    'make system'
  389. X
  390. where system is one of the supplied possibilities.  For a complete list
  391. of the versions you can make, see the comments in the file 'makefile', or
  392. type 'make'.
  393. X
  394. The bootstrapping of dmake is accomplished by running a shell script with the
  395. appropriate compile commands hard coded.
  396. X
  397. (NOTE:  If you are using MSDOS then, you will actually be using the make.bat
  398. X    scriptfile to make the correct version of dmake for MSDOS.  If you
  399. X    are running a SHELL other than command.com, you may have to perform
  400. X    some extra work to invoke the batch file.
  401. X    
  402. X    Make sure you read the readme/msdos file before attempting to make the
  403. X    MSDOS version, as it contains important configuration and limitation
  404. X    information.)
  405. X
  406. The making of dmake, echoes the commands being executed, and should proceed
  407. relatively error free.  Ignore any warnings that concern unused arguments
  408. to functions, these are normal in some configurations (esp the MSDOS
  409. configuration).
  410. X
  411. X
  412. STARTUP FILE
  413. X
  414. dmake requires the loading of a startup file when it is first invoked.  The
  415. path for the startup file is set in the file 'startup.h' found in the unix
  416. and msdos directories.  You may override the value of the path variable
  417. compiled-in by creating a file at the root source directory called startup.h
  418. and inserting into that file a definition that is like the definition found
  419. in the supplied startup.h files.
  420. X
  421. X
  422. INSTALLATION
  423. X
  424. To install dmake you must copy the executable to where your system
  425. locates executables, and you must place a copy of startup.mk (found in the
  426. directory corresponding to the version you just made) into a location
  427. corresponding to the value of the MAKESTARTUP macro or environment variable.
  428. You are free to customize the contents of startup.mk.
  429. X
  430. To make dmake again, (using itself), you will have to set three environment
  431. variables.  See the file makefile.mk for their names and their legal values.
  432. Once set you can invoke dmake to make itself.
  433. X
  434. X
  435. DOCUMENTATION
  436. X
  437. All documentation for dmake appears under the man directory.
  438. The file dmake.tf included in this distribution contains the troff
  439. source for the man page.  You must typeset it using the -man macros.
  440. If you cannot typeset it, the file dmake.p is a version that has been
  441. typeset for a normal dumb terminal.  The file dmake.p contains control
  442. characters.  The file dmake.nc is a version of the man page that has
  443. all of the control characters stripped.
  444. X
  445. X
  446. CREATING A NEW VERSION
  447. X
  448. To create yet another version of dmake you should follow the following steps.
  449. X
  450. The sysvr3 version as sent is the base version, all dmake versions must provide
  451. the equivalent of the functions defined in the sysvr3 directory, and MUST
  452. provide the same semantics (MSDOS archive lib searches are an exception since
  453. we cannot search libraries for timestamps in MSDOS, Actually the MKS version
  454. of dmake does this, I don't have the inclination to add this code though).
  455. X
  456. 1. Create a new directory for the version you will be making at the level
  457. X   that is appropriate.  If it is a new OS then add the dir at the top level,
  458. X   if it is a new version of UNIX then add it below the unix directory.
  459. X
  460. 2. Copy the files from the unix and unix/sysvr3 directories to the new dir.
  461. X   (Or from any other directory sub-tree that is more appropriate)
  462. X
  463. 3. Not all OS/OSRELEASE combinations are compatible so in order to make
  464. X   dmake on each, the particular directory may contain C-source for functions
  465. X   present in the SVID SysV R3 distribution which are used by dmake but are
  466. X   not supplied by the C-library in the target system.  For example the bsd43
  467. X   directory contains source for tempnam.c since it is not provided with
  468. X   the BSD C-library.  Before writing a new version of the source file
  469. X   check the other directories to see if one already exists.
  470. X
  471. 4. Under some systems the standard include files may be missing or incorrect.
  472. X   eg. under BSD stdarg.h and string.h.  If this is the case
  473. X   you should create the proper .h file in the proper directory.
  474. X   This works as expected as the compile line includes the flag -Idir
  475. X   where dir is the configuration dir, (bsd43 for example) and any
  476. X   standard include files will be searched for in dir before the compiler
  477. X   looks in the normal places (if you have a sane compiler :-).
  478. X
  479. 5. Modify dmake.sh to contain the appropriate C compiler flags and link command
  480. X   and to include any specific C files that you have had to add for this
  481. X   version of dmake, and run the result through the shell.
  482. X   (make the same changes to config.mk so that once you have a working copy of
  483. X   dmake you can use it to bring itself up to date)
  484. X
  485. 6. Send me the changes :-) so that I can incorporate them into future
  486. X   distributions.
  487. X
  488. 7. This should be all that you require to create a new version of dmake.
  489. X   If you have any questions send e-mail to dvadura@watdragon.uwaterloo.ca
  490. SHAR_EOF
  491. chmod 0640 dmake/_install ||
  492. echo 'restore of dmake/_install failed'
  493. Wc_c="`wc -c < 'dmake/_install'`"
  494. test 7454 -eq "$Wc_c" ||
  495.     echo 'dmake/_install: original size 7454, current size' "$Wc_c"
  496. rm -f _shar_wnt_.tmp
  497. fi
  498. # ============= dmake/_state.mk ==============
  499. if test -f 'dmake/_state.mk' -a X"$1" != X"-c"; then
  500.     echo 'x - skipping dmake/_state.mk (File already exists)'
  501.     rm -f _shar_wnt_.tmp
  502. else
  503. > _shar_wnt_.tmp
  504. sed 's/^X//' << 'SHAR_EOF' > 'dmake/_state.mk' &&
  505. 20
  506. clean
  507. 0
  508. 3141552312
  509. 2794859647
  510. unix-scripts
  511. 0
  512. 3141552312
  513. 695282322
  514. atari-tos-scripts
  515. 0
  516. 3141552312
  517. 1048669739
  518. msdos-tcc-scripts
  519. 0
  520. 3141552312
  521. 2819684817
  522. msdos-bcc-scripts
  523. 0
  524. 3141552312
  525. 105519771
  526. 40
  527. 0
  528. 3141552312
  529. 3141559070
  530. 50
  531. 0
  532. 3141552312
  533. 3141559199
  534. 51
  535. 0
  536. 3141552312
  537. 3141559200
  538. 60
  539. 0
  540. 3141552312
  541. 3141559328
  542. msdos-msc-scripts
  543. 0
  544. 3141552312
  545. 128422636
  546. msdos-scripts
  547. 0
  548. 3141552312
  549. 649961888
  550. os2-msc-scripts
  551. 0
  552. 3141552312
  553. 749865848
  554. os2-scripts
  555. 0
  556. 3141552312
  557. 2533154572
  558. scripts
  559. 0
  560. 3141552312
  561. 2153859015
  562. dmake.tf
  563. 0
  564. 1783847975
  565. 2294589697
  566. dmake.p
  567. 0
  568. 1783847975
  569. 2913656604
  570. dmake.nc
  571. 0
  572. 1783847975
  573. 3278359365
  574. man
  575. 0
  576. 1783847975
  577. 1785674470
  578. src-list
  579. 0
  580. 3141552312
  581. 2925313848
  582. dmake.tar
  583. 0
  584. 3141552312
  585. 119295219
  586. dmake.zoo
  587. 0
  588. 3141552312
  589. 4277544073
  590. objects
  591. 0
  592. 3141552312
  593. 2001142999
  594. dmake.h
  595. 0
  596. 3141552312
  597. 1592190551
  598. extern.h
  599. 0
  600. 3141552312
  601. 2028269932
  602. struct.h
  603. 0
  604. 3141552312
  605. 4027113723
  606. vextern.h
  607. 0
  608. 3141552312
  609. 4129343971
  610. patchlvl.h
  611. 0
  612. 3141552312
  613. 4035860406
  614. version.h
  615. 0
  616. 3141552312
  617. 929790173
  618. infer.c
  619. 0
  620. 3141552312
  621. 3196224996
  622. infer.o
  623. 0
  624. 3141552312
  625. 3791079514
  626. make.c
  627. 0
  628. 3141552312
  629. 2741942765
  630. make.o
  631. 0
  632. 3141552312
  633. 1306455157
  634. dmake.shar
  635. 0
  636. 3141552312
  637. 769957504
  638. archives
  639. 0
  640. 3141552312
  641. 3274605333
  642. clean
  643. 0
  644. 308702675
  645. 4256977306
  646. dmake.tf
  647. 0
  648. 1778471746
  649. 3774268244
  650. dmake.p
  651. 0
  652. 1778471746
  653. 2908280375
  654. dmake.nc
  655. 0
  656. 1778471746
  657. 3272983136
  658. man
  659. 0
  660. 1778471746
  661. 1780298241
  662. src-list
  663. 0
  664. 308702675
  665. 92464211
  666. dmake.shar
  667. 0
  668. 308702675
  669. 2232075163
  670. SHAR_EOF
  671. chmod 0640 dmake/_state.mk ||
  672. echo 'restore of dmake/_state.mk failed'
  673. Wc_c="`wc -c < 'dmake/_state.mk'`"
  674. test 1357 -eq "$Wc_c" ||
  675.     echo 'dmake/_state.mk: original size 1357, current size' "$Wc_c"
  676. rm -f _shar_wnt_.tmp
  677. fi
  678. # ============= dmake/alloc.h ==============
  679. if test -f 'dmake/alloc.h' -a X"$1" != X"-c"; then
  680.     echo 'x - skipping dmake/alloc.h (File already exists)'
  681.     rm -f _shar_wnt_.tmp
  682. else
  683. > _shar_wnt_.tmp
  684. sed 's/^X//' << 'SHAR_EOF' > 'dmake/alloc.h' &&
  685. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/alloc.h,v 1.1 91/05/06 15:23:03 dvadura Exp $
  686. -- SYNOPSIS -- macros for allocating memory.
  687. -- 
  688. -- DESCRIPTION
  689. --    A somewhat nicer interface to malloc and calloc.
  690. --    Here we standardise the calling convention with a common macro
  691. --    interface.
  692. -- 
  693. -- AUTHOR
  694. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  695. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  696. --
  697. -- COPYRIGHT
  698. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  699. -- 
  700. --      This program is free software; you can redistribute it and/or
  701. --      modify it under the terms of the GNU General Public License
  702. --      (version 1), as published by the Free Software Foundation, and
  703. --      found in the file 'LICENSE' included with this distribution.
  704. -- 
  705. --      This program is distributed in the hope that it will be useful,
  706. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  707. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  708. --      GNU General Public License for more details.
  709. -- 
  710. --      You should have received a copy of the GNU General Public License
  711. --      along with this program;  if not, write to the Free Software
  712. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  713. --
  714. -- LOG
  715. --     $Log:    alloc.h,v $
  716. X * Revision 1.1  91/05/06  15:23:03  dvadura
  717. X * dmake Release Version 3.7
  718. X * 
  719. */
  720. X
  721. #ifndef ALLOC_h
  722. #define ALLOC_h
  723. X
  724. /* DO NOT CHANGE these!  These are the definitions that the make source
  725. X * uses for allocating memory.  They must be defined for make to compile
  726. X * properly.
  727. X */
  728. X
  729. /* This is the only place that we define size_t now.  This should be more
  730. X * than enough! */
  731. #if __STDC__
  732. #else
  733. #   if !defined(_TYPES_) && !defined(M_XENIX) && !defined(atarist) && !defined(_SIZE_T)
  734. #      if defined(MSDOS) || defined(__MSDOS__)
  735. X          typedef unsigned size_t;
  736. #      else
  737. X          typedef long size_t;
  738. #      endif
  739. #   endif
  740. #endif
  741. X
  742. #define    usizeof(t)    (size_t)sizeof(t)
  743. X
  744. #define FREE(p)         free((char*)(p))
  745. #define MALLOC(n, t)    (t*) malloc((unsigned int)(n)*usizeof(t))
  746. #define CALLOC(n, t)    (t*) calloc((unsigned int)(n), usizeof(t))
  747. X
  748. #define TALLOC(p, n, t)    if ((p = CALLOC(n, t)) == (t*)0) {No_ram();}
  749. X
  750. #endif
  751. X
  752. SHAR_EOF
  753. chmod 0640 dmake/alloc.h ||
  754. echo 'restore of dmake/alloc.h failed'
  755. Wc_c="`wc -c < 'dmake/alloc.h'`"
  756. test 2243 -eq "$Wc_c" ||
  757.     echo 'dmake/alloc.h: original size 2243, current size' "$Wc_c"
  758. rm -f _shar_wnt_.tmp
  759. fi
  760. # ============= dmake/basename.c ==============
  761. if test -f 'dmake/basename.c' -a X"$1" != X"-c"; then
  762.     echo 'x - skipping dmake/basename.c (File already exists)'
  763.     rm -f _shar_wnt_.tmp
  764. else
  765. > _shar_wnt_.tmp
  766. sed 's/^X//' << 'SHAR_EOF' > 'dmake/basename.c' &&
  767. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/basename.c,v 1.1 91/05/06 15:23:04 dvadura Exp $
  768. -- SYNOPSIS -- return pointer to last pathname component
  769. -- 
  770. -- DESCRIPTION
  771. --    take a file name like /fred/foo/hoe/mary.k, and return the 'mary.k'
  772. --    portion
  773. -- 
  774. -- AUTHOR
  775. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  776. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  777. --
  778. -- COPYRIGHT
  779. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  780. -- 
  781. --      This program is free software; you can redistribute it and/or
  782. --      modify it under the terms of the GNU General Public License
  783. --      (version 1), as published by the Free Software Foundation, and
  784. --      found in the file 'LICENSE' included with this distribution.
  785. -- 
  786. --      This program is distributed in the hope that it will be useful,
  787. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  788. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  789. --      GNU General Public License for more details.
  790. -- 
  791. --      You should have received a copy of the GNU General Public License
  792. --      along with this program;  if not, write to the Free Software
  793. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  794. --
  795. -- LOG
  796. --     $Log:    basename.c,v $
  797. X * Revision 1.1  91/05/06  15:23:04  dvadura
  798. X * dmake Release Version 3.7
  799. X * 
  800. */
  801. X
  802. #include "extern.h"
  803. X
  804. PUBLIC char*
  805. basename( path )
  806. char *path;
  807. {
  808. X   char *p;
  809. X   char *q;
  810. X
  811. X   if( *(q = path) ) {
  812. X      for(; *(p=_strpbrk(q, DirBrkStr)) != '\0'; q = p+1 );
  813. X      if( !*q ) {
  814. X     for( p=q-1; p != path; --p )
  815. X        if( strchr( DirBrkStr, *p ) == NIL(char) ) return( p+1 );
  816. X     return( strchr(DirBrkStr, *p)?path:(p+1) );
  817. X      }
  818. X      path = q;
  819. X   }
  820. X   return( path );
  821. }
  822. SHAR_EOF
  823. chmod 0640 dmake/basename.c ||
  824. echo 'restore of dmake/basename.c failed'
  825. Wc_c="`wc -c < 'dmake/basename.c'`"
  826. test 1749 -eq "$Wc_c" ||
  827.     echo 'dmake/basename.c: original size 1749, current size' "$Wc_c"
  828. rm -f _shar_wnt_.tmp
  829. fi
  830. # ============= dmake/dag.c ==============
  831. if test -f 'dmake/dag.c' -a X"$1" != X"-c"; then
  832.     echo 'x - skipping dmake/dag.c (File already exists)'
  833.     rm -f _shar_wnt_.tmp
  834. else
  835. > _shar_wnt_.tmp
  836. sed 's/^X//' << 'SHAR_EOF' > 'dmake/dag.c' &&
  837. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/dag.c,v 1.1 91/05/06 15:23:04 dvadura Exp $
  838. -- SYNOPSIS -- Routines to construct the internal dag.
  839. -- 
  840. -- DESCRIPTION
  841. --    This file contains all the routines that are responsible for
  842. --    defining and manipulating all objects used by the make facility.
  843. -- 
  844. -- AUTHOR
  845. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  846. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  847. --
  848. -- COPYRIGHT
  849. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  850. -- 
  851. --      This program is free software; you can redistribute it and/or
  852. --      modify it under the terms of the GNU General Public License
  853. --      (version 1), as published by the Free Software Foundation, and
  854. --      found in the file 'LICENSE' included with this distribution.
  855. -- 
  856. --      This program is distributed in the hope that it will be useful,
  857. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  858. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  859. --      GNU General Public License for more details.
  860. -- 
  861. --      You should have received a copy of the GNU General Public License
  862. --      along with this program;  if not, write to the Free Software
  863. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  864. --
  865. -- LOG
  866. --     $Log:    dag.c,v $
  867. X * Revision 1.1  91/05/06  15:23:04  dvadura
  868. X * dmake Release Version 3.7
  869. X * 
  870. */
  871. X
  872. #include "extern.h"
  873. X
  874. X
  875. PUBLIC HASHPTR
  876. Get_name( name, tab, define )/*
  877. ===============================
  878. X    Look to see if the name is defined, if it is then return
  879. X    a pointer to its node, if not return NIL(HASH).
  880. X    If define is TRUE and the name is not found it will be added. */
  881. X
  882. char    *name;            /* name we are looking for   */
  883. HASHPTR *tab;            /* the hash table to look in */
  884. int    define;            /* TRUE => add to table      */
  885. {
  886. X   register HASHPTR hp;
  887. X   register char    *p;
  888. X   uint16           hv;
  889. X   uint32           hash_key;
  890. X
  891. X   DB_ENTER( "Get_name" );
  892. X   DB_PRINT( "name", ("Looking for %s", name) );
  893. X
  894. X   hp = Search_table( tab, name, &hv, &hash_key );
  895. X
  896. X   if( hp == NIL(HASH) && define ) {
  897. X      /* Check to make sure that CELL name contains only printable chars */
  898. X      for( p=name; *p; p++ )
  899. X     if( !isprint(*p) )
  900. X        Fatal( "Name contains non-printable character [0x%02x]", *p );
  901. X
  902. X      TALLOC( hp, 1, HASH );        /* allocate a cell and add it in */
  903. X
  904. X      hp->ht_name  = _strdup( name );
  905. X      hp->ht_hash  = hash_key;
  906. X      hp->ht_next  = tab[ hv ];
  907. X      tab[ hv ]    = hp;
  908. X
  909. X      DB_PRINT( "name", ("Adding %s", name) );
  910. X   }
  911. X
  912. X   DB_PRINT( "name",("Returning: [%s,%lu]",
  913. X         (hp == NIL(HASH)) ? "":hp->ht_name, hv) );
  914. X   DB_RETURN( hp );
  915. }
  916. X
  917. X
  918. PUBLIC HASHPTR
  919. Search_table( tab, name, phv, phkey )
  920. HASHPTR *tab;
  921. char    *name;
  922. uint16  *phv;
  923. uint32  *phkey;
  924. {
  925. X   HASHPTR hp;
  926. X
  927. X   *phv = Hash( name, phkey );
  928. X
  929. X   for( hp = tab[ *phv ]; hp != NIL(HASH); hp = hp->ht_next )
  930. X      if(    hp->ht_hash == *phkey
  931. X      && !strcmp(hp->ht_name, name) )
  932. X         break;
  933. X
  934. X   return( hp );
  935. }
  936. X
  937. X
  938. PUBLIC HASHPTR
  939. Def_macro( name, value, flags )/*
  940. =================================
  941. X   This routine is used to define a macro, and it's value.
  942. X   The flags indicates if it is a permanent macro or if it's value
  943. X   can be redefined.  A flags of M_PRECIOUS means it is a precious
  944. X   macro and cannot be further redefined.  If the flags flag also
  945. X   contains the M_MULTI bit it means that the macro can be redefined
  946. X   multiple times and no warning of the redefinitions should be issued.
  947. X   Once a macro's VAR flags are set they are preserved through all future
  948. X   macro definitions.
  949. X   
  950. X   Macro definitions that have one of the variable bits set are treated
  951. X   specially.  In each case the hash table entry var field points at the
  952. X   global variable that can be set by assigning to the macro.
  953. X   
  954. X   bit valued global vars must be computed when the macro value is changed.
  955. X   char valued global vars must have the first char of ht_value copied to
  956. X   them.  string valued global vars have the same value as ht_value and should
  957. X   just have the new value of ht_value copied to them.  */
  958. X
  959. char    *name;            /* macro name to define    */
  960. char    *value;            /* macro value to set    */
  961. int     flags;            /* initial ht_flags    */
  962. {
  963. X   register HASHPTR   hp;
  964. X   register char      *p, *q;
  965. X
  966. X   DB_ENTER( "Def_macro" );
  967. X   DB_PRINT( "mac", ("Defining macro %s = %s, %x", name, value, flags) );
  968. X
  969. X   /* check to see if name is in the table, if so then just overwrite
  970. X      the previous definition.  Otherwise allocate a new node, and
  971. X      stuff it in the hash table, at the front of any linked list */
  972. X
  973. X   if( Readenv ) flags |= M_LITERAL;
  974. X
  975. X   hp = Get_name( name, Macs, TRUE );
  976. X
  977. X   if( (hp->ht_flag & M_PRECIOUS) && !(flags & M_FORCE) ) {
  978. X      Warning( "Macro `%s' cannot be redefined", name );
  979. X      DB_RETURN( hp );
  980. X   }
  981. X
  982. X   if( hp->ht_value != NIL(char) ) FREE( hp->ht_value );
  983. X
  984. X   if( (hp->ht_flag & M_USED) && !((flags | hp->ht_flag) & M_MULTI) )
  985. X      Warning( "Macro `%s' redefined after use", name );
  986. X
  987. X   if( (value != NIL(char)) && (*value) ) {
  988. X      /* strip out any \<nl> combinations where \ is the current CONTINUATION
  989. X       * char */
  990. X
  991. X      for( p = value; (p = strchr(p, CONTINUATION_CHAR)) != NIL(char); )
  992. X         if( p[1] == '\n' )
  993. X        strcpy( p, p+2 );
  994. X     else
  995. X        p++;
  996. X
  997. X      if( !(flags & M_LITERAL) ) {
  998. X     p = _strdup( _strspn( value, " \t" ) ); /* strip white space before */
  999. X                         /* ... and after value         */
  1000. X     if( *p ) {
  1001. X        for(q=p+strlen(p)-1; ((*q == ' ')||(*q == '\t')); q--);
  1002. X        *++q = '\0';
  1003. X     }
  1004. X     flags &= ~M_LITERAL;
  1005. X      }
  1006. X      else
  1007. X     p = _strdup( value );               /* take string literally   */
  1008. X      
  1009. X      if( !*p )    {                /* check if result is ""   */
  1010. X         FREE( p );
  1011. X         p = NIL(char);
  1012. X     flags |= M_EXPANDED;
  1013. X      }
  1014. X      else if( *_strpbrk( p, "${}" ) == '\0' )
  1015. X     flags |= M_EXPANDED;
  1016. X
  1017. X      hp->ht_value = p;
  1018. X   }
  1019. X   else
  1020. X      hp->ht_value = NIL(char);
  1021. X
  1022. X   /* Assign the hash table flag less the M_MULTI flag, it is used only
  1023. X    * to silence the warning.  But carry it over if it was previously
  1024. X    * defined in ht_flag, as this is a permanent M_MULTI variable. */
  1025. X
  1026. X   hp->ht_flag = (flags & ~(M_MULTI|M_FORCE)) |
  1027. X         (hp->ht_flag & (M_VAR_MASK | M_MULTI));
  1028. X   
  1029. X   /* Check for macro variables and make the necessary adjustment in the
  1030. X    * corresponding global variables */
  1031. X    
  1032. X   if( hp->ht_flag & M_VAR_MASK )
  1033. X      if( !(flags & M_EXPANDED) )
  1034. X     Error( "Macro variables must be assigned with :=" );
  1035. X      else switch( hp->ht_flag & M_VAR_MASK )    /* only one var type per var */
  1036. X      {
  1037. X     case M_VAR_STRING:
  1038. X        *hp->MV_SVAR = hp->ht_value;
  1039. X        break;
  1040. X
  1041. X     case M_VAR_CHAR:
  1042. X        *hp->MV_CVAR = (hp->ht_value == NIL(char)) ? '\0':*hp->ht_value;
  1043. X        break;
  1044. X  
  1045. X     case M_VAR_INT: {
  1046. X        int tvalue;
  1047. X        if( hp->MV_IVAR == NIL(int) ) break;    /* first time */
  1048. X
  1049. X        tvalue = atoi(hp->ht_value);
  1050. X        if( hp->MV_IVAR == &Buffer_size ) {
  1051. X           /* If Buffer_size is modified then make sure you change the
  1052. X            * size of the real buffer as well. */
  1053. X           tvalue = (tvalue < (BUFSIZ-2)) ? BUFSIZ : tvalue+2;
  1054. X           if( Buffer_size == tvalue ) break;
  1055. X           if( Buffer ) FREE(Buffer);
  1056. X           if((Buffer=MALLOC(tvalue, char)) == NIL(char)) No_ram();
  1057. X           *Buffer = '\0';
  1058. X        }
  1059. X        *hp->MV_IVAR = tvalue;
  1060. X
  1061. X        if( hp->MV_IVAR == &Max_proc || hp->MV_IVAR == &Max_proclmt ) {
  1062. X           if( tvalue < 1 )
  1063. X          Fatal( "Process limit value must be > 1" );
  1064. X
  1065. X           if( Max_proc > Max_proclmt )
  1066. X          Fatal( "Specified # of processes exceeds limit of [%d]",
  1067. X             Max_proclmt );
  1068. X        }
  1069. X     } break;
  1070. X     case M_VAR_BIT:
  1071. X        /* Bit variables are set to 1 if ht_value is not NULL and 0
  1072. X         * otherwise */
  1073. X         
  1074. X        if( hp->ht_value == NIL(char) )
  1075. X           *hp->MV_BVAR &= ~hp->MV_MASK;
  1076. X        else
  1077. X           *hp->MV_BVAR |= hp->MV_MASK;
  1078. X        break;
  1079. X      }
  1080. X   
  1081. X   DB_RETURN( hp );
  1082. }
  1083. X
  1084. X
  1085. X
  1086. PUBLIC CELLPTR
  1087. Def_cell( name )/*
  1088. ==================
  1089. X   Take a string passed in and define it as a cell
  1090. X   If the cell exists then return a pointer to it. */
  1091. char    *name;
  1092. {
  1093. X   register HASHPTR  hp;
  1094. X   register CELLPTR  cp;
  1095. X   register CELLPTR  lib;
  1096. X   char             *member;
  1097. X   char             *end;
  1098. X
  1099. X   DB_ENTER( "Def_cell" );
  1100. X
  1101. X   /* Check to see if the cell is a member of the form lib(member) or
  1102. X    * lib((symbol)) and handle the cases appropriately.
  1103. X    * What we do is we look at the target, if it is of the above two
  1104. X    * forms we get the lib, and add the member/symbol to the list of
  1105. X    * prerequisites for the library.  If this is a symbol name def'n
  1106. X    * we additionally add the attribute A_SYMBOL, so that stat can
  1107. X    * try to do the right thing.  */
  1108. X
  1109. X   if( ((member = strchr(name, '('))     != NIL(char)) &&
  1110. X       ((end    = strrchr(member,  ')')) != NIL(char)) &&
  1111. X       (member > name) && (member[-1] != '$') &&
  1112. X       (end > member+1)  && (end[1] == '\0') )
  1113. X   {
  1114. X      *member++ = *end = '\0';
  1115. X
  1116. X      if( (*member == '(') && (member[strlen(member)-1] == ')') ) {
  1117. X     member[ strlen(member)-1 ] = '\0';
  1118. X     cp = Def_cell( member+1 );
  1119. X     cp->ce_attr |= A_SYMBOL;
  1120. X      }
  1121. X      else
  1122. X     cp = Def_cell( member );
  1123. X
  1124. X      lib  = Def_cell( name );
  1125. X
  1126. X      Add_prerequisite( lib, cp, FALSE, FALSE );
  1127. X      lib->ce_attr |= A_LIBRARY | A_COMPOSITE;
  1128. X
  1129. X      if( !Def_targets ) cp = lib;
  1130. X   }
  1131. X   else {
  1132. X      hp = Get_name( name, Defs, TRUE );/* get the name from hash table */
  1133. X
  1134. X      if( hp->CP_OWNR == NIL(CELL) )    /* was it previously defined    */
  1135. X      {                    /* NO, so define a new cell    */
  1136. X     DB_PRINT( "cell", ("Defining cell [%s]", name) );
  1137. X
  1138. X     TALLOC( cp, 1, CELL );
  1139. X     hp->CP_OWNR = cp;
  1140. X     cp->ce_name = hp;
  1141. X     cp->ce_fname = hp->ht_name;
  1142. X      }
  1143. X      else                 /* YES, so return the old cell    */
  1144. X      {
  1145. X     DB_PRINT( "cell", ("Getting cell [%s]", hp->ht_name) );
  1146. X     cp = hp->CP_OWNR;
  1147. X      }
  1148. X   }
  1149. X
  1150. X   DB_RETURN( cp );
  1151. }
  1152. X
  1153. X
  1154. X
  1155. X
  1156. PUBLIC LINKPTR
  1157. Add_prerequisite( cell, prq, head, force )/*
  1158. ============================================
  1159. X    Add a dependency node to the dag.  It adds it to the prerequisites,
  1160. X    if any, of the cell and makes certain they are in linear order.
  1161. X    If head == 1, then add to head of the prerequisite list, else
  1162. X    add to tail. */
  1163. CELLPTR cell;
  1164. CELLPTR prq;
  1165. int     head;
  1166. int     force;
  1167. {
  1168. X   register LINKPTR lp, tlp;
  1169. X
  1170. X   DB_ENTER( "Add_prerequisite" );
  1171. X   DB_PRINT( "cell", ("Defining prerequisite %s", prq->CE_NAME) );
  1172. X
  1173. X   if( (prq->ce_flag & (F_MAGIC | F_PERCENT)) && !force )
  1174. X      Fatal( "Special target [%s] cannot be a prerequisite",
  1175. X             prq->CE_NAME );
  1176. X
  1177. X   if( cell->ce_prq == NIL(LINK) ) {    /* it's the first one    */
  1178. X      TALLOC( lp, 1, LINK );
  1179. X      lp->cl_prq   = prq;
  1180. X      cell->ce_prq = lp;
  1181. X   }
  1182. X   else    {    /* search the list, checking for duplicates    */
  1183. X      for( lp = cell->ce_prq;
  1184. X       (lp->cl_next != NIL(LINK)) && (lp->cl_prq != prq);
  1185. X       lp = lp->cl_next );
  1186. X
  1187. X      /* If the prq is not found and we are at the last prq in the list,
  1188. X       * allocate a new prq and place it into the list, insert it at the
  1189. X       * head if head == 1, else we add it to the end. */
  1190. X
  1191. X      if( lp->cl_prq != prq ) {
  1192. X     TALLOC( tlp, 1, LINK );
  1193. X     tlp->cl_prq = prq;
  1194. X
  1195. X     if( head ) {
  1196. X        tlp->cl_next = cell->ce_prq;
  1197. X        cell->ce_prq = tlp;
  1198. X     }
  1199. X     else
  1200. X        lp->cl_next  = tlp;
  1201. X
  1202. X     lp = tlp;
  1203. X      }
  1204. X   }
  1205. X
  1206. X   DB_RETURN( lp );
  1207. }
  1208. X
  1209. X
  1210. X
  1211. PUBLIC void
  1212. Clear_prerequisites( cell )/*
  1213. =============================
  1214. X    Clear out the list of prerequisites, freeing all of the LINK nodes,
  1215. X    and setting the list to NULL */
  1216. CELLPTR cell;
  1217. {
  1218. X   LINKPTR lp, tlp;
  1219. X
  1220. X   DB_ENTER( "Clear_prerequisites" );
  1221. X   DB_PRINT( "cell", ("Nuking prerequisites") );
  1222. X
  1223. X   if( cell == NIL(CELL) ) { DB_VOID_RETURN; }
  1224. X
  1225. X   for( lp=cell->ce_prq; lp != NIL(LINK); lp=tlp ) {
  1226. X      tlp=lp->cl_next;
  1227. X      FREE( lp );
  1228. X   }
  1229. X
  1230. X   cell->ce_prq = NIL(LINK);
  1231. X
  1232. X   DB_VOID_RETURN;
  1233. }
  1234. X
  1235. X
  1236. PUBLIC int
  1237. Test_circle( cp, fail )/*
  1238. =========================
  1239. X    Actually run through the graph */
  1240. CELLPTR cp;
  1241. int     fail;
  1242. {
  1243. X   register LINKPTR lp;
  1244. X   int res = 0;
  1245. X
  1246. X   DB_ENTER( "Test_circle" );
  1247. X   DB_PRINT( "tc", ("checking [%s]", cp->CE_NAME) );
  1248. X
  1249. X   if( cp->ce_flag & F_MARK )
  1250. X      if( fail )
  1251. X     Fatal("Detected circular dependency in graph at [%s]", cp->CE_NAME);
  1252. X      else
  1253. X     DB_RETURN( 1 );
  1254. X
  1255. X   cp->ce_flag |= F_MARK;
  1256. X   for( lp = cp->ce_prq; !res && lp != NIL(LINK); lp = lp->cl_next )
  1257. X      res = Test_circle( lp->cl_prq, fail );
  1258. X   cp->ce_flag ^= F_MARK;
  1259. X
  1260. X   DB_RETURN( res );
  1261. }
  1262. X
  1263. X
  1264. X
  1265. PUBLIC STRINGPTR
  1266. Def_recipe( rcp, sp, white_too, no_check )/*
  1267. =============================================
  1268. X    Take the recipe and add it to the list of recipes
  1269. X    pointed to by sp.  sp points to the last element.
  1270. X    return a pointer to the new recipe.  If white_too == TRUE add the
  1271. X    recipe even if it contains only white space.
  1272. X    If no_check is true then don't look for -@ at the start of the
  1273. X    recipe line. */
  1274. char      *rcp;
  1275. STRINGPTR sp;
  1276. int       white_too;
  1277. int       no_check;
  1278. {
  1279. X   register STRINGPTR nsp;
  1280. X   register char      *rp;
  1281. X
  1282. X   DB_ENTER( "Def_recipe" );
  1283. X   DB_PRINT( "rul", ("Defining recipe %s", rcp) );
  1284. X
  1285. X   if( !white_too ) rcp = _strspn( rcp, " \t" );
  1286. X   if( (rcp == NIL(char)) || (*rcp == 0 && !white_too) )
  1287. X      DB_RETURN( sp );         /* return last recipe when new recipe not added */
  1288. X
  1289. X   rp = no_check ? rcp : _strspn( rcp, " \t@-+%" );
  1290. X
  1291. X   TALLOC( nsp, 1, STRING );
  1292. X   nsp->st_string = _strdup( rp );
  1293. X
  1294. X   if( sp != NIL(STRING) ) sp->st_next = nsp;
  1295. X   nsp->st_next = NIL(STRING);
  1296. X
  1297. X   if( !no_check ) nsp->st_attr |= Rcp_attribute( rcp );
  1298. X
  1299. X   DB_RETURN( nsp );
  1300. }
  1301. X
  1302. X
  1303. PUBLIC t_attr
  1304. Rcp_attribute( rp )/*
  1305. ======================
  1306. X   Look at the recipe and return the set of attributes that it defines. */
  1307. char *rp;
  1308. {
  1309. X   t_attr flag = A_DEFAULT;
  1310. X   int    done = FALSE;
  1311. X
  1312. X   while( !done )
  1313. SHAR_EOF
  1314. true || echo 'restore of dmake/dag.c failed'
  1315. fi
  1316. echo 'End of part 1, continue with part 2'
  1317. echo 2 > _shar_seq_.tmp
  1318. exit 0
  1319.  
  1320. exit 0 # Just in case...
  1321. -- 
  1322. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1323. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1324. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1325. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1326.