home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-01-29 | 39.9 KB | 1,078 lines |
- Newsgroups: comp.sources.misc
- From: dvadura@plg.waterloo.edu (Dennis Vadura)
- Subject: v27i131: dmake - dmake Version 3.8, Part30/41
- Message-ID: <1992Jan29.164559.951@sparky.imd.sterling.com>
- X-Md4-Signature: b29dded873933f77ca72ac5a410d2e72
- Date: Wed, 29 Jan 1992 16:45:59 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: dvadura@plg.waterloo.edu (Dennis Vadura)
- Posting-number: Volume 27, Issue 131
- Archive-name: dmake/part30
- Environment: Atari-ST, Coherent, Mac, MSDOS, OS/2, UNIX
- Supersedes: dmake: Volume 19, Issue 22-58
-
- ---- Cut Here and feed the following to sh ----
- # this is dmake.shar.30 (part 30 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file dmake/readme/apple.mac continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 30; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test -f _shar_wnt_.tmp; then
- sed 's/^X//' << 'SHAR_EOF' >> 'dmake/readme/apple.mac' &&
- X
- I added some code so that the Macintosh version of dmake can
- use UNIX-style directories to specify include paths and target
- and dependency file names. I.e., if you specify a file "/dir/file",
- dmake will look at the file "dir:file". However, Mac dmake does not
- do any translation from files specified by UNIX-style directories
- in the recipe line that gets executed. If you need to translate,
- you can use substitution commands. (For example,
- ":$(RELATIVEUNIXFILE:s,/,:,)".) This code was added so one could
- execute dmake's makefile, and also so one would have an easier time
- porting other UNIX makefiles. I would suggest you stick with
- Macintosh-style directories for all other makefiles.
- X
- I was getting memory trashing errors when I was reading in
- environmental variables >4K with the -e option. I had trouble
- tracking down exactly what was causing the problem, so decided it
- was easier to just clip the length before sending it to the dmake
- parser. I arbitrarily picked 1K as the maximum length, figuring
- it was highly unlikely anyone really needed a variable longer than
- that from within a makefile. (This error may be related to the
- value you set for MAXLINELENGTH, so to be safe, you should keep
- it >1K.)
- X
- In order to run dmake, you must set (and export) the environmental
- variable "OS" to "mac".
- X
- Finally, dmake looks for the file startup.mk in
- "{MPW}tools:{DMSTARTUPDIR}". "DMSTARTUPDIR" can be defined if you
- want to override the default tools directory location.
- X
- Micah Doyle
- micah@leland.Stanford.EDU
- SHAR_EOF
- chmod 0640 dmake/readme/apple.mac ||
- echo 'restore of dmake/readme/apple.mac failed'
- Wc_c="`wc -c < 'dmake/readme/apple.mac'`"
- test 1957 -eq "$Wc_c" ||
- echo 'dmake/readme/apple.mac: original size 1957, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/readme/atari.tos ==============
- if test -f 'dmake/readme/atari.tos' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/readme/atari.tos (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/readme/atari.tos' &&
- This file describes the Atari-tos distribution of dmake.
- X
- The code to compile on an Atari-ST using GCC was supplied by Edgar Roeder
- (roeder@cs.uni-sb.de). I do not have an ST on which to verify the
- distribution sources but I have no reason to believe them to not work.
- If there are any problems please let Edgar or myself know.
- X
- I know of no bugs or limitation to the the Atari-ST implementation. Note that
- it is similar to the DOS version but it does not swap itself out. This does
- not appear to be as much of a problem on the Atari as it is on MSDOS boxes :-).
- See the readme/msdos file for further information.
- X
- -dennis
- SHAR_EOF
- chmod 0640 dmake/readme/atari.tos ||
- echo 'restore of dmake/readme/atari.tos failed'
- Wc_c="`wc -c < 'dmake/readme/atari.tos'`"
- test 626 -eq "$Wc_c" ||
- echo 'dmake/readme/atari.tos: original size 626, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/readme/cover ==============
- if test -f 'dmake/readme/cover' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/readme/cover (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/readme/cover' &&
- This is the DMAKE Version 3.8 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.7 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).
- X
- dmake is available for anonymous ftp from watmsg.uwaterloo.ca address is
- 129.97.141.9. It is in the pub/dmake directory, set your mode to binary,
- and copy either:
- X
- X dmake38.tar.Z - compressed tar archive
- X dmake38.zoo - zoo archive
- X dmake38-msdos-exe.zoo - MSDOS executable zoo archive
- X
- X dmake38.shar01 - xx part shar archive, get all parts
- X ...
- X dmake38.sharxx
- X
- X dmake38.patchY - Patch Y for dmake 3.8
- X
- Note that all archives are created on a UNIX system. This means that the
- distributions heading for DOS-land need to have the <lf> turned into a
- <cr><lf>. There exist a number of filters for doing this (sed comes to mind),
- and is easily run over each file using a UNIX shell script. Thus I don't
- provide two different versions of the archives.
- X
- 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:
- X
- X . support for portable makefiles
- X . runs on many platforms (DOS, generic unix [sysv and bsd4.3],
- X apollo, OS/2, Atari, and many others)
- X . significantly enhanced macro facilities
- X . transitive closure on inference graph
- X . sophisticated inference algorithm
- X . support for traversing the file sytem both during making of targets
- X and during inference
- X . %-meta rules for specifying rules to be used for inferring
- X prerequisites
- X . highly configurable
- X . support for libraries
- X . parallel making of targets on architectures that support it
- X . attributed targets
- X . text diversions
- X . group recipes
- X . swapping itself to DISK under MSDOS
- X . supports MKS extended argument passing convention
- X
- All code found in this distribution is original and written by me except where
- noted in the source and the following:
- X
- - dbug/dbug package from Fred Fish (dmake DEBUG=1, to make a debugging version
- X of dmake)
- X
- - malloc.c package in dbug/malloc from the NET, see the directory for
- X attribution.
- X
- -dennis
- SHAR_EOF
- chmod 0640 dmake/readme/cover ||
- echo 'restore of dmake/readme/cover failed'
- Wc_c="`wc -c < 'dmake/readme/cover'`"
- test 2332 -eq "$Wc_c" ||
- echo 'dmake/readme/cover: original size 2332, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/readme/msdos ==============
- if test -f 'dmake/readme/msdos' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/readme/msdos (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/readme/msdos' &&
- Notes on the MSDOS implementation of dmake.
- X
- Bootstrapping the binary:
- -------------------------
- X A make.bat file is provided to bootstrap the binary. The file contains
- X several targets for bootstrapping. Invoking the batch file with no
- X arguments lists the possibilities shown below.
- X
- X INDEX: You must specify one of:
- X tcc - Turbo C 2.0 compile.
- X tccswp - Turbo C 2.0 compile of swapping dmake.
- X bcc - Borland C++ 2.0 compile.
- X bccswp - Borland C++ 2.0 compile of swapping dmake.
- X msc40 - Microsoft C 4.0 compile.
- X msc50 - Microsoft C 5.0 compile.
- X msc51 - Microsoft C 5.1 compile.
- X msc60 - Microsoft C 6.0 compile.
- X msc40swp - Microsoft C 4.0, MASM 5.1 compile of swapping dmake.
- X msc50swp - Microsoft C 5.0, MASM 5.1 compile of swapping dmake.
- X msc51swp - Microsoft C 5.1, MASM 5.1 compile of swapping dmake.
- X msc60swp - Microsoft C 6.0, MASM 5.1 compile of swapping dmake.
- X ztc - Zortech C++ 2.1 compile.
- X ztcswp - Zortech C++ 2.1 compile of swapping dmake.
- X
- X Based on the compiler you have installed and whether or not you
- X want the swapping version of dmake, you should select the appropriate
- X target and issue 'make.bat target'.
- X
- X The batch file runs a second batch script that comes with the distribution
- X which compiles the sources using the appropriate compiler and flags. The
- X MSC Versions of the batch files should not require any further user
- X intervention during the compile. The Turbo-C version, as a final step,
- X invokes tlink with two response files. The second of these response files,
- X named in msdos/tccdos/mk*.bat, contains absolute path names to Turbo-C
- X libraries. You may need to edit these before getting a successful binary
- X linked.
- X
- X By default the batch files make an executable that will run on an 8088
- X cpu and up. You can change that by making the initial version and then
- X editing the config.mk files found in either msdos/tccdos or msdos/mscdos
- X (depending on the compiler you use), and selecting a diferrent cpu type by
- X supplying the appropriate compiler flags. You then need to remake dmake
- X again but this time use dmake itself, see below.
- X
- X Note that the file msdos/exec.uue is a uuencoded version of a BCC++
- X compiled exec.obj (from exec.asm). If you do not have an assembler
- X either microsoft MASM or Borland TASM (or some other), you can uudecode
- X this file and put it into the appropriate objects directory.
- X
- X
- Using dmake to Make itself:
- ---------------------------
- X If you use dmake to make itself you must first set a number of makefile
- X control variables, either through the environment or on the command line.
- X
- X The following variables must be set:
- X
- X OS - defines operating system (must be set)
- X OSRELEASE - particular version of it.
- X OSENVIRNOMENT - more customization
- X
- X These three variables should be defined in your environment. Valid values
- X for them are listed in the readme/options file. For example, if you
- X are using MSDOS, with Turbo-C then the valid settings are:
- X
- X set OS=msdos
- X set OSRELEASE=tccdos
- X set OSENVIRONMENT=
- X
- X dmake searches for an initial startup file, you should set the environment
- X variable MAKESTARTUP to contain the full path to the startup file, eg:
- X
- X set MAKESTARTUP=d:\usr\lib\startup.mk
- X
- X The dmake makefile has several variables that can be user specified and
- X default to reasonable values if not set.
- X
- X MODEL - defines the model to compile, valid values are
- X {s,c,m, or l}, defaults to 'l' (ie. large) model
- X if unspecified.
- X
- X MSC_VER - defines the version of Microsoft C in use, should be set to
- X one of 4.0, 5.0, 5.1 or 6.0; defaults to 6.0.
- X
- X SWAP - If set to 'y', compile the dmake swapping version of
- X spawnvpe. This has the effect of turning on swapping of the
- X executable to disk if the MSDOS version is made.
- X
- X DEBUG - If set to '1' then make the debugging version of dmake, this
- X will also set MODEL to 'l'.
- X
- X To set the above variables you must specify them on the dmake command line
- X or insert them into the makefile.mk definition.
- X
- X
- Memory Requirements and Swapping:
- ---------------------------------
- X The swapping code currently only swaps to DISK, I have left hooks
- X in to accomodate XMS and EMS, I have some code that performs the
- X necessary XMS/EMS accesses but have not incorporated it in yet.
- X It appears that a ramdisk seems to work just fine. If anyone
- X wishes to fill in the hooks please do and I'll be happy to include
- X them in future distributions.
- X
- X
- ^C and stopping a make:
- -----------------------
- X Thanks to the efforts of Len Reed, appears to now work. I have been unable
- X to hang my machine if it's swapped out and I hit ^C a couple thousand times.
- X
- X
- Other notes:
- ------------
- X dmake does not care if you are running command.com or some other command
- X interpretter, you must however specify the proper values of the environment
- X variables SHELL, SHELLFLAGS, GROUPSHELL, and GROUPFLAGS in order for things
- X to work correctly. Read the man page FIRST, if you still have trouble
- X then send email.
- X
- X Group recipes under DOS that use command.com as the command interpretter
- X require you to set the GROUPSUFFIX macro.
- X
- X As shipped the startup.mk files for the DOS version try to figure out what
- X command interpretter you are using and set things up appropriately.
- X Two command interpretters are supported in the shipped startup.mk file,
- X command.com, and the MKS Korn shell.
- X
- X dmake does not contain any builtin commands. It gets all commands it
- X executes from an external file system. It is therefore most useful if it
- X is used in conjunction with an environment similar to that provided by
- X the MKS Tool Kit, or equivalent.
- X
- X dmake now supports the MKS argument passing conventions. The facility is
- X enabled by setting .MKSARGS:=1. It is set by default in the startup.mk file
- X if an MKS Korn shell is detected as being the active command interpretter.
- SHAR_EOF
- chmod 0640 dmake/readme/msdos ||
- echo 'restore of dmake/readme/msdos failed'
- Wc_c="`wc -c < 'dmake/readme/msdos'`"
- test 5991 -eq "$Wc_c" ||
- echo 'dmake/readme/msdos: original size 5991, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/readme/os2 ==============
- if test -f 'dmake/readme/os2' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/readme/os2 (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/readme/os2' &&
- Notes on the OS/2 implementation of dmake:
- ==========================================
- X
- As shipped the DOS versions of dmake will run under OS/2 protected mode.
- However, support for a full OS/2 version is also provided. The OS/2 version
- will run in parallel under OS/2. The port was made possible by files supplied
- by:
- X
- X Duncan Booth -- (duncanb@ibmpcug.co.uk, Bix:jrichards)
- X Kai Uwe Rommel -- (rommel@lan.informatik.tu-muenchen.dbp.de),
- X
- For which I am grateful. I have taken the two ports and integrated them
- into a single port using the structure supplied by Duncan Booth, and some
- files and OS2'ism supplied by Kai Rommel.
- X
- If there are any problems with the port then please let myself or one of the
- two people above know. I will then attempt to fix the problem. I do not
- have access to an OS/2 box to verify any problems myself.
- X
- X
- Bootstrapping the binary:
- -------------------------
- X A make.cmd file is provided to bootstrap the binary. The file contains
- X several targets for bootstrapping. Invoking the batch file with no
- X arguments lists the possibilities shown below.
- X
- X INDEX: You must specify one of:
- X msc40 - Microsoft C 4.0 compile.
- X msc50 - Microsoft C 5.0 compile.
- X msc51 - Microsoft C 5.1 compile.
- X msc60 - Microsoft C 6.0 compile.
- X ibm - IBM C2 compile.
- X
- X Based on the compiler you have installed and whether or not you
- X want the swapping version of dmake, you should select the appropriate
- X target and issue 'make.cmd target'.
- X
- X The command file runs a second command script that comes with the
- X distribution which compiles the sources using the appropriate compiler and
- X flags. The MSC Versions of the batch files should not require any further
- X user intervention during the compile.
- X
- X By default the command files make an executable that will run on an 8088
- X cpu and up. You can change that by making the initial version and then
- X editing the config.mk file found in os2/mscdos and selecting a diferrent
- X cpu type by supplying the appropriate compiler flags.
- X You then need to remake dmake again but this time use dmake itself,
- X see below.
- X
- X
- Using dmake to Make itself:
- ---------------------------
- X If you use dmake to make itself you must first set a number of makefile
- X control variables, either through the environment or on the command line.
- X
- X The following variables must be set:
- X
- X OS - defines operating system (must be set)
- X OSRELEASE - particular version of it.
- X OSENVIRNOMENT - more customization (not needed for OS/2)
- X
- X These three variables should be defined in your environment. Valid values
- X for them are listed in the dmake makefile.mk file. For example, if you
- X are using OS/2, with Microsoft-C then the valid settings are:
- X
- X set OS=os2
- X set OSRELEASE=mscdos
- X
- X dmake searches for an initial startup file, you should set the environment
- X variable MAKESTARTUP to contain the full path to the startup file, eg:
- X
- X set MAKESTARTUP=\init\dmake.ini
- X
- X The dmake makefile has several variables that can be user specified and
- X default to reasonable values if not set.
- X
- X MODEL - defines the model to compile, valid values are
- X {s,c,m, or l}, defaults to 'l' (ie. large) model
- X if unspecified.
- X
- X MSC_VER - defines the version of Microsoft C in use, should be set to
- X one of 4.0, 5.0, 5.1 or 6.0; defaults to 6.0.
- X
- X DEBUG - If set to '1' then make the debugging version of dmake, this
- X will also set MODEL to 'l'.
- X
- X To set the above variables you must specify them on the dmake command line
- X or insert them into the makefile.mk script.
- X
- X
- X
- OS/2 Specifics
- --------------
- X
- X There is a small number of OS/2 specific features that need to be
- X stated.
- X
- X 1. The environment variables TMP as well as TMPDIR are checked for the
- X location of the directory where dmake should place any temporary files.
- X TMPDIR is checked before TMP.
- X
- X 2. Appropriate limits are setup for MAXPROCESSES and buffer sizes etc.
- X See output of 'dmake -V'.
- X
- X 3. By default dmake will look for the startup.mk file in the path:
- X
- X $(INIT)/dmake.ini
- X
- X This is more in keeping with OS/2 philosophy. You may still rename
- X and put it anywhere else you like by defining the MAKESTARTUP
- X environment variable.
- X
- X 4. The OS/2 directory contains files required by Kai Rommel's compiler
- X shell. However you do not need the compiler shell to build dmake.
- X
- X 5. Swapping the dmake binary to disk is not supported under OS/2.
- X
- X
- Other notes:
- ------------
- X dmake does not care if you are running cmd.exe or some other command
- X interpretter, you must however specify the proper values of the environment
- X variables SHELL, SHELLFLAGS, GROUPSHELL, and GROUPFLAGS in order for things
- X to work correctly. Read the man page first.
- X
- X Group recipes under OS/2 that use cmd.exe as the command interpretter
- X require you to set the GROUPSUFFIX macro.
- X
- X As shipped the startup.mk files try to figure out what
- X command interpretter you are using and set things up appropriately.
- X Two command interpretters are supported in the shipped startup.mk file,
- X cmd.exe (via COMSPEC), and the MKS Korn shell.
- X
- X dmake does not contain any builtin commands. It gets all commands it
- X executes from an external file system. It is therefore most useful if it
- X is used in conjunction with an environment similar to that provided by
- X the MKS Tool kit, or equivalent.
- X
- X dmake now supports the MKS argument passing conventions. The facility is
- X enabled by setting .MKSARGS:=1 and is set by default in the startup.mk file
- X if an MKS Korn shell is detected as being the active command interpretter.
- SHAR_EOF
- chmod 0640 dmake/readme/os2 ||
- echo 'restore of dmake/readme/os2 failed'
- Wc_c="`wc -c < 'dmake/readme/os2'`"
- test 5665 -eq "$Wc_c" ||
- echo 'dmake/readme/os2: original size 5665, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/readme/release ==============
- if test -f 'dmake/readme/release' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/readme/release (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/readme/release' &&
- dmake Version 3.8
- =================
- X
- FULL RELEASE OF DMAKE, REPLACES VERSION 3.7
- X
- Nature: This release is an attempt at addressing all of the little obscure
- ------- bugs and "features" that still remained in dmake and often caused
- X spurious or incorrect behaviour. As such there is no major new
- X functionality but several small enhancements to make life a little
- X more interesting.
- X
- X This distribution advances dmake to Version 3.8, patch level 0.
- X
- X
- Availability:
- -------------
- X dmake is available via anonymous ftp from watmsg.uwaterloo.ca
- X (129.97.141.9) as:
- X
- X pub/dmake/dmake38.tar.Z - compressed tar archive
- X pub/dmake/dmake38.zoo - zoo archive
- X pub/dmake/dmake38-msdos-exe.zoo - MSDOS executable zoo archive
- X pub/dmake/dmake38-msdos-exe.zip - MSDOS executable zip archive
- X pub/dmake/dmake38.shar01 - xx part shar archive
- X ... (get all parts)
- X pub/dmake/dmake38.sharxx
- X
- X and comes in several archive formats. Choose the one that best
- X suits your needs.
- X
- Acknowledgements:
- -----------------
- X Thanks to all who submitted code for new features, suggestions for
- X improvements, and bug fixes. I have tried to make sure no gotchas
- X remain, if you encounter problems installing or running dmake please
- X let me know. As always, I am always happy to receive e-mail.
- X
- X
- DETAILS OF ENHANCEMENTS/TWEAKS:
- ===============================
- - Added the following functionality:
- X
- X #! command
- X
- X is scanned for and recognized if it is the first line of your makefile.
- X The command string is expanded and executed.
- X The command is restricted in that it cannot be a command requiring a shell
- X for it's execution. The values of the command line macros have been set
- X and are available for execution purposes. This is not as general as one
- X would like but it is not bad for bootstrapping different non dmake
- X makefiles. If the command result code is zero, then dmake continues parsing
- X its input and processes the makefile. If the result is non-zero dmake
- X exits. (suggested by Paul Sander, paul@hal.com)
- X
- - Allowed the inclusion of white space inside quoted prerequisites.
- X i.e. you can now say:
- X
- X foo : "some stuff"
- X
- X and have "some stuff" treated as a single prerequisite. The mod is
- X necessary to allow for prerequisites that contain $(shell ... ) expansion
- X scripts and other simillar function macros.
- X
- - Changed the following piece of code to be more in line with dmake
- X philosophy. That is, $(macname:str=sub) now expands 'sub' prior to
- X performing the substitution, however if '-A' or '.AUGMAKE := yes' are
- X specified then the expansion is suppressed.
- X
- - Added _POSIX_NAME_MAX to the source, on any stat if the basename of a file
- X is larger than the value of _POSIX_NAME_MAX then it returns 0. You must
- X define _POSIX_NAME_MAX in a lower level config if you want it to override
- X the default in {unix,msdos,mac,os2,atari}/config.h.
- X
- - Disallowed export of macros whose names contain the characters "+=:*"
- X as these are valid macro assignment operators and we don't want to cause
- X trouble when we go to reparse the environment again. Perhaps the fix
- X could be a little bit less drastic, but for now it seems reasonable.
- X
- - Tweaked the output of -v to more accurately show which of a set of ::
- X targets is getting made. The info was there so I might as well use it.
- X
- - Added a seperate directory substructure for XENIX since I was having trouble
- X linking properly in the generic SYSVR3 environment. Looks as if you pretty
- X much need 'make xenixpwd' since XENIX uses popen to call getcwd.
- X If you use 'make xenix' and your implementation of xenix uses popen this
- X causes dmake to get confused about child processes and occationally
- X complain that it lost one.
- X
- - Cleaned up OS/2 building scripts, and made sure that OS2 define is checked
- X where needed.
- X
- X
- DETAILS OF BUG FIXES:
- =====================
- - Fixed the handling of :: targets if they appear first in the makefile.
- X This was incorrectly handled by the internal DAG construction code, ugly!.
- X
- - Fixed an output statement in dump.c so that macro values containing %
- X signs are correctly printed (guess where that broke, blush).
- X
- - Fixed a bug in dealing with .SETDIR=a targets and multiprocessing. Too
- X obscure to describe but annoying if you stumble onto it.
- X
- - Fixed DIRSEPSTR macro to be user modifiable (as the manpage claims :-)
- X so that people can change it in startup.mk depending on shell/OS
- X (mostly effects DOS and/or OS/2 implementations).
- X
- - Fixed a bug dealing with complex .IF/.ELIF/.ELSE/.END expressions.
- X It now correctly selects only a single matching instance in a complex
- X .IF/.ELIF/.ELSE/.END expr.
- SHAR_EOF
- chmod 0640 dmake/readme/release ||
- echo 'restore of dmake/readme/release failed'
- Wc_c="`wc -c < 'dmake/readme/release'`"
- test 4694 -eq "$Wc_c" ||
- echo 'dmake/readme/release: original size 4694, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= dmake/rulparse.c ==============
- if test -f 'dmake/rulparse.c' -a X"$1" != X"-c"; then
- echo 'x - skipping dmake/rulparse.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- sed 's/^X//' << 'SHAR_EOF' > 'dmake/rulparse.c' &&
- /* RCS -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/rulparse.c,v 1.1 1992/01/24 03:27:57 dvadura Exp $
- -- SYNOPSIS -- perform semantic analysis on input
- --
- -- DESCRIPTION
- -- This code performs semantic analysis on the input, and builds
- -- the complex internal datastructure that is used to represent
- -- the user makefile.
- --
- -- 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: rulparse.c,v $
- X * Revision 1.1 1992/01/24 03:27:57 dvadura
- X * dmake Version 3.8, Initial revision
- X *
- */
- X
- #include "extern.h"
- X
- /* prototypes for local functions */
- static void _add_global_prereq ANSI((CELLPTR));
- static int _add_root ANSI((CELLPTR));
- static void _build_graph ANSI((int, CELLPTR, CELLPTR));
- static char* _build_meta ANSI((char*));
- static int _do_magic ANSI((int, char*, CELLPTR, CELLPTR, t_attr, char*));
- static void _do_special ANSI((int, int, t_attr,char*,CELLPTR,CELLPTR,int*));
- static int _do_targets ANSI((int, t_attr, char*, CELLPTR, CELLPTR));
- static t_attr _is_attribute ANSI((char*));
- static int _is_special ANSI((char*));
- static char* _is_magic ANSI((char*));
- static int _is_percent ANSI((char*));
- static CELLPTR _make_multi ANSI((CELLPTR));
- static CELLPTR _replace_cell ANSI((CELLPTR,CELLPTR,CELLPTR));
- static void _set_attributes ANSI((t_attr, char*, CELLPTR ));
- static void _stick_at_head ANSI((CELLPTR, CELLPTR));
- static void _set_global_attr ANSI((t_attr));
- X
- X
- /* static variables that must persist across invocation of Parse_rule_def */
- static CELLPTR _sv_targets = NIL(CELL);
- static STRINGPTR _sv_rules = NIL(STRING);
- static STRINGPTR _sv_crule = NIL(STRING);
- static CELLPTR _sv_edgel = NIL(CELL);
- static LINKPTR _sv_glb_prq = NIL(LINK);
- static int _sp_target = FALSE;
- static t_attr _sv_attr;
- static int _sv_flag;
- static int _sv_op;
- static char *_sv_setdir;
- static char _sv_globprq_only = 0;
- X
- /* Define for global attribute mask */
- #define A_GLOB (A_PRECIOUS | A_SILENT | A_IGNORE | A_EPILOG | A_SWAP |\
- X A_SHELL | A_PROLOG | A_NOINFER | A_SEQ | A_MKSARGS )
- X
- X
- PUBLIC int
- Parse_rule_def( state )/*
- =========================
- X Parse the rule definition contained in Buffer, and modify the state
- X if appropriate. The function returns 0, if the definition is found to
- X be an illegal rule definition, and it returns 1 if it is a rule definition.
- X */
- int *state;
- {
- X TKSTR input; /* input string struct for token search */
- X CELLPTR targets; /* list of targets if any */
- X CELLPTR prereq; /* list of prereq if any */
- X CELLPTR prereqtail; /* tail of prerequisite list */
- X CELLPTR cp; /* temporary cell pointer for list making */
- X char *result; /* temporary storage for result */
- X char *tok; /* temporary pointer for tokens */
- X char *set_dir; /* value of setdir attribute */
- X char *brk; /* break char list for Get_token */
- X char *firstrcp; /* first recipe line, from ; in rule line */
- X t_attr attr; /* sum of attribute flags for current tgts*/
- X t_attr at; /* temp place to keep an attribute code */
- X int op; /* rule operator */
- X int special; /* indicate special targets in rule */
- X int percent; /* indicate percent rule target */
- X int mixed_glob_prq; /* indicate mixed %-rule prereq possible */
- X
- X DB_ENTER( "Parse_rule_def" );
- X
- X op = 0;
- X attr = 0;
- X special = 0;
- X percent = 0;
- X set_dir = NIL( char );
- X targets = NIL(CELL);
- X prereq = NIL(CELL);
- X prereqtail = NIL(CELL);
- X mixed_glob_prq = 0;
- X
- X /* Check to see if the line is of the form:
- X * targets : prerequisites; first recipe line
- X * If so remember the first_recipe part of the line. */
- X
- X firstrcp = strchr( Buffer, ';' );
- X if( firstrcp != NIL( char ) ) {
- X *firstrcp++ = 0;
- X firstrcp = _strspn( firstrcp, " \t" );
- X }
- X
- X result = Expand( Buffer );
- X for( brk=strchr(result,'\\'); brk != NIL(char); brk=strchr(brk,'\\') )
- X if( brk[1] == '\n' )
- X *brk = ' ';
- X else
- X brk++;
- X
- X DB_PRINT( "par", ("Scanning: [%s]", result) );
- X
- X SET_TOKEN( &input, result );
- X brk = ":-^!";
- X Def_targets = TRUE;
- X
- X /* Scan the input rule line collecting targets, the operator, and any
- X * prerequisites. Stop when we run out of targets and prerequisites. */
- X
- X while( *(tok = Get_token( &input, brk, TRUE )) != '\0' )
- X if( !op ) {
- X /* we are scanning targets and attributes
- X * check to see if token is an operator. */
- X
- X op = Rule_op( tok );
- X
- X if( !op ) {
- X /* define a new cell, or get old cell */
- X cp = Def_cell( tok );
- X DB_PRINT( "par", ("tg_cell [%s]", tok) );
- X
- X if( at = _is_attribute( tok ) ) {
- X /* Logically OR the attributes specified into one main
- X * ATTRIBUTE mask. */
- X
- X if( at == A_SETDIR )
- X if( set_dir != NIL( char ) )
- X Warning( "Multiple .SETDIR attribute ignored" );
- X else
- X set_dir = _strdup( tok );
- X
- X attr |= at;
- X }
- X else {
- X int tmp;
- X
- X tmp = _is_special( tok );
- X if( _is_percent( tok ) ) percent++;
- X
- X if( percent )
- X if( targets != NIL(CELL) )
- X Fatal( "Multiple targets are not allowed in %% rules" );
- X else
- X cp->ce_flag |= F_PERCENT;
- X
- X if( special )
- X Fatal( "Special target must appear alone", tok );
- X else if( !(cp->ce_flag & F_MARK) ) {
- X cp->ce_link = targets; /* targets are stacked in this list*/
- X cp->ce_flag |= F_MARK | F_EXPLICIT;
- X targets = cp;
- X
- X special = tmp;
- X }
- X else if( !(cp->ce_attr & A_LIBRARY) )
- X Warning("Duplicate entry [%s] in target list",cp->CE_NAME);
- X }
- X }
- X else {
- X /* found an operator so empty out break list
- X * and clear mark bits on target list, setting them all to F_USED */
- X
- X brk = "";
- X for( cp=targets; cp != NIL(CELL); cp=cp->ce_link ) {
- X cp->ce_flag ^= F_MARK;
- X cp->ce_flag |= F_USED;
- X }
- X
- X Def_targets = FALSE;
- X }
- X }
- X else {
- X /* Scanning prerequisites so build the prerequisite list. We use
- X * F_MARK flag to make certain we have only a single copy of the
- X * prerequisite in the list */
- X
- X cp = Def_cell( tok );
- X
- X if( _is_percent( tok ) ) {
- X if( !percent && !attr )
- X Fatal( "Syntax error in %% rule, missing %% target");
- X mixed_glob_prq = 1;
- X }
- X
- X if( cp->ce_flag & F_USED ) {
- X if( cp->ce_attr & A_COMPOSITE )
- X continue;
- X else
- X Fatal( "Detected circular dependency in graph at [%s]",
- X cp->CE_NAME );
- X }
- X else if( !(cp->ce_flag & F_MARK) ) {
- X DB_PRINT( "par", ("pq_cell [%s]", tok) );
- X cp->ce_flag |= F_MARK;
- X
- X if( prereqtail == NIL(CELL) ) /* keep prereq's in order */
- X prereq = cp;
- X else
- X prereqtail->ce_link = cp;
- X
- X prereqtail = cp;
- X cp->ce_link = NIL(CELL);
- X }
- X else if( !(cp->ce_attr & A_LIBRARY) )
- X Warning("Duplicate entry [%s] in prerequisite list",cp->CE_NAME);
- X }
- X
- X /* Check to see if we have a percent rule that has only global
- X * prerequisites. If so then set the flag so that later on, we don't issue
- X * an error if such targets supply an empty set of rules. */
- X
- X if( percent && !mixed_glob_prq && (prereq != NIL(CELL)) )
- X _sv_globprq_only = 1;
- X
- X /* It's ok to have targets with attributes, and no prerequisites, but it's
- X * not ok to have no targets and no attributes, or no operator */
- X
- X if( !op ) {
- X CLEAR_TOKEN( &input );
- X DB_PRINT( "par", ("Not a rule [%s]", Buffer) );
- X DB_RETURN( 0 );
- X }
- X
- X if( !attr && targets == NIL(CELL) ) {
- X Fatal( "Missing targets or attributes in rule" );
- X if( set_dir != NIL( char )) FREE( set_dir );
- X DB_RETURN( 0 );
- X }
- X
- X /* We have established we have a legal rules line, so we must process it.
- X * In doing so we must handle any special targets. Special targets must
- X * appear alone possibly accompanied by attributes.
- X * NOTE: special != 0 ==> targets != NIL(CELL) */
- X
- X if( prereqtail != NIL(CELL) ) prereqtail->ce_link = NIL(CELL);
- X
- X /* Clear out MARK bits used in duplicate checking. I originally wanted
- X * to do this as the lists get processed but that got too error prone
- X * so I bit the bullit and added these two loops. */
- X
- X for( cp=prereq; cp != NIL(CELL); cp=cp->ce_link ) cp->ce_flag &= ~F_MARK;
- X for( cp=targets; cp != NIL(CELL); cp=cp->ce_link ) cp->ce_flag &= ~F_USED;
- X
- X /* Check to see if the previous rule line was bound if, not the call
- X * Bind_rules_to_targets to go and bind the line */
- X
- X if( _sv_rules != NIL(STRING) ) Bind_rules_to_targets( F_DEFAULT );
- X
- X /* Add the first recipe line to the list */
- X if( firstrcp != NIL( char ) )
- X Add_recipe_to_list( firstrcp, TRUE, FALSE );
- X
- X /* Save these prior to calling _do_targets, since _build_graph needs the
- X * _sv_setdir value for matching edges. */
- X _sv_op = op;
- X _sv_setdir = set_dir;
- X
- X if( special )
- X _do_special( special, op, attr, set_dir, targets, prereq, state );
- X else
- X *state = _do_targets( op, attr, set_dir, targets, prereq );
- X
- X DB_RETURN( 1 );
- }
- X
- X
- PUBLIC int
- Rule_op( op )/*
- ================
- X Check the passed in op string and map it to one of the rule operators */
- char *op;
- {
- X int ret = 0;
- X
- X DB_ENTER( "rule_op" );
- X
- X if( *op == TGT_DEP_SEP ) {
- X ret = R_OP_CL;
- X op++;
- X
- X /* All rule operations begin with a :, but may include any one of the
- X * four modifiers. In order for the rule to be properly mapped we must
- X * check for each of the modifiers in turn, building up our return bit
- X * string. */
- X
- X while( *op && ret )
- X switch( *op ) {
- X case ':': ret |= R_OP_DCL; op++; break;
- X case '!': ret |= R_OP_BG; op++; break;
- X case '^': ret |= R_OP_UP; op++; break;
- X case '-': ret |= R_OP_MI; op++; break;
- X
- X default : ret = 0; /* an invalid modifier, chuck whole string */
- X }
- X
- X if( *op != '\0' ) ret = 0;
- X }
- X
- X DB_RETURN( ret );
- }
- X
- X
- PUBLIC void
- Add_recipe_to_list( rule, white_too, no_check )/*
- =================================================
- X Take the provided string and add it to the list of recipe lines
- X we are saving to be added to the list of targets we have built
- X previously. If white_too == TRUE add the rule EVEN IF it contains only
- X whitespace. */
- char *rule;
- int white_too;
- int no_check;
- {
- X DB_ENTER( "Add_recipe_to_list" );
- X
- X if( rule != NIL( char ) && (*rule != '\0' || white_too) ) {
- X DB_PRINT( "par", ("Adding recipe [%s]", rule) );
- X _sv_crule = Def_recipe( rule, _sv_crule, white_too, no_check );
- X
- X if( _sv_rules == NIL(STRING) )
- X _sv_rules = _sv_crule;
- X }
- X
- X DB_VOID_RETURN;
- }
- X
- X
- PUBLIC void
- Bind_rules_to_targets( flag )/*
- ===============================
- X Take the rules we have defined and bind them with proper attributes
- X to the targets that were previously defined in the parse. The
- X attributes that get passed here are merged with those that are were
- X previously defined. (namely F_SINGLE) */
- int flag;
- {
- X CELLPTR tg; /* pointer to current target in list */
- X LINKPTR lp; /* pointer to link cell */
- X int magic; /* TRUE if target is .xxx.yyy form */
- X int tflag; /* TRUE if we assigned targets here */
- X
- X DB_ENTER( "Bind_rules_to_targets" );
- X
- X /* This line is needed since Parse may call us twice when the last
- X * GROUP rule appears at the end of file. In this case the rules
- X * have already been bound and we want to ignore them. */
- X
- X if( _sv_targets == NIL(CELL) ) { DB_VOID_RETURN; }
- X
- X tflag = FALSE;
- X flag |= (_sv_flag & F_SINGLE);
- X
- X for( tg = _sv_targets; tg != NIL(CELL); tg = tg->ce_link ) {
- X DB_PRINT( "par", ("Binding to %s, %04x", tg->CE_NAME, tg->ce_flag) );
- X magic = tg->ce_flag & F_PERCENT;
- X
- X /* Check to see if we had a rule of the form '%.o : a.h b.h ; xxx'
- X * In which case we must build a NULL prq node to hold the recipe */
- X if( _sv_globprq_only && (_sv_rules != NIL(STRING)) )
- X _build_graph( _sv_op, tg, NIL(CELL) );
- X
- X /* NOTE: For targets that are magic we ignore any previously defined
- X * rules. ie. We throw away the old definition and use the new. */
- X if( !(tg->ce_flag & F_MULTI) && !magic && (tg->CE_RECIPE != NIL(STRING))
- X && !_sp_target && (_sv_rules != NIL(STRING)) )
- X Fatal( "Multiply defined recipe for target %s", tg->CE_NAME );
- X
- X if( (magic || _sp_target) && (_sv_rules == NIL(STRING)) &&
- X !(tg->ce_flag & F_SPECIAL) && !_sv_globprq_only )
- X Warning( "Empty recipe for special target %s", tg->CE_NAME );
- X
- X if( magic ) {
- X CELLPTR ep;
- X
- X for( ep=_sv_edgel; ep != NIL(CELL); ep=ep->ce_link ) {
- X _set_attributes( _sv_attr, _sv_setdir, ep );
- X ep->ce_flag |= (F_TARGET|flag);
- X
- X if( _sv_rules != NIL(STRING) ) {
- X ep->ce_recipe = _sv_rules;
- X ep->ce_indprq = _sv_glb_prq;
- X }
- X }
- X }
- X else {
- X tg->ce_attr |= _sv_attr;
- X tg->ce_flag |= flag;
- X
- X if( _sv_rules != NIL(STRING) ) {
- X tg->ce_recipe = _sv_rules;
- X tg->ce_flag |= F_RULES | F_TARGET;
- X
- X /* Bind the current set of prerequisites as belonging to the
- X * original recipe given for the target */
- X for( lp=tg->ce_prq; lp != NIL(LINK); lp = lp->cl_next )
- X if( !(lp->cl_flag & F_USED) ) lp->cl_flag |= F_TARGET;
- X }
- X else for( lp=tg->ce_prq; lp != NIL(LINK); lp = lp->cl_next )
- X lp->cl_flag |= F_USED;
- X }
- X
- X tflag |= _add_root(tg);
- X }
- X
- X if( tflag ) Target = TRUE;
- X if( _sv_setdir ) FREE(_sv_setdir);
- X _sv_rules = NIL(STRING);
- X _sv_crule = NIL(STRING);
- X _sv_targets = NIL(CELL);
- X _sv_glb_prq = NIL(LINK);
- X _sv_edgel = NIL(CELL);
- X _sp_target = FALSE;
- X _sv_globprq_only = 0;
- X
- X DB_VOID_RETURN;
- }
- X
- X
- X
- PUBLIC int
- Set_group_attributes( list )/*
- ==============================
- X Scan list looking for the standard @ and - (as in recipe line defs)
- X and set the flags accordingly so that they apply when we bind the
- X rules to the appropriate targets. */
- char *list;
- SHAR_EOF
- true || echo 'restore of dmake/rulparse.c failed'
- fi
- echo 'End of part 30, continue with part 31'
- echo 31 > _shar_seq_.tmp
- exit 0
- exit 0 # Just in case...
-