[comp.sources.misc] v19i049: dmake - dmake version 3.7, Part28/37

dvadura@watdragon.waterloo.edu (Dennis Vadura) (05/13/91)

Submitted-by: Dennis Vadura <dvadura@watdragon.waterloo.edu>
Posting-number: Volume 19, Issue 49
Archive-name: dmake/part28
Supersedes: dmake-3.6: Volume 15, Issue 52-77

---- Cut Here and feed the following to sh ----
#!/bin/sh
# this is dmake.shar.28 (part 28 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file dmake/quit.c continued
#
if test ! -r _shar_seq_.tmp; then
	echo 'Please unpack part 1 first!'
	exit 1
fi
(read Scheck
 if test "$Scheck" != 28; 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/quit.c' &&
X
X   while( Closefile() != NIL( FILE ) );
X   Clean_up_processes();
X
X   if( Current_target != NIL(CELL) )
X      Unlink_temp_files(Current_target);
X
X   if( _dont_quit == 0 ) _handle_quit( ".ERROR" );
X
X   Set_dir( Makedir );		/* No Error message if we can't do it */
X   Epilog( ERROR_EXIT_VALUE );
}
X
X
static void
_handle_quit( err_target )/*
============================
X   Called by quit and the others to handle the execution of termination code
X   from within make */
char *err_target;
{
X   HASHPTR hp;
X   CELLPTR cp;
X
X   if( (hp = Get_name(err_target, Defs, FALSE)) != NIL(HASH) ) {
X      cp = hp->CP_OWNR;
X      Glob_attr |= A_IGNORE;
X
X      _dont_quit = 1;
X      cp->ce_flag |= F_TARGET;
X      Make( cp, NIL(LINK), NIL(CELL) );
X   }
}
SHAR_EOF
chmod 0640 dmake/quit.c ||
echo 'restore of dmake/quit.c failed'
Wc_c="`wc -c < 'dmake/quit.c'`"
test 2194 -eq "$Wc_c" ||
	echo 'dmake/quit.c: original size 2194, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= dmake/readme/atari.tos ==============
if test ! -d 'dmake/readme'; then
    mkdir 'dmake/readme'
fi
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.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).
X
dmake is available for anonymous ftp from watmsg.uwaterloo.ca address is
129.97.129.9.  It is in the pub/dmake directory, set your mode to binary,
and copy either:
X
X	dmake37.tar.Z		- compressed tar archive
X	dmake37.zoo		- zoo archive
X	dmake37-msdos-exe.zoo	- MSDOS executable zoo archive
X	dmake37-msdos-exe.zip	- MSDOS executable zip archive
X	dmake37.shar01		- xx part shar archive, get all parts
X	...
X	dmake37.sharxx
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 1988 -eq "$Wc_c" ||
	echo 'dmake/readme/cover: original size 1988, 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
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 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 dmake makefile.mk 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 'c' (ie. compact) 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 script.
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.
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 5848 -eq "$Wc_c" ||
	echo 'dmake/readme/msdos: original size 5848, 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
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 'c' (ie. compact) 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.
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 5581 -eq "$Wc_c" ||
	echo 'dmake/readme/os2: original size 5581, 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.7
=================
X
FULL RELEASE OF DMAKE, REPLACES VERSION 3.6
X
Nature:  It is highly recommended that this version replace all versions of 3.6
-------  that are in current use.  Version 3.7 fixes numerous memory bugs that
X	 were present in Version 3.6.  These often caused spurious behaviour
X	 especially on MSDOS machines when complex makefiles were used.
X
X	 This release addresses the following issues:
X
X	     1. Modifications to the inference algorithm.
X	     2. Memory bug fixes.
X	     3. Enhancements to the macro expansion facilities.
X	     4. Addition of .KEEP_STATE functionality.
X	     5. Many other tweaks and tunes
X
X	  This distribution advances dmake to Version 3.7, patch level 0.
X
X
Availability:
-------------
X	  dmake is available via anonymous ftp from watmsg.uwaterloo.edu
X	  (129.97.129.9) as:
X
X	      pub/dmake/dmake37.tar.Z		- compressed tar archive
X	      pub/dmake/dmake37.zoo		- zoo archive
X	      pub/dmake/dmake37-msdos-exe.zoo	- MSDOS executable zoo archive
X	      pub/dmake/dmake37-msdos-exe.zip	- MSDOS executable zip archive
X	      pub/dmake/dmake37.shar01		- xx part shar archive
X	      ...				  (get all parts)
X	      pub/dmake/dmake37.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:
===============================
- Ran the whole thing with a DEBUGING malloc library on.  Found one memory
X  bug in expand.c, one in BSD 4.3's version of getwd.  I am now fairly
X  confident that no more obscure memory allocation bugs remain in dmake.
X
- Addition of the malloc dbug code made me move all debug code into the
X  dbug directory and I changed the config.mk files around to reflect the
X  changes.  Setting DEBUG=1 on the command line gives you DB_ macros, and
X  DEBUG=1 DBMALLOC=1 gives you DB_ macros and debuging malloc library.
X
- Added sysvr4 directory and targets
X
- Disallowed %.o :: %.c rules.  They make no sense and the implementation
X  was completely wrong.  That is, the difference between
X
X	%.o : %.c; ...
X	%.o : %.f; ...
X  and
X	%.o :: %.c; ...
X	%.o :: %.f; ...
X
X  is less than clear, and the efficacy of the latter is even muddier.  From
X  now on :: rules are not allowed in %-meta rules.  This simplifies the
X  description of what is going on and makes the code in infer.c significantly
X  more correct.  When %-meta rules are now replaced by other rules, the
X  .SETDIR attribute (if specified) is taken into consideration and only rules
X  whose target, prerequisite, and .SETDIR value match are considered for
X  replacement, otherwise the new rule is added.
X
- Modified the setting of external file name for targets that have been made
X  and that had a .SETDIR= attribute as follows:
X
X	.SETDIR=fred : test
X
X	target : test ; ...
X
X  then the name of test in any $< expansions is fred/test if the change of
X  directory was successful, if however the rules for making test are:
X
X	test .SETDIR=a :: ...
X	test .SETDIR=b :: ...
X
X  then the external file name for 'test' is simply 'test'.  We don't know
X  which recipes will be used to bring it up to date in which directories
X  hence we will not attempt to modify the name of test.   The same holds for
X  the .SOURCE search rules in this case.
X
X  You are now able to provide different .SETDIR=dir attributes to each
X  new :: rule associated with a target, see above for what name is deduced
X  for such targets after they are made.
X
- Went to a Breadth-first search inference algorithm.  Major change and two
X  days of hacking, but it seems to work.  It is much nicer now and I can
X  describe with definite determinism what the algorithm will not infer.
X  All ambiguities are reported rather than choosing an arbitrary inference
X  chain.  This is considerably less error prone, but may break some existing
X  makefiles.  Modified -v display to show exactly what inference chain is
X  used.
X
- Fixed the recipe handling of +,-,%,@ at the start of a recipe line.  The
X  attributes are now recognized even if they appear in a macro at the start
X  of the recipe line.  ie;
X
X	all:
X	    $(SH) do the right thing
X
X  will use the shell if SH=+ is defined somewhere.
X
- Modified string{token_list} expansions to better co-exist with /bin/sh.
X  /bin/sh treats the following as valid syntax:
X
X  	{ echo hello;}
X
X  under version 3.6 of dmake it would strip the {} characters or worse.
X  This version of dmake has been modified to apply the {} only of the
X  first token in token_list follows the opening { with no intervening
X  white space.  Thus the above line will NOT BE Expanded, while
X
X        {foo fee}.c
X
X  will result in foo.c and fee.c as the result of the expansion.
X
- If using Augmake (-A) flag then directories are always made, even if they
X  are up to date.
X
- Added .PHONY attribute.  Any target with this attribute will have it's
X  recipe made each time it is made even if a file with the name of the target
X  exists and can be found by dmake.  Targets that have as a prerequisite a
X  target with the .PHONY attribute set will also get made since the time stamp
X  of the prerequisite will be made current and it will appear older than the
X  target thereby forcing it to be made as well.
X
- Added .ELIF <condition> construct, and allowed .ENDIF as a synnonym for
X  .END.  Made the parsing of .IF....ELIF....ELSE....END constructs a little
X  more robust.
X
- Changed behaviour of .SETDIR= attribute when used without prerequisites or
X  a target.
X
X	.SETDIR=somedir :
X
X  is no longer supported you should instead use the macro form of the
X  attribute:
X
X	.SETDIR := somedir
X
X  The reasoning behind the switch goes as follows.  If you wrote the line
X
X	.SETDIR=somedir : $(SOURCE_FILES)
X
X  and $(SOURCE_FILES) was null this would cause dmake to CD to somedir prior
X  to making any targets.  This situation is undesirable at best as it caused
X  some weird error messages.  The new modified behaviour is more consistent
X  and allows the attribute to be set on the command line.
X
- Modified inference to assume targets that have no .suffix can be made from
X  files that contain at least one .suffix.  This prevents early termination of
X  the inference algorithm.
X
- Added -v{dfimt} flag so that you can now control
X  how much junk -v actually prints.  This means that
X  -v is now a seperate flag and cannot be catenated
X  with the rest... oh well.
X
- Added DOS tee function to copy the contents of output to stdout and stderr
X  to a file specified using -C option.  patches were supplied by Len Reed.
X
- Added KEEPSTATE functionality based on Dean Hoovers stuff.
X    BEWARE:  If you make a target and the recipe has a default set of rules
X	     when things are updated, but a slightly different set when it
X	     updates then using KEEPSTATE will fail.  In particular:
X
X	     Suppose you infer a recipe % --> %.o --> %.c, and the first time
X	     you make a target the .o is in the '.' directory, but by default
X	     you tell dmake to look in objects, then when you run dmake the
X	     next time the recipe will be different as the .o will now be
X	     objects/foo.o and the KEEPSTATE value will be outdated and hence
X	     the target will look as if it needs making.
X  .NOSTATE attribute to disable keeping of state for any target with this
X  attribute set.  no state is kept for .PHONY targets either.
X
- Added some more GNU style macro expansions:
X
X	$(null,text true false)
X	$(!null,text true false)
X	$(eq,lhs,rhs true false)
X	$(!eq,lhs,rhs true false)
X
X  The first returns Expand(true) if Expand(text) is null, and Expand(false) if
X  Expand(text) is not null.  The second is the negation of the first.
X
X  The equality macros are similar but test
X     Expand(lhs) == Expand(rhs)
X  rather than against null.
X
- Modified the running of normal recipes to perform the following expansion
X  prior to doing the command:
X
X	set CNMDNAME := name of command to execute (first whitespace ending
X			token in command line)
X	set CMNDARGS := remainder of the line
X
X  Expand $(COMMAND) to form the the command line to pass to be executed.  By
X  default COMMAND is set to:
X
X	COMMAND = $(CMNDNAME) $(CMNDARGS)
X
X  If however you wish to use a different interface (esp under DOS) for passing
X  long command line arguments then you can easily do so, for example:
X
X	COMMAND = $(CMNDNAME) @(mktmp $(CMNDARGS))
X
X  assigns a temporary file that holds the arguments and executest the comand
X
X	$(CMNDNAME) @/tmp/ASAD38479217
X
X  or whatever, the temporary file is removed upon completion of the command
X  unless the -vt flag is given.
X
- Added $(shell command) macro, which passes the commands specified as data to
X  a shell using the usual interface and returns the result of the output from
X  the command catenated together into a single string separated by spaces.
X
X  For example:
X
X  	$(shell ls *.c)
X
X  returns the list of *.c files from the current directory.
X
- Added $(sort data) macro which sorts the list of space separated tokens in
X  data.
X
- Added $(strip data) macro which makes sure that data contains a list
X  of tokens separated by a single space.
X
- Added $(subst,pat,replacement data)
X
X
X
DETAILS OF BUG FIXES:
=====================
X
MAN PAGE TWEAKS:
----------------
- Made all "it's" in the document to "its" -- oops.
X
- Documented '.IMPORT : .EVERYTHING' functionality and ensured that global
X  attributes are not affected by it.
X
- Documented '.NOINFER:' functionality.
X
- Documented new features
X
X
UNIX RELATED BUG FIXES:
-----------------------
- Changed unix/arlib.c to use binary time headers if M_XENIX.  You can fix
X  this by changing the definition of ASCARCH in unix/sysvr3/config.h when
X  M_XENIX is defined.  I don't know which is the true case so if anyone knows
X  can you let me know and I'll make sure it gets set right.
X
- Updated unix/arlib.c to handle RS6000/AIX 3.0 archive headers.  This is
X  a bit of a pain as #ifdef _AIX had to be spattered throughout arlib.c
X  and in a number of other places.  It was the lesser of two evils.  Will
X  IBM ever get stuff like __STDC__ right?
X
X
MSDOS RELATED BUG FIXES:
------------------------
- Applied fix supplied by few@gupta.com (Frank Whaley) to msdos/spawn.c for
X  building and handling path names during the search for an executable.
X  It could have hung the machine the way it was due to lack of a NULL
X  pointer.
X
- Fixed another bug in msdos/spawn.c.  If you tried to run a program that had
X  a full path including extension then the current spawn.c did not find it
X  in some instances.  Whether it did or not depended on what the contents of
X  the NULL pointer happened to be :-).
X
- Fixed a HUGE bug in msdos/spawn.c.  There was an off by one error in
X  _get_path that caused serious memory stomps, and eventual hangs of the
X  machine.
X
- Fixed bug in msdos/switchar.c, it now correctly selects the code to
X  get the switchar if it's an MSDOS compile.
X
X
OS/2 RELATED FIXES:
-------------------
- Applied patch for OS/2 supplied by "Kai Uwe Rommel".  Details (from Kai) of
X  patch:
X     o in os2/_chdir.c, there was a transmission error or typo, Ox20 instead of
X       0x20
X     o in os2/dmake.cs I corrected the options; my compiler shell maintains a
X       global ("system-wide") set of default options, so there is no need to
X       use -G2 etc. there. Also, -WX seems to be unnessecary.
X     o in os2/dmake.def, I commented out the IMPORT statement (see below).
X     o in os2/ruletab.c, MAXPROCESS *MUST* me removed, otherwise the argument
X       of the -Pn option seems to be ignored.
X     o in os2/runargv.c, I moved the session title code (with a call to an
X       undocumented system call) into "#ifdef SESSTITTLE" because it also
X       prevents BIND to make a family mode application that also runs under DOS
X       or in the DOS box; this may be of interest to people who use both DOS
X       and OS/2 on their machines, to prevent them from having two binaries of
X       dmake on their hard disk. This also requires to remove the import
X       statement  for the undoc. system call from the dmake.def file.
X     o in os2/startup.h I added a / into the MAKESTARTUP definition.
X
X
GENERAL FIXES:
--------------
- Fixed the # comment handling inside recipes to mirror what standard makes
X  do.  This turned out to be trivial to do so I stuck it in.
X
- Fixed bug reported by bill@twwells.com, If dmake was run in a /bin/sh with
X  makefile text comming via a pipe from stdin then when dmake executed the
X  makefile it would see an extra child termination comming from the source
X  of the pipe.  dmake now ignores returned pid's from child processes that it
X  did not spawn.  An example, under /bin/sh, do:
X
X	cat <<\+ | dmake -vf - verify
X	verify : make
X		echo verify
X	make :
X		echo make
X	+
X
X  The cat could finish before the first real dmake child finished and would
X  cause a core dump.
X
- Inserted definitions of FP_OFF and FP_SEG into spawn.c and find.c under
X  msdos directory as Turbo C++ was having troubles finding them.  As reported
X  by Nino Margetic (nino@uk.ac.ucl.sm.mph).
X
- Changed Fatal error message for multiple .SETDIR= attribute specifications
X  into a Warning.
X
- Fixed a nasty bug in Parallel Make.  It would get the names of .SETDIR'ed
X  prerequisites wrong.  Specifically it lost the .SETDIR value when setting
X  the $< etc macro values for the final target.
X
- Fixed bug reported by Len Reed.  When removing prerequisites using .REMOVE
X  I now set their flags as no longer existing.  This way if we happen to
X  walk this part of the graph again from some other place we know enough
X  to remake them.  This is really a simpler case of the general go to the
X  same spot from a different .SETDIR location problem.
X
X  NOTE:  The following makefile is an example of what this fixes, but that
X  it may not work correctly with -Pn where n>1 since .REMOVES are run and
X  they happen in parallel along with the rest of the processing.  There is
X  a race in getting the .REMOVE done and walking the graph from
X  the large.target side.  Don't build graphs like this.  If you want to
X  do it in parallel then put each of large and small in a different
X  directory.
X
X      all .SEQUENTIAL : small.target large.target
X
X      small.target : one.sml two.sml
X	      echo Building $@ from $&
X
X      large.target : one.lrg two.lrg; echo Building $@ from $&
X
X      %.sml : %.c; echo $(CC) $(CFLAGS) -c -Fo$<; touch $@
X
X      %.lrg : %.c; echo $(CC) $(CFLAGS) -AL -c -Fo$<; touch $@
X
X      CO = co -u
X      CC = cc
X      V = ,v
X
X	 % : $$(@:d)RCS/$$(@:f)$V;- $(CO) $(COFLAGS) $@
X	    .NOINFER : %$V $$(@:d)RCS/$$(@:f)$V
X
X      :REMOVE :; /bin/rm -f $&
X
- Fixed core dump on circularity test for targets that contain a .LIBRARY
X  beats me why I put the explicit test in to ignore the libraries if found
X  to be circular.  Someone will complain if this is broken now but I don't
X  think it is.
X
- Cleaned up the .h files, they are much cleaner and more
X  organized now.
X     o Added define of _POSIX_SOURCE for RS/6000
X     o Moved the definition of size_t from all over the place to alloc.h
X     o Cleaned up the definition of POSTAR for XENIX, You shouldn't need it.
X
- Fixed a bug with setting macro variables from the command line.
X  It now recognizes a + only if it preceeds an '='.
X
- WARNING if you use the vfprintf code supplied with dmake then you might get
X  a warning indicating that an illegal pointer assignment is taking place,
X  ignore it.
X
- Fixed handling of attributes for recipes and :: rules.  The following is now
X  true:
X
X	.MKSARGS : list_of_targets
X
X  Will set .MKSARGS for any target appearing in list_of_targets irrespective
X  of whether it appears as a target in :: or : recipe lines.  Conversely
X  the construct:
X
X	target1 :: ; recipe 1
X	target1 .MKSARGS :: ; recipe 2
X
X  will set .MKSARGS when making target1 using recipe 2 only.
X
- Fixed a nasty bug in string.c.  Forgot to check for NIL(char) in second
X  argument to _strspn and _strpbrk, sheesh!.
X
- Propagate parent timestamp for infered prerequisites if it is >= not just >.
X  This fixes a small bug with directories that were prerequisites of a target.
X  If the directory was modified when the target was made it is quite possible
X  they may have the same time-stamp.  This in general is not a good thing to
X  do anyway.
X
- Modified $(mktmp ...) macro so that you can specify a file name.
X
X	$(mktmp[,[FILE][,TEXT]] data);
X
X  will put data into a file called Expand(FILE), if FILE contains
X  $(TMPFILE) then a suitable temporary file name is generated and
X  substituted.  The result value of the macro is the name of the tempfile
X  or if TEXT is defined, is the result of Expand(TEXT).
X
X  Some examples are:
X
X	$(mktmp data)			==> normal tmpfile
X	$(mktmp,$(TMPFILE) data)	==> normal tmpfile
X	$(mktmp,, data)			==> normal tmpfile
X	$(mktmp,turboc.cfg $(CFLAGS))	==> tmpfile named turboc.cfg
X	$(mktmp,,$(TMPSHELL) data)	==> normal tmpfile, named Expand(...)
X	$(mktmp,,$(NULL) data)		==> normal tmpfile, null result
X
- Modified making of .MAKEFILES special targets to make certain that
X  it does not make a prerequisite of that target if the -n flag is specified.
X
- Changed statting of targets to match the functionality of .SETDIR a bit
X  better.  When looking into a library and we have used .SETDIR to change
X  directories, dmake will look into a relative current path, and if it
X  does not find it, it will search a library found by prepending the value
X  of the TMD macro to the path of the library file.
X
- Fixed the handling of :: and %-meta targets by ripping out the HOW internal
X  data-structure, and by doing some interesting things with the cell dag.
X  .UPDATEALL is now more comprehensive in its behaviour (might even be
X  correct).  Sets of :: rules for a target return the timestamp for the target
X  that resulted in it's being made.
SHAR_EOF
chmod 0640 dmake/readme/release ||
echo 'restore of dmake/readme/release failed'
Wc_c="`wc -c < 'dmake/readme/release'`"
test 17984 -eq "$Wc_c" ||
	echo 'dmake/readme/release: original size 17984, 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 91/05/06 15:23:26 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  91/05/06  15:23:26  dvadura
X * dmake Release Version 3.7
X * 
*/
X
#include "extern.h"
X
/* prototypes for local functions */
static  void    _add_global_prereq 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
/* 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 t_attr     _sv_attro;
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
SHAR_EOF
true || echo 'restore of dmake/rulparse.c failed'
fi
echo 'End of part 28, continue with part 29'
echo 29 > _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.