dvadura@watdragon.waterloo.edu (Dennis Vadura) (05/10/91)
Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu> Posting-number: Volume 19, Issue 22 Archive-name: dmake/part01 Supersedes: dmake-3.6: Volume 15, Issue 52-77 This is the DMAKE version 3.7 distribution. DMAKE is a Make like tool that has been written by me and has been used by individuals at the University of Waterloo. This release replaces the previous version 3.6 release which is no longer supported. Please read the file 'readme/release' which accompanies this distribution and describes details of this release (This note is found in readme/cover). dmake is different from other versions of make in that it supports significant enhancements (See the man page). A short summary of the more important ones follows: . support for portable makefiles . runs on many platforms (DOS, generic unix [sysv and bsd4.3], apollo, OS/2, Atari, and many others) . significantly enhanced macro facilities . transitive closure on inference graph . sophisticated inference algorithm . support for traversing the file sytem both during making of targets and during inference . %-meta rules for specifying rules to be used for inferring prerequisites . highly configurable . support for libraries . parallel making of targets on architectures that support it . attributed targets . text diversions . group recipes . swapping itself to DISK under MSDOS . supports MKS extended argument passing convention All code found in this distribution is original and written by me except where noted in the source and the following: - dbug/dbug package from Fred Fish (dmake DEBUG=1, to make a debugging version of dmake) - malloc.c package in dbug/malloc from the NET, see the directory for attribution. -dennis ---- Cut Here and feed the following to sh ---- #!/bin/sh # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". # # made 05/07/1991 17:29 UTC by dvadura@watmsg # Source directory /u2/dvadura/t/dmake # # existing files will NOT be overwritten unless -c is specified # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 7454 -rw-r----- dmake/_install # 1357 -rw-r----- dmake/_state.mk # 2243 -rw-r----- dmake/alloc.h # 1749 -rw-r----- dmake/basename.c # 13797 -rw-r----- dmake/dag.c # 2696 -rw-r----- dmake/db.h # 460 -rw-r----- dmake/dbug/README # 1955 -rw-r----- dmake/dbug/dbug.mk # 44504 -rw-r----- dmake/dbug/dbug/dbug.c # 6259 -rw-r----- dmake/dbug/dbug/dbug.h # 42893 -rw-r-x--- dmake/dbug/dbug/dbug.p # 106 -rw-r----- dmake/dbug/getwd.c # 1365 -rw-r----- dmake/dbug/malloc/Makefile # 369 -rw-r----- dmake/dbug/malloc/_changes # 4758 -rw-r----- dmake/dbug/malloc/_readme # 1481 -rw-r----- dmake/dbug/malloc/calloc.c # 2628 -rw-r----- dmake/dbug/malloc/debug.h # 3179 -rw-r----- dmake/dbug/malloc/dump.c # 4513 -rw-r----- dmake/dbug/malloc/free.c # 2022 -rw-r----- dmake/dbug/malloc/m_init.c # 1973 -rw-r----- dmake/dbug/malloc/m_perror.c # 6712 -rw-r----- dmake/dbug/malloc/malloc.3 # 12765 -rw-r----- dmake/dbug/malloc/malloc.c # 2487 -rw-r----- dmake/dbug/malloc/malloc.h # 2281 -rw-r----- dmake/dbug/malloc/mallopt.c # 3505 -rw-r----- dmake/dbug/malloc/memory.c # 6308 -rw-r----- dmake/dbug/malloc/mlc_chk.c # 3449 -rw-r----- dmake/dbug/malloc/mlc_chn.c # 2 -rw-r----- dmake/dbug/malloc/patchlevel # 4659 -rw-r----- dmake/dbug/malloc/realloc.c # 9382 -rw-r----- dmake/dbug/malloc/string.c # 20192 -rw-r----- dmake/dbug/malloc/testmem.c # 3971 -rw-r----- dmake/dbug/malloc/testmlc.c # 2716 -rw-r----- dmake/dbug/malloc/tostring.c # 491 -rw-r----- dmake/dbug/malloc/tostring.h # 20025 -rw-r----- dmake/dmake.c # 8165 -rw-r----- dmake/dmake.h # 5857 -rw-r----- dmake/dmdump.c # 5809 -rw-r----- dmake/dmstring.c # 25368 -rw-r----- dmake/expand.c # 2089 -rw-r----- dmake/extern.h # 8398 -rw-r----- dmake/function.c # 13281 -rw-r----- dmake/getinp.c # 2324 -rw-r----- dmake/hash.c # 5479 -rw-r----- dmake/imacs.c # 24179 -rw-r----- dmake/infer.c # 1809 -rw-r----- dmake/itypes.h # 4771 -rw-r----- dmake/macparse.c # 5076 -rw-r----- dmake/make.bat # 27141 -rw-r----- dmake/make.c # 1124 -rw-r----- dmake/make.cmd # 10539 -rw-r----- dmake/makefile.mk # 2763 -rw-r----- dmake/makefile # 117216 -rw-r----- dmake/man/dmake.nc # 125280 -rw-r----- dmake/man/dmake.p # 97989 -rw-r----- dmake/man/dmake.tf # 2019 -rw-r----- dmake/msdos/_chdir.c # 1946 -rw-r----- dmake/msdos/arlib.c # 1901 -rw-r----- dmake/msdos/bccdos/config.h # 1400 -rw-r----- dmake/msdos/bccdos/config.mk # 17 -rw-r----- dmake/msdos/bccdos/lib.rsp # 17 -rw-r----- dmake/msdos/bccdos/libswp.rsp # 2868 -rw-r----- dmake/msdos/bccdos/mk.bat # 3018 -rw-r----- dmake/msdos/bccdos/mkswp.bat # 635 -rw-r----- dmake/msdos/bccdos/obj.rsp # 673 -rw-r----- dmake/msdos/bccdos/objswp.rsp # 5622 -rw-r----- dmake/msdos/bccdos/public.h # 3795 -rw-r----- dmake/msdos/bccdos/startup.mk # 1724 -rw-r----- dmake/msdos/bccdos/tempnam.c # 767 -rw-r----- dmake/msdos/bccdos/utime.c # 1663 -rw-r----- dmake/msdos/config.mk # 1776 -rw-r----- dmake/msdos/dirbrk.c # 1086 -rw-r----- dmake/msdos/dirlib.h # 37176 -rw-r----- dmake/msdos/exec.asm # 351 -rw-r----- dmake/msdos/exec.h # 3671 -rw-r----- dmake/msdos/exec.uue # 2140 -rw-r----- dmake/msdos/find.c # 2467 -rw-r----- dmake/msdos/mscdos/config.h # 2419 -rw-r----- dmake/msdos/mscdos/config.mk # 1 -rw-r----- dmake/msdos/mscdos/lib.rsp # 1 -rw-r----- dmake/msdos/mscdos/libswp.rsp # 2512 -rw-r----- dmake/msdos/mscdos/mk40.bat # 2654 -rw-r----- dmake/msdos/mscdos/mk40swp.bat # 2932 -rw-r----- dmake/msdos/mscdos/mk50.bat # 3088 -rw-r----- dmake/msdos/mscdos/mk50swp.bat # 2932 -rw-r----- dmake/msdos/mscdos/mk51.bat # 3088 -rw-r----- dmake/msdos/mscdos/mk51swp.bat # 2932 -rw-r----- dmake/msdos/mscdos/mk60.bat # 3088 -rw-r----- dmake/msdos/mscdos/mk60swp.bat # 593 -rw-r----- dmake/msdos/mscdos/obj.rsp # 631 -rw-r----- dmake/msdos/mscdos/objswp.rsp # 49 -rw-r----- dmake/msdos/mscdos/optoff.h # 5622 -rw-r----- dmake/msdos/mscdos/public.h # 3822 -rw-r----- dmake/msdos/mscdos/startup.mk # 1754 -rw-r----- dmake/msdos/mscdos/tempnam.c # 1640 -rw-r----- dmake/msdos/rmprq.c # 1951 -rw-r----- dmake/msdos/ruletab.c # 2611 -rw-r----- dmake/msdos/runargv.c # 12750 -rw-r----- dmake/msdos/spawn.c # 392 -rw-r----- dmake/msdos/startup.h # 373 -rw-r----- dmake/msdos/stdarg.h # 926 -rw-r----- dmake/msdos/switchar.c # 301 -rw-r----- dmake/msdos/sysintf.h # 1897 -rw-r----- dmake/msdos/tccdos/config.h # 1400 -rw-r----- dmake/msdos/tccdos/config.mk # 17 -rw-r----- dmake/msdos/tccdos/lib.rsp # 17 -rw-r----- dmake/msdos/tccdos/libswp.rsp # 2992 -rw-r----- dmake/msdos/tccdos/mk.bat # 3146 -rw-r----- dmake/msdos/tccdos/mkswp.bat # 635 -rw-r----- dmake/msdos/tccdos/obj.rsp # 673 -rw-r----- dmake/msdos/tccdos/objswp.rsp # 5622 -rw-r----- dmake/msdos/tccdos/public.h # 3795 -rw-r----- dmake/msdos/tccdos/startup.mk # 1724 -rw-r----- dmake/msdos/tccdos/tempnam.c # 767 -rw-r----- dmake/msdos/tccdos/utime.c # 1353 -rw-r----- dmake/msdos/tee.c # 1746 -rw-r----- dmake/os2/_chdir.c # 1536 -rw-r----- dmake/os2/config.mk # 24 -rw-r----- dmake/os2/dmake.bad # 427 -rw-r----- dmake/os2/dmake.cs # 121 -rw-r----- dmake/os2/dmake.def # 2414 -rw-r----- dmake/os2/mscdos/config.h # 2282 -rw-r----- dmake/os2/mscdos/config.mk # 3820 -rw-r----- dmake/os2/mscdos/dmake.ini # 1 -rw-r----- dmake/os2/mscdos/lib.rsp # 3330 -rw-r----- dmake/os2/mscdos/mk40.cmd # 3407 -rw-r----- dmake/os2/mscdos/mk50.cmd # 3407 -rw-r----- dmake/os2/mscdos/mk51.cmd # 3407 -rw-r----- dmake/os2/mscdos/mk60.cmd # 576 -rw-r----- dmake/os2/mscdos/obj.rsp # 49 -rw-r----- dmake/os2/mscdos/optoff.h # 5614 -rw-r----- dmake/os2/mscdos/public.h # 132 -rw-r----- dmake/os2/mscdos/startup.mk # 1919 -rw-r----- dmake/os2/mscdos/tempnam.c # 2098 -rw-r----- dmake/os2/ruletab.c # 7611 -rw-r----- dmake/os2/runargv.c # 384 -rw-r----- dmake/os2/startup.h # 373 -rw-r----- dmake/os2/stdarg.h # 904 -rw-r----- dmake/os2/switchar.c # 333 -rw-r----- dmake/os2/sysintf.h # 5207 -rw-r----- dmake/parse.c # 88 -rw-r----- dmake/patchlvl.h # 3063 -rw-r----- dmake/path.c # 7050 -rw-r----- dmake/percent.c # 2194 -rw-r----- dmake/quit.c # 626 -rw-r----- dmake/readme/atari.tos # 1988 -rw-r----- dmake/readme/cover # 5848 -rw-r----- dmake/readme/msdos # 5581 -rw-r----- dmake/readme/os2 # 17984 -rw-r----- dmake/readme/release # 39277 -rw-r----- dmake/rulparse.c # 7761 -rw-r----- dmake/stat.c # 5520 -rw-r----- dmake/state.c # 1943 -rw-r----- dmake/stdmacs.h # 9748 -rw-r----- dmake/struct.h # 14629 -rw-r----- dmake/sysintf.c # 13294 -rw-r----- dmake/tos/arlib.c # 1874 -rw-r----- dmake/tos/config.h # 1262 -rw-r----- dmake/tos/config.mk # 1881 -rw-r----- dmake/tos/dirbrk.c # 1480 -rw-r----- dmake/tos/make.sh # 5553 -rw-r----- dmake/tos/public.h # 2923 -rw-r----- dmake/tos/putenv.c # 1716 -rw-r----- dmake/tos/rmprq.c # 1957 -rw-r----- dmake/tos/ruletab.c # 2542 -rw-r----- dmake/tos/runargv.c # 392 -rw-r----- dmake/tos/startup.h # 3233 -rw-r----- dmake/tos/startup.mk # 442 -rw-r----- dmake/tos/sysintf.h # 1506 -rw-r----- dmake/tos/tempnam.c # 46 -rw-r----- dmake/unix/386ix/ar.h # 1998 -rw-r----- dmake/unix/386ix/config.h # 745 -rw-r----- dmake/unix/386ix/config.mk # 2126 -rw-r----- dmake/unix/386ix/make.sh # 5521 -rw-r----- dmake/unix/386ix/public.h # 3221 -rw-r----- dmake/unix/386ix/startup.mk # 373 -rw-r----- dmake/unix/386ix/stdarg.h # 346 -rw-r----- dmake/unix/386ix/stdlib.h # 133 -rw-r----- dmake/unix/386ix/time.h # 14467 -rw-r----- dmake/unix/arlib.c # 2075 -rw-r----- dmake/unix/bsd43/config.h # 796 -rw-r----- dmake/unix/bsd43/config.mk # 2489 -rw-r----- dmake/unix/bsd43/make.sh # 5521 -rw-r----- dmake/unix/bsd43/public.h # 2930 -rw-r----- dmake/unix/bsd43/putenv.c # 1581 -rw-r----- dmake/unix/bsd43/setvbuf.c # 3221 -rw-r----- dmake/unix/bsd43/startup.mk # 409 -rw-r----- dmake/unix/bsd43/stdarg.h # 346 -rw-r----- dmake/unix/bsd43/stdlib.h # 292 -rw-r----- dmake/unix/bsd43/string.h # 1506 -rw-r----- dmake/unix/bsd43/tempnam.c # 808 -rw-r----- dmake/unix/bsd43/utime.c # 521 -rw-r----- dmake/unix/bsd43/uw/config.mk # 2977 -rw-r----- dmake/unix/bsd43/uw/make.sh # 5524 -rw-r----- dmake/unix/bsd43/uw/public.h # 3239 -rw-r----- dmake/unix/bsd43/uw/startup.mk # 317 -rw-r----- dmake/unix/bsd43/vf/config.mk # 782 -rw-r----- dmake/unix/bsd43/vf/ctype.h # 3196 -rw-r----- dmake/unix/bsd43/vf/make.sh # 137 -rw-r----- dmake/unix/bsd43/vf/memcpy.c # 5524 -rw-r----- dmake/unix/bsd43/vf/public.h # 3221 -rw-r----- dmake/unix/bsd43/vf/startup.mk # 1409 -rw-r----- dmake/unix/bsd43/vf/vfprintf.c # 1031 -rw-r----- dmake/unix/config.mk # 1812 -rw-r----- dmake/unix/dirbrk.c # 3504 -rw-r----- dmake/unix/explode.c # 3634 -rw-r----- dmake/unix/rmprq.c # 1939 -rw-r----- dmake/unix/ruletab.c # 6758 -rw-r----- dmake/unix/runargv.c # 412 -rw-r----- dmake/unix/startup.h # 441 -rw-r----- dmake/unix/sysintf.h # 1999 -rw-r----- dmake/unix/sysvr1/config.h # 761 -rw-r----- dmake/unix/sysvr1/config.mk # 2251 -rw-r----- dmake/unix/sysvr1/make.sh # 5522 -rw-r----- dmake/unix/sysvr1/public.h # 2931 -rw-r----- dmake/unix/sysvr1/putenv.c # 3221 -rw-r----- dmake/unix/sysvr1/startup.mk # 430 -rw-r----- dmake/unix/sysvr1/stdarg.h # 346 -rw-r----- dmake/unix/sysvr1/stdlib.h # 133 -rw-r----- dmake/unix/sysvr1/time.h # 934 -rw-r----- dmake/unix/sysvr1/vfprintf.c # 2106 -rw-r----- dmake/unix/sysvr3/config.h # 750 -rw-r----- dmake/unix/sysvr3/config.mk # 2153 -rw-r----- dmake/unix/sysvr3/make.sh # 5522 -rw-r----- dmake/unix/sysvr3/public.h # 3221 -rw-r----- dmake/unix/sysvr3/startup.mk # 469 -rw-r----- dmake/unix/sysvr3/stdarg.h # 428 -rw-r----- dmake/unix/sysvr3/stdlib.h # 133 -rw-r----- dmake/unix/sysvr3/time.h # 2015 -rw-r----- dmake/unix/sysvr4/config.h # 750 -rw-r----- dmake/unix/sysvr4/config.mk # 2153 -rw-r----- dmake/unix/sysvr4/make.sh # 5522 -rw-r----- dmake/unix/sysvr4/public.h # 3187 -rw-r----- dmake/unix/sysvr4/startup.mk # 819 -rw-r----- dmake/unix/sysvr4/stdarg.h # 53 -rw-r----- dmake/version.h # 4702 -rw-r----- dmake/vextern.h # 12487 -rw-r----- dmake/LICENSE # if test -r _shar_seq_.tmp; then echo 'Must unpack archives in sequence!' echo Please unpack part `cat _shar_seq_.tmp` next exit 1 fi # ============= dmake/_install ============== if test ! -d 'dmake'; then mkdir 'dmake' fi if test -f 'dmake/_install' -a X"$1" != X"-c"; then echo 'x - skipping dmake/_install (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/_install' && INSTALLATION INSTRUCTIONS X This file contains the instructions required to install and create the appropriate version of dmake. X NOTE: If you use dmake to bootstrap a NEW DISTRIBUTED version or to remake X it after applying a PATCH, it may be NECESSARY to use the batch X script instead of dmake as some patches incorporate changes to the X makefile.mk file and associated config.mk files that cannot be X handled by earlier versions of dmake. The use of the batch files X is the ONLY supported method of making a new release or update X version. X MAKING THE PROPER VERSION X The list of available versions of dmake has grown quite large. The best method to determine what versions are available for your configuration is to simply issue the command 'make' in the source root directory. Below is a partial list of the available versions to give an idea of what is supported. Note that this copy of the list is not maintained up to date. X X bsd43 - Generic BSD 4.3 (eg, true BSD, apollo, sun OS4, SGI etc) X bsd43uw - Generic BSD 4.3 at U of Waterloo X bsd43vf - Generic BSD with no vfprintf in its library (use this X target if you are missing vfprintf function in your X C library) X sysvr3 - Generic SysV R3 UNIX X sysvr1 - Generic SysV R1 UNIX X 386ix - 386/ix (SysV R3), not tested X dynix - Sequent Symmetry dynix X ultrix - Ultrix 3.0 system X mips - Any MIPS box X os2msc60 - OS/2 with MSC 6.0 X tos - Atari-ST using GCC as compiler X tcc - DOS with tcc 2.0 X tccswp - swapping DOS version with tcc 2.0 X msc60 - DOS with MSC 6.0 X msc60swp - swapping DOS version with MSC 6.0 X The file 'makefile' understands these targets and runs the appropriate script to create the correct version. X The source code is organized as follows: X X dmake [source for all common functions] X | X | X ---------------------------- X | | | | X unix tos os2 msdos [source for OS specific functions] X | | | X -------------------- mscdos ------------------- X | | | | | | 386ix bsd43 sysvr[134] tccdos bccdos mscdos [source for OSRELEASE X | specific functions] X -------- X | | X uw vf [source for OSENVIRONMENT specific functions] X X Each of the directories (eg. bsd43, mscdos, tccdos, and sysvr3) contain source that is specific to that release of the OS (and possibly C-library) To make the apropriate versions of dmake, simply type the command X X 'make system' X where system is one of the supplied possibilities. For a complete list of the versions you can make, see the comments in the file 'makefile', or type 'make'. X The bootstrapping of dmake is accomplished by running a shell script with the appropriate compile commands hard coded. X (NOTE: If you are using MSDOS then, you will actually be using the make.bat X scriptfile to make the correct version of dmake for MSDOS. If you X are running a SHELL other than command.com, you may have to perform X some extra work to invoke the batch file. X X Make sure you read the readme/msdos file before attempting to make the X MSDOS version, as it contains important configuration and limitation X information.) X The making of dmake, echoes the commands being executed, and should proceed relatively error free. Ignore any warnings that concern unused arguments to functions, these are normal in some configurations (esp the MSDOS configuration). X X STARTUP FILE X dmake requires the loading of a startup file when it is first invoked. The path for the startup file is set in the file 'startup.h' found in the unix and msdos directories. You may override the value of the path variable compiled-in by creating a file at the root source directory called startup.h and inserting into that file a definition that is like the definition found in the supplied startup.h files. X X INSTALLATION X To install dmake you must copy the executable to where your system locates executables, and you must place a copy of startup.mk (found in the directory corresponding to the version you just made) into a location corresponding to the value of the MAKESTARTUP macro or environment variable. You are free to customize the contents of startup.mk. X To make dmake again, (using itself), you will have to set three environment variables. See the file makefile.mk for their names and their legal values. Once set you can invoke dmake to make itself. X X DOCUMENTATION X All documentation for dmake appears under the man directory. The file dmake.tf included in this distribution contains the troff source for the man page. You must typeset it using the -man macros. If you cannot typeset it, the file dmake.p is a version that has been typeset for a normal dumb terminal. The file dmake.p contains control characters. The file dmake.nc is a version of the man page that has all of the control characters stripped. X X CREATING A NEW VERSION X To create yet another version of dmake you should follow the following steps. X The sysvr3 version as sent is the base version, all dmake versions must provide the equivalent of the functions defined in the sysvr3 directory, and MUST provide the same semantics (MSDOS archive lib searches are an exception since we cannot search libraries for timestamps in MSDOS, Actually the MKS version of dmake does this, I don't have the inclination to add this code though). X 1. Create a new directory for the version you will be making at the level X that is appropriate. If it is a new OS then add the dir at the top level, X if it is a new version of UNIX then add it below the unix directory. X 2. Copy the files from the unix and unix/sysvr3 directories to the new dir. X (Or from any other directory sub-tree that is more appropriate) X 3. Not all OS/OSRELEASE combinations are compatible so in order to make X dmake on each, the particular directory may contain C-source for functions X present in the SVID SysV R3 distribution which are used by dmake but are X not supplied by the C-library in the target system. For example the bsd43 X directory contains source for tempnam.c since it is not provided with X the BSD C-library. Before writing a new version of the source file X check the other directories to see if one already exists. X 4. Under some systems the standard include files may be missing or incorrect. X eg. under BSD stdarg.h and string.h. If this is the case X you should create the proper .h file in the proper directory. X This works as expected as the compile line includes the flag -Idir X where dir is the configuration dir, (bsd43 for example) and any X standard include files will be searched for in dir before the compiler X looks in the normal places (if you have a sane compiler :-). X 5. Modify dmake.sh to contain the appropriate C compiler flags and link command X and to include any specific C files that you have had to add for this X version of dmake, and run the result through the shell. X (make the same changes to config.mk so that once you have a working copy of X dmake you can use it to bring itself up to date) X 6. Send me the changes :-) so that I can incorporate them into future X distributions. X 7. This should be all that you require to create a new version of dmake. X If you have any questions send e-mail to dvadura@watdragon.uwaterloo.ca SHAR_EOF chmod 0640 dmake/_install || echo 'restore of dmake/_install failed' Wc_c="`wc -c < 'dmake/_install'`" test 7454 -eq "$Wc_c" || echo 'dmake/_install: original size 7454, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/_state.mk ============== if test -f 'dmake/_state.mk' -a X"$1" != X"-c"; then echo 'x - skipping dmake/_state.mk (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/_state.mk' && 20 clean 0 3141552312 2794859647 unix-scripts 0 3141552312 695282322 atari-tos-scripts 0 3141552312 1048669739 msdos-tcc-scripts 0 3141552312 2819684817 msdos-bcc-scripts 0 3141552312 105519771 40 0 3141552312 3141559070 50 0 3141552312 3141559199 51 0 3141552312 3141559200 60 0 3141552312 3141559328 msdos-msc-scripts 0 3141552312 128422636 msdos-scripts 0 3141552312 649961888 os2-msc-scripts 0 3141552312 749865848 os2-scripts 0 3141552312 2533154572 scripts 0 3141552312 2153859015 dmake.tf 0 1783847975 2294589697 dmake.p 0 1783847975 2913656604 dmake.nc 0 1783847975 3278359365 man 0 1783847975 1785674470 src-list 0 3141552312 2925313848 dmake.tar 0 3141552312 119295219 dmake.zoo 0 3141552312 4277544073 objects 0 3141552312 2001142999 dmake.h 0 3141552312 1592190551 extern.h 0 3141552312 2028269932 struct.h 0 3141552312 4027113723 vextern.h 0 3141552312 4129343971 patchlvl.h 0 3141552312 4035860406 version.h 0 3141552312 929790173 infer.c 0 3141552312 3196224996 infer.o 0 3141552312 3791079514 make.c 0 3141552312 2741942765 make.o 0 3141552312 1306455157 dmake.shar 0 3141552312 769957504 archives 0 3141552312 3274605333 clean 0 308702675 4256977306 dmake.tf 0 1778471746 3774268244 dmake.p 0 1778471746 2908280375 dmake.nc 0 1778471746 3272983136 man 0 1778471746 1780298241 src-list 0 308702675 92464211 dmake.shar 0 308702675 2232075163 SHAR_EOF chmod 0640 dmake/_state.mk || echo 'restore of dmake/_state.mk failed' Wc_c="`wc -c < 'dmake/_state.mk'`" test 1357 -eq "$Wc_c" || echo 'dmake/_state.mk: original size 1357, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/alloc.h ============== if test -f 'dmake/alloc.h' -a X"$1" != X"-c"; then echo 'x - skipping dmake/alloc.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/alloc.h' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/alloc.h,v 1.1 91/05/06 15:23:03 dvadura Exp $ -- SYNOPSIS -- macros for allocating memory. -- -- DESCRIPTION -- A somewhat nicer interface to malloc and calloc. -- Here we standardise the calling convention with a common macro -- interface. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: alloc.h,v $ X * Revision 1.1 91/05/06 15:23:03 dvadura X * dmake Release Version 3.7 X * */ X #ifndef ALLOC_h #define ALLOC_h X /* DO NOT CHANGE these! These are the definitions that the make source X * uses for allocating memory. They must be defined for make to compile X * properly. X */ X /* This is the only place that we define size_t now. This should be more X * than enough! */ #if __STDC__ #else # if !defined(_TYPES_) && !defined(M_XENIX) && !defined(atarist) && !defined(_SIZE_T) # if defined(MSDOS) || defined(__MSDOS__) X typedef unsigned size_t; # else X typedef long size_t; # endif # endif #endif X #define usizeof(t) (size_t)sizeof(t) X #define FREE(p) free((char*)(p)) #define MALLOC(n, t) (t*) malloc((unsigned int)(n)*usizeof(t)) #define CALLOC(n, t) (t*) calloc((unsigned int)(n), usizeof(t)) X #define TALLOC(p, n, t) if ((p = CALLOC(n, t)) == (t*)0) {No_ram();} X #endif X SHAR_EOF chmod 0640 dmake/alloc.h || echo 'restore of dmake/alloc.h failed' Wc_c="`wc -c < 'dmake/alloc.h'`" test 2243 -eq "$Wc_c" || echo 'dmake/alloc.h: original size 2243, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/basename.c ============== if test -f 'dmake/basename.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/basename.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/basename.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/basename.c,v 1.1 91/05/06 15:23:04 dvadura Exp $ -- SYNOPSIS -- return pointer to last pathname component -- -- DESCRIPTION -- take a file name like /fred/foo/hoe/mary.k, and return the 'mary.k' -- portion -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: basename.c,v $ X * Revision 1.1 91/05/06 15:23:04 dvadura X * dmake Release Version 3.7 X * */ X #include "extern.h" X PUBLIC char* basename( path ) char *path; { X char *p; X char *q; X X if( *(q = path) ) { X for(; *(p=_strpbrk(q, DirBrkStr)) != '\0'; q = p+1 ); X if( !*q ) { X for( p=q-1; p != path; --p ) X if( strchr( DirBrkStr, *p ) == NIL(char) ) return( p+1 ); X return( strchr(DirBrkStr, *p)?path:(p+1) ); X } X path = q; X } X return( path ); } SHAR_EOF chmod 0640 dmake/basename.c || echo 'restore of dmake/basename.c failed' Wc_c="`wc -c < 'dmake/basename.c'`" test 1749 -eq "$Wc_c" || echo 'dmake/basename.c: original size 1749, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= dmake/dag.c ============== if test -f 'dmake/dag.c' -a X"$1" != X"-c"; then echo 'x - skipping dmake/dag.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp sed 's/^X//' << 'SHAR_EOF' > 'dmake/dag.c' && /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/dag.c,v 1.1 91/05/06 15:23:04 dvadura Exp $ -- SYNOPSIS -- Routines to construct the internal dag. -- -- DESCRIPTION -- This file contains all the routines that are responsible for -- defining and manipulating all objects used by the make facility. -- -- AUTHOR -- Dennis Vadura, dvadura@watdragon.uwaterloo.ca -- CS DEPT, University of Waterloo, Waterloo, Ont., Canada -- -- COPYRIGHT -- Copyright (c) 1990 by Dennis Vadura. All rights reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- (version 1), as published by the Free Software Foundation, and -- found in the file 'LICENSE' included with this distribution. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warrant of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -- -- LOG -- $Log: dag.c,v $ X * Revision 1.1 91/05/06 15:23:04 dvadura X * dmake Release Version 3.7 X * */ X #include "extern.h" X X PUBLIC HASHPTR Get_name( name, tab, define )/* =============================== X Look to see if the name is defined, if it is then return X a pointer to its node, if not return NIL(HASH). X If define is TRUE and the name is not found it will be added. */ X char *name; /* name we are looking for */ HASHPTR *tab; /* the hash table to look in */ int define; /* TRUE => add to table */ { X register HASHPTR hp; X register char *p; X uint16 hv; X uint32 hash_key; X X DB_ENTER( "Get_name" ); X DB_PRINT( "name", ("Looking for %s", name) ); X X hp = Search_table( tab, name, &hv, &hash_key ); X X if( hp == NIL(HASH) && define ) { X /* Check to make sure that CELL name contains only printable chars */ X for( p=name; *p; p++ ) X if( !isprint(*p) ) X Fatal( "Name contains non-printable character [0x%02x]", *p ); X X TALLOC( hp, 1, HASH ); /* allocate a cell and add it in */ X X hp->ht_name = _strdup( name ); X hp->ht_hash = hash_key; X hp->ht_next = tab[ hv ]; X tab[ hv ] = hp; X X DB_PRINT( "name", ("Adding %s", name) ); X } X X DB_PRINT( "name",("Returning: [%s,%lu]", X (hp == NIL(HASH)) ? "":hp->ht_name, hv) ); X DB_RETURN( hp ); } X X PUBLIC HASHPTR Search_table( tab, name, phv, phkey ) HASHPTR *tab; char *name; uint16 *phv; uint32 *phkey; { X HASHPTR hp; X X *phv = Hash( name, phkey ); X X for( hp = tab[ *phv ]; hp != NIL(HASH); hp = hp->ht_next ) X if( hp->ht_hash == *phkey X && !strcmp(hp->ht_name, name) ) X break; X X return( hp ); } X X PUBLIC HASHPTR Def_macro( name, value, flags )/* ================================= X This routine is used to define a macro, and it's value. X The flags indicates if it is a permanent macro or if it's value X can be redefined. A flags of M_PRECIOUS means it is a precious X macro and cannot be further redefined. If the flags flag also X contains the M_MULTI bit it means that the macro can be redefined X multiple times and no warning of the redefinitions should be issued. X Once a macro's VAR flags are set they are preserved through all future X macro definitions. X X Macro definitions that have one of the variable bits set are treated X specially. In each case the hash table entry var field points at the X global variable that can be set by assigning to the macro. X X bit valued global vars must be computed when the macro value is changed. X char valued global vars must have the first char of ht_value copied to X them. string valued global vars have the same value as ht_value and should X just have the new value of ht_value copied to them. */ X char *name; /* macro name to define */ char *value; /* macro value to set */ int flags; /* initial ht_flags */ { X register HASHPTR hp; X register char *p, *q; X X DB_ENTER( "Def_macro" ); X DB_PRINT( "mac", ("Defining macro %s = %s, %x", name, value, flags) ); X X /* check to see if name is in the table, if so then just overwrite X the previous definition. Otherwise allocate a new node, and X stuff it in the hash table, at the front of any linked list */ X X if( Readenv ) flags |= M_LITERAL; X X hp = Get_name( name, Macs, TRUE ); X X if( (hp->ht_flag & M_PRECIOUS) && !(flags & M_FORCE) ) { X Warning( "Macro `%s' cannot be redefined", name ); X DB_RETURN( hp ); X } X X if( hp->ht_value != NIL(char) ) FREE( hp->ht_value ); X X if( (hp->ht_flag & M_USED) && !((flags | hp->ht_flag) & M_MULTI) ) X Warning( "Macro `%s' redefined after use", name ); X X if( (value != NIL(char)) && (*value) ) { X /* strip out any \<nl> combinations where \ is the current CONTINUATION X * char */ X X for( p = value; (p = strchr(p, CONTINUATION_CHAR)) != NIL(char); ) X if( p[1] == '\n' ) X strcpy( p, p+2 ); X else X p++; X X if( !(flags & M_LITERAL) ) { X p = _strdup( _strspn( value, " \t" ) ); /* strip white space before */ X /* ... and after value */ X if( *p ) { X for(q=p+strlen(p)-1; ((*q == ' ')||(*q == '\t')); q--); X *++q = '\0'; X } X flags &= ~M_LITERAL; X } X else X p = _strdup( value ); /* take string literally */ X X if( !*p ) { /* check if result is "" */ X FREE( p ); X p = NIL(char); X flags |= M_EXPANDED; X } X else if( *_strpbrk( p, "${}" ) == '\0' ) X flags |= M_EXPANDED; X X hp->ht_value = p; X } X else X hp->ht_value = NIL(char); X X /* Assign the hash table flag less the M_MULTI flag, it is used only X * to silence the warning. But carry it over if it was previously X * defined in ht_flag, as this is a permanent M_MULTI variable. */ X X hp->ht_flag = (flags & ~(M_MULTI|M_FORCE)) | X (hp->ht_flag & (M_VAR_MASK | M_MULTI)); X X /* Check for macro variables and make the necessary adjustment in the X * corresponding global variables */ X X if( hp->ht_flag & M_VAR_MASK ) X if( !(flags & M_EXPANDED) ) X Error( "Macro variables must be assigned with :=" ); X else switch( hp->ht_flag & M_VAR_MASK ) /* only one var type per var */ X { X case M_VAR_STRING: X *hp->MV_SVAR = hp->ht_value; X break; X X case M_VAR_CHAR: X *hp->MV_CVAR = (hp->ht_value == NIL(char)) ? '\0':*hp->ht_value; X break; X X case M_VAR_INT: { X int tvalue; X if( hp->MV_IVAR == NIL(int) ) break; /* first time */ X X tvalue = atoi(hp->ht_value); X if( hp->MV_IVAR == &Buffer_size ) { X /* If Buffer_size is modified then make sure you change the X * size of the real buffer as well. */ X tvalue = (tvalue < (BUFSIZ-2)) ? BUFSIZ : tvalue+2; X if( Buffer_size == tvalue ) break; X if( Buffer ) FREE(Buffer); X if((Buffer=MALLOC(tvalue, char)) == NIL(char)) No_ram(); X *Buffer = '\0'; X } X *hp->MV_IVAR = tvalue; X X if( hp->MV_IVAR == &Max_proc || hp->MV_IVAR == &Max_proclmt ) { X if( tvalue < 1 ) X Fatal( "Process limit value must be > 1" ); X X if( Max_proc > Max_proclmt ) X Fatal( "Specified # of processes exceeds limit of [%d]", X Max_proclmt ); X } X } break; X X case M_VAR_BIT: X /* Bit variables are set to 1 if ht_value is not NULL and 0 X * otherwise */ X X if( hp->ht_value == NIL(char) ) X *hp->MV_BVAR &= ~hp->MV_MASK; X else X *hp->MV_BVAR |= hp->MV_MASK; X break; X } X X DB_RETURN( hp ); } X X X PUBLIC CELLPTR Def_cell( name )/* ================== X Take a string passed in and define it as a cell X If the cell exists then return a pointer to it. */ char *name; { X register HASHPTR hp; X register CELLPTR cp; X register CELLPTR lib; X char *member; X char *end; X X DB_ENTER( "Def_cell" ); X X /* Check to see if the cell is a member of the form lib(member) or X * lib((symbol)) and handle the cases appropriately. X * What we do is we look at the target, if it is of the above two X * forms we get the lib, and add the member/symbol to the list of X * prerequisites for the library. If this is a symbol name def'n X * we additionally add the attribute A_SYMBOL, so that stat can X * try to do the right thing. */ X X if( ((member = strchr(name, '(')) != NIL(char)) && X ((end = strrchr(member, ')')) != NIL(char)) && X (member > name) && (member[-1] != '$') && X (end > member+1) && (end[1] == '\0') ) X { X *member++ = *end = '\0'; X X if( (*member == '(') && (member[strlen(member)-1] == ')') ) { X member[ strlen(member)-1 ] = '\0'; X cp = Def_cell( member+1 ); X cp->ce_attr |= A_SYMBOL; X } X else X cp = Def_cell( member ); X X lib = Def_cell( name ); X X Add_prerequisite( lib, cp, FALSE, FALSE ); X lib->ce_attr |= A_LIBRARY | A_COMPOSITE; X X if( !Def_targets ) cp = lib; X } X else { X hp = Get_name( name, Defs, TRUE );/* get the name from hash table */ X X if( hp->CP_OWNR == NIL(CELL) ) /* was it previously defined */ X { /* NO, so define a new cell */ X DB_PRINT( "cell", ("Defining cell [%s]", name) ); X X TALLOC( cp, 1, CELL ); X hp->CP_OWNR = cp; X cp->ce_name = hp; X cp->ce_fname = hp->ht_name; X } X else /* YES, so return the old cell */ X { X DB_PRINT( "cell", ("Getting cell [%s]", hp->ht_name) ); X cp = hp->CP_OWNR; X } X } X X DB_RETURN( cp ); } X X X X PUBLIC LINKPTR Add_prerequisite( cell, prq, head, force )/* ============================================ X Add a dependency node to the dag. It adds it to the prerequisites, X if any, of the cell and makes certain they are in linear order. X If head == 1, then add to head of the prerequisite list, else X add to tail. */ CELLPTR cell; CELLPTR prq; int head; int force; { X register LINKPTR lp, tlp; X X DB_ENTER( "Add_prerequisite" ); X DB_PRINT( "cell", ("Defining prerequisite %s", prq->CE_NAME) ); X X if( (prq->ce_flag & (F_MAGIC | F_PERCENT)) && !force ) X Fatal( "Special target [%s] cannot be a prerequisite", X prq->CE_NAME ); X X if( cell->ce_prq == NIL(LINK) ) { /* it's the first one */ X TALLOC( lp, 1, LINK ); X lp->cl_prq = prq; X cell->ce_prq = lp; X } X else { /* search the list, checking for duplicates */ X for( lp = cell->ce_prq; X (lp->cl_next != NIL(LINK)) && (lp->cl_prq != prq); X lp = lp->cl_next ); X X /* If the prq is not found and we are at the last prq in the list, X * allocate a new prq and place it into the list, insert it at the X * head if head == 1, else we add it to the end. */ X X if( lp->cl_prq != prq ) { X TALLOC( tlp, 1, LINK ); X tlp->cl_prq = prq; X X if( head ) { X tlp->cl_next = cell->ce_prq; X cell->ce_prq = tlp; X } X else X lp->cl_next = tlp; X X lp = tlp; X } X } X X DB_RETURN( lp ); } X X X PUBLIC void Clear_prerequisites( cell )/* ============================= X Clear out the list of prerequisites, freeing all of the LINK nodes, X and setting the list to NULL */ CELLPTR cell; { X LINKPTR lp, tlp; X X DB_ENTER( "Clear_prerequisites" ); X DB_PRINT( "cell", ("Nuking prerequisites") ); X X if( cell == NIL(CELL) ) { DB_VOID_RETURN; } X X for( lp=cell->ce_prq; lp != NIL(LINK); lp=tlp ) { X tlp=lp->cl_next; X FREE( lp ); X } X X cell->ce_prq = NIL(LINK); X X DB_VOID_RETURN; } X X PUBLIC int Test_circle( cp, fail )/* ========================= X Actually run through the graph */ CELLPTR cp; int fail; { X register LINKPTR lp; X int res = 0; X X DB_ENTER( "Test_circle" ); X DB_PRINT( "tc", ("checking [%s]", cp->CE_NAME) ); X X if( cp->ce_flag & F_MARK ) X if( fail ) X Fatal("Detected circular dependency in graph at [%s]", cp->CE_NAME); X else X DB_RETURN( 1 ); X X cp->ce_flag |= F_MARK; X for( lp = cp->ce_prq; !res && lp != NIL(LINK); lp = lp->cl_next ) X res = Test_circle( lp->cl_prq, fail ); X cp->ce_flag ^= F_MARK; X X DB_RETURN( res ); } X X X PUBLIC STRINGPTR Def_recipe( rcp, sp, white_too, no_check )/* ============================================= X Take the recipe and add it to the list of recipes X pointed to by sp. sp points to the last element. X return a pointer to the new recipe. If white_too == TRUE add the X recipe even if it contains only white space. X If no_check is true then don't look for -@ at the start of the X recipe line. */ char *rcp; STRINGPTR sp; int white_too; int no_check; { X register STRINGPTR nsp; X register char *rp; X X DB_ENTER( "Def_recipe" ); X DB_PRINT( "rul", ("Defining recipe %s", rcp) ); X X if( !white_too ) rcp = _strspn( rcp, " \t" ); X if( (rcp == NIL(char)) || (*rcp == 0 && !white_too) ) X DB_RETURN( sp ); /* return last recipe when new recipe not added */ X X rp = no_check ? rcp : _strspn( rcp, " \t@-+%" ); X X TALLOC( nsp, 1, STRING ); X nsp->st_string = _strdup( rp ); X X if( sp != NIL(STRING) ) sp->st_next = nsp; X nsp->st_next = NIL(STRING); X X if( !no_check ) nsp->st_attr |= Rcp_attribute( rcp ); X X DB_RETURN( nsp ); } X X PUBLIC t_attr Rcp_attribute( rp )/* ====================== X Look at the recipe and return the set of attributes that it defines. */ char *rp; { X t_attr flag = A_DEFAULT; X int done = FALSE; X X while( !done ) SHAR_EOF true || echo 'restore of dmake/dag.c failed' fi echo 'End of part 1, continue with part 2' echo 2 > _shar_seq_.tmp exit 0 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.