[comp.sources.misc] v14i017: dmake version 3.5 part 7/21

dvadura@watdragon.waterloo.edu (Dennis Vadura) (07/27/90)

Posting-number: Volume 14, Issue 17
Submitted-by: dvadura@watdragon.waterloo.edu (Dennis Vadura)
Archive-name: dmake/part07

#!/bin/sh
# this is part 7 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file msdos/dirbrk.c continued
#
CurArch=7
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file msdos/dirbrk.c"
sed 's/^X//' << 'SHAR_EOF' >> msdos/dirbrk.c
X--      GNU General Public License for more details.
X-- 
X--      You should have received a copy of the GNU General Public License
X--      along with this program;  if not, write to the Free Software
X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X--
X-- LOG
X--     $Log:	dirbrk.c,v $
X * Revision 1.1  90/07/19  14:10:42  dvadura
X * Initial Revision of Version 3.5
X * 
X*/
X
X#include "extern.h"
X#include <ctype.h>
X
X/* dos uses /, \, and : */
Xchar*	DirBrkStr = "/\\:";
X
X/*
X** Return TRUE if the name is the full specification of a path name to a file
X** starting at the root of the file system, otherwise return FALSE
X*/
Xint
XIf_root_path(name)
Xchar *name;
X{
X   return( (strchr(DirBrkStr, *name) != NIL(char)) ||
X           (isalpha(*name) && name[1] == ':') );
X}
SHAR_EOF
echo "File msdos/dirbrk.c is complete"
chmod 0440 msdos/dirbrk.c || echo "restore of msdos/dirbrk.c fails"
echo "x - extracting msdos/config.mk (Text)"
sed 's/^X//' << 'SHAR_EOF' > msdos/config.mk &&
X# This is an OS specific configuration file
X#	It assumes that OBJDIR, TARGET and DEBUG are previously defined.
X#	It defines	CFLAGS, LDARGS, CPPFLAGS, STARTUPFILE, LDOBJS
X#	It augments	SRC, OBJDIR, TARGET, CFLAGS, LDLIBS
X#
XSTARTUPFILE	= $(OS)/startup.mk
XCPPFLAGS 	= $(CFLAGS)
XLDOBJS		= $(CSTARTUP) $(OBJECTS)
XLDARGS		= @<+$(LDOBJS:s,/,\\,:t"+\n")\n+>,$(TARGET),NUL.MAP,@<+$(LDLIBS:s,/,\\,:t"+\n")\n+>$(LDFLAGS)
X
X# Debug flags
XDB_CFLAGS	= -DDBUG -v
XDB_LDFLAGS	= /v
XDB_LDLIBS	=
X
X# NO Debug flags
XNDB_CFLAGS	=
XNDB_LDFLAGS	=
XNDB_LDLIBS	=
X
X# Local configuration modifications for CFLAGS.
XCFLAGS         += -I$(OS)
X
X# Common MSDOS source files.
XSRC += ruletab.c dirbrk.c runargv.c arlib.c _chdir.c switchar.c rmprq.c
X
X# Set source dirs so that we can find files named in this
X# config file.
X.SOURCE.c : $(OS)
X.SOURCE.h : $(OS)
X
X# See if we modify anything in the lower levels.
X.IF $(OSRELEASE) != $(NULL)
X   .INCLUDE .IGNORE : $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)config.mk
X.END
X
X# Set the proper macros based on whether we are making the debugging version
X# or not.
X.IF $(DEBUG)
X   CFLAGS	+= $(DB_CFLAGS)
X   LDFLAGS	+= $(DB_LDFLAGS)
X   LDLIBS	+= $(DB_LDLIBS)
X
X   SILENT	:= $(.SILENT)
X   .SILENT	:= yes
X   TARGET	:= db$(TARGET)
X   OBJDIR	:= $(OBJDIR).dbg
X   .SILENT	:= $(SILENT)
X
X   SRC		+= dbug.c malloc.c
X   HDR		+= db.h 
X.ELSE
X   CFLAGS	+= $(NDB_CFLAGS)
X   LDFLAGS	+= $(NDB_LDFLAGS)
X   LDLIBS	+= $(NDB_LDLIBS)
X.END
SHAR_EOF
chmod 0640 msdos/config.mk || echo "restore of msdos/config.mk fails"
echo "x - extracting msdos/arlib.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > msdos/arlib.c &&
X/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/arlib.c,v 1.1 90/07/19 14:10:42 dvadura Exp $
X-- SYNOPSIS -- Library access code.
X-- 
X-- DESCRIPTION
X--	This implementation uses the library timestamp inplace of the
X--	library member timestamp.
X--
X-- AUTHOR
X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
X--
X-- COPYRIGHT
X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
X-- 
X--      This program is free software; you can redistribute it and/or
X--      modify it under the terms of the GNU General Public License
X--      (version 1), as published by the Free Software Foundation, and
X--      found in the file 'LICENSE' included with this distribution.
X-- 
X--      This program is distributed in the hope that it will be useful,
X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X--      GNU General Public License for more details.
X-- 
X--      You should have received a copy of the GNU General Public License
X--      along with this program;  if not, write to the Free Software
X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X--
X-- LOG
X--     $Log:	arlib.c,v $
X * Revision 1.1  90/07/19  14:10:42  dvadura
X * Initial Revision of Version 3.5
X * 
X*/
X
X#include "extern.h"
X#include "macros.h"
X#include "vextern.h"
X
Xtime_t
Xseek_arch(name, lib)
Xchar*	name;
Xchar*	lib;
X{
X   static	int	warned = FALSE;
X
X   if (!warned && !(Glob_attr&A_SILENT))
X   	warned = TRUE,
X   	Warning("Can't extract library member timestamp;\n\
X   	using library timestamp instead.");
X   return (Do_stat(lib, NULL, NULL));
X}
X
Xint
Xtouch_arch(name, lib)
Xchar*	name;
Xchar*	lib;
X{
X   static	int	warned = FALSE;
X
X   if (!warned && !(Glob_attr&A_SILENT))
X   	warned = TRUE,
X   	Warning("Can't update library member timestamp;\n\
X   	touching library instead.");
X   return (Do_touch(lib, NULL, NULL));
X}
X
SHAR_EOF
chmod 0440 msdos/arlib.c || echo "restore of msdos/arlib.c fails"
echo "x - extracting msdos/_chdir.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > msdos/_chdir.c &&
X/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/msdos/RCS/_chdir.c,v 1.1 90/07/19 14:10:40 dvadura Exp $
X-- SYNOPSIS -- Change directory.
X-- 
X-- DESCRIPTION
X--	Under DOS change the current drive as well as the current directory.
X--
X-- AUTHOR
X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
X--
X-- COPYRIGHT
X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
X-- 
X--      This program is free software; you can redistribute it and/or
X--      modify it under the terms of the GNU General Public License
X--      (version 1), as published by the Free Software Foundation, and
X--      found in the file 'LICENSE' included with this distribution.
X-- 
X--      This program is distributed in the hope that it will be useful,
X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X--      GNU General Public License for more details.
X-- 
X--      You should have received a copy of the GNU General Public License
X--      along with this program;  if not, write to the Free Software
X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X--
X-- LOG
X--     $Log:	_chdir.c,v $
X * Revision 1.1  90/07/19  14:10:40  dvadura
X * Initial Revision of Version 3.5
X * 
X*/
X
X#include <dos.h>
X#include "sysintf.h"
X#include "vextern.h"
X
X#undef   chdir 		/* sysintf.h defines it to _chdir for DOS */
X
Xint
X_chdir(path)
Xchar *path;
X{
X   int   res;
X
X   res = chdir(path);
X   if (res != -1 && path[1] == ':' && *path != *Pwd) {
X      union REGS  reg;
X
X      /* we must change the logged drive, since the chdir worked. */
X      reg.h.ah = 0x0E;
X      reg.h.dl = (*path & ~0x20) - 'A';
X      intdos(&reg, &reg);
X   }
X   return (res);
X}
X
SHAR_EOF
chmod 0440 msdos/_chdir.c || echo "restore of msdos/_chdir.c fails"
echo mkdir - man
mkdir man
echo "x - extracting man/dmake.tf (Text)"
sed 's/^X//' << 'SHAR_EOF' > man/dmake.tf &&
X.\" Copyright (c) 1990 Dennis Vadura, All rights reserved.
X.\"
X.ds TB "0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.2i +0.5i +0.5i +2.0i
X.de Ip
X.fi
X.nr Ip \w\\$1 
X.IP "\\$1" \\n(Ipu
X\\$2
X.nf
X..
X.de Is
X.nr )I \w\\$1u
X..
X.de Ii
X.in \\n()Ru
X.nr )E 1
X.ns
X.ne 1.1v
X.it 1 }N
X.di ]B
X\&\\$1
X..
X.TH DMAKE p  "UW" "Version 3.50" "Unsupported Software"
X.SH NAME
X\fBdmake\fR \- maintain program groups, or interdependent files
X.SH SYNOPSIS
X.B dmake
X[-AeEhiknpqersStTuvVx] [-P#] [macro[+][:]=\fIvalue\fP] [-f file] [target ...]
X.SH DESCRIPTION
X.PP
X.B dmake
Xexecutes commands found in an external file called a
X.I makefile
Xto update one or more target names.
XEach target may depend on zero or more prerequisite targets.
XIf any of the target's prerequisites is newer than the target or if the target
Xitself does not exist, then
X.B dmake
Xwill attempt to make the target.
X.PP
XIf no
X.B \-f
Xcommand line option is present then
X.B dmake
Xsearches for an existing
X.I makefile
Xfrom the list of prerequisites specified for the special target \fI.MAKEFILES\fR
X(see the STARTUP section for more details).
XIf "-" is the name of the file specified to the
X.B -f
Xflag then \fBdmake\fR uses standard input as the source of the makefile text.
X.PP
XAny macro definitions (arguments with embedded
X.Q "="
Xsigns) that appear on the command line are processed first
Xand supersede definitions for macros of the same name found
Xwithin the makefile.  It is impossible for definitions found inside the
Xmakefile to redefine any macro defined on the command line.
X.PP
XIf no
X.I target
Xnames are specified on the command line, then \fBdmake\fR uses the first
Xnon-special target found in the makefile as the default target.
XSee the
X.B "SPECIAL TARGETS"
Xsection for the list of special targets and their function.
X\fBdmake\fR is a re-implementation of the UNIX Make utility with
Xsignificant enhancements.  Makefiles written for most previous
Xversions of
X.I make
Xwill be handled correctly by 
X.B dmake.
XKnown differences between \fBdmake\fR and other versions of make
Xare discussed in the
X.B COMPATIBILITY
Xsection found at the end of this document.
X.SH OPTIONS
X.IP "\fB\-A\fR"
XEnable AUGMAKE special inference rule transformations (see the
X.Q "PERCENT(%) RULES"
Xsection), these are set to off by default.
X.IP "\fB\-e\fR"
XRead the environment and define all strings of the
Xform '\fBENV-VAR\fP=\fIevalue\fP'
Xdefined within as macros whose name is \fBENV-VAR\fP,
Xand whose value is '\fIevalue\fP'.
XThe environment is processed prior to processing the user
Xspecified makefile thereby allowing definitions in the makefile to override
Xdefinitions in the environment.
X.IP "\fB\-E\fR"
XSame as -e, except that the environment is processed after the
Xuser specified makefile has been processed
X(thus definitions in the environment override definitions in the makefile).
XThe -e and -E options are mutually exclusive.
XIf both are given the latter one takes effect.
X.IP "\fB\-f file\fR"
XUse \fBfile\fR as the source for the makefile text.
XOnly one \fB\-f\fR option is allowed.
X.IP "\fB\-h\fR"
XPrint the command summary for \fBdmake\fR.
X.IP "\fB\-i\fR"
XTells \fBdmake\fR to ignore errors, and continue making other targets.
XThis is equivalent to the .IGNORE attribute or macro.
X.IP "\fB\-k\fR"
XCauses \fBdmake\fR to ignore errors caused by command execution and to make
Xall targets not depending on targets that could not be made. 
XOrdinarily \fBdmake\fR stops after a command returns a non-zero status,
Xspecifying \fB\-k\fR causes \fBdmake\fR to ignore the error
Xand continue to make as much as possible.
X.IP "\fB\-n\fR"
XCauses \fBdmake\fR to print out what it would have executed,
Xbut does not actually execute the commands.  A special check is made for
Xthe string "$(MAKE)" inside a recipe line, if found, the line is expanded
Xand invoked, thereby enabling recursive makes to give a full
Xdescription of all that they will do.
XThe check for "$(MAKE)" is disabled inside group recipes.
X.IP "\fB\-p\fR"
XPrint out a version of the digested makefile in human readable form.
X(useful for debugging, but cannot be re-read by \fBdmake\fP)
X.IP "\fB\-P#\fR"
XOn systems that support multi-processing cause \fBdmake\fP to use \fI#\fP
Xconcurrent child processes to make targets.  See the
X.Q "MULTI PROCESSING"
Xsection for more information.
X.IP "\fB\-q\fR"
XCheck and see if the target is up to date.  Exits with code 0 if up to date,
X1 otherwise.
X.IP "\fB\-r\fR"
XTells \fBdmake\fR not to read the initial startup makefile, see STARTUP
Xsection for more details.
X.IP "\fB\-s\fR"
XTells \fBdmake\fR to do all its work silently and not echo the commands it is
Xexecuting to stdout (also suppresses warnings).
XThis  is equivalent to the .SILENT attribute or macro.
X.IP "\fB\-S\fR"
XForce sequential execution of recipes on architectures which support
Xconcurrent makes.  For backward compatibility with old makefiles that have
Xnasty side-effect prerequisite dependencies.
X.IP "\fB\-t\fR"
XCauses \fBdmake\fR to touch the targets and bring them up to date
Xwithout executing any commands.
X.IP "\fB\-T\fR"
XTells \fBdmake\fP to not perform transitive closure on the inference graph.
X.IP "\fB\-u\fR"
XForce an unconditional update.  (ie. do everything that would
Xbe done if everything that a target depended on was out of date)
X.IP "\fB\-v\fR"
XVerbose flag, when making targets print to stdout what we are going to make
Xand what we think it's timestamp is.
X.IP "\fB\-V\fR"
XPrint the version of \fBdmake\fR, and values of builtin macros.
X.IP "\fB\-x\fR"
XUpon processing the user makefile export all non-internally defined macros
Xto the user's environment.  This option together with the -e option
Xallows SYSV AUGMAKE recursive makes to function as expected.
X.SH INDEX
XHere is a list of the sections that follow and a short description of each.
XPerhaps you won't have to read the whole man page to find
Xwhat you need.
X.IP \fBSTARTUP\fP 1.9i
XDescribes \fBdmake\fP initialization.
X.IP \fBSYNTAX\fP 1.9i
XDescribes the syntax of makefile expressions.
X.IP \fBATTRIBUTES\fP 1.9i
XDescribes the notion of attributes and how they are used when
Xmaking targets.
X.IP \fBMACROS\fP 1.9i
XDefining and expanding macros.
X.IP "\fBRULES AND TARGETS" 1.9i
XHow to define targets and their prerequisites.
X.IP \fBRECIPES\fP 1.9i
XHow to tell \fBdmake\fP how to make a target.
X.IP "\fBTEXT DIVERSIONS\fP" 1.9i
XHow to use text diversions for long argument lists in recipes.
X.IP "\fBSPECIAL TARGETS\fP" 1.9i
XSome targets are special.
X.IP "\fBSPECIAL MACROS\fP" 1.9i
XMacros used by \fBdmake\fP to alter the processing of the makefile,
Xand those defined by \fBdmake\fP for the user.
X.IP "\fBDYNAMIC PREREQUISITES\fP" 1.9i
XProcessing of prerequisites which contain macro expansions in their name.
X.IP "\fBBINDING TARGETS\fP" 1.9i
XThe rules that \fBdmake\fP uses to bind
Xa target to an existing file in the file system.
X.IP "\fBPERCENT(%) RULES\fP" 1.9i
XSpecification of recipes to be used by the inference algorithm.
X.IP "\fBMAKING INFERENCES\fP" 1.9i
XThe rules that \fBdmake\fP uses when inferring how to make a target which
Xhad no explicit recipe.  This and the previous section are really a single
Xsection in the text below.
X.IP "\fBMAKING TARGETS\fP" 1.9i
XHow \fBdmake\fP makes targets other than libraries.
X.IP "\fBMAKING LIBRARIES\fP" 1.9i
XHow \fBdmake\fP makes libraries.
X.IP "\fBMULTI PROCESSING\fP" 1.9i
XDiscussion of \fBdmake's\fP parallel make facilities for architectures that
Xsupport them.
X.IP "\fBCONDITIONALS\fP" 1.9i
XConditional expressions which control the processing of the makefile.
X.IP "\fBEXAMPLES\fP" 1.9i
XSome hopefully useful examples.
X.IP "\fBCOMPATIBILITY\fP" 1.9i
XHow \fBdmake\fP compares with previous versions of make.
X.IP "\fBLIMITS\fP" 1.9i
XLimitations of \fBdmake\fP.
X.IP \fBPORTABILITY\fP 1.9i
XComments on writing portable makefiles.
X.IP \fBFILES\fP 1.9i
XFiles used by \fBdmake\fP.
X.IP "\fBSEE ALSO\fP" 1.9i
XOther related programs, and man pages.
X.IP "\fBAUTHOR\fP" 1.9i
XThe guy responsible for this thing.
X.IP \fBBUGS\fP 1.9i
XHope not.
X.SH STARTUP
XWhen
X.B dmake
Xbegins execution it first processes the command line and then it processes
Xan initial startup-makefile.
XThis is followed by an attempt to locate and process a user supplied makefile.
XThe startup file defines the default values of all required control macros
Xand the set of default rules for making inferences.
XWhen searching for the startup makefile,
X.B dmake
Xsearches the following locations, in order, until a startup file is located:
X.LP
X.RS
X.IP 1.
XThe location given as the value of the macro MAKESTARTUP defined on the
Xcommand line.
X.IP 2.
XThe location given as the value of the environment variable MAKESTARTUP
Xdefined in the current environment.
X.IP 3.
XThe location given as the value of the macro MAKESTARTUP defined internally
Xwithin \fBdmake\fP.
X.RE
X.LP
XThe above search is disabled by specifying the -r option on the command line.
XAn error is issued if a startup makefile cannot be found and the -r
Xoption was not specified.
XA user may substitute a custom startup file by defining
Xthe MAKESTARTUP environment variable or by redefining the
XMAKESTARTUP macro on the command line.
XTo find out where
X.B dmake
Xlooks for the default startup file, check your environment or issue the command
X\fI"dmake -V"\fP to determine the builtin value of MAKESTARTUP.
X.PP
XA similar search is performed to locate a default user makefile when no
X\fB-f\fP command line option is specified.
XThe special target .MAKEFILES is internally defined by default.
XThis target's prerequisite list specifies the names of files and the order that
X\fBdmake\fP will use to search for them when attempting to locate the default
Xmakefile.
XA typical definition for this target is:
X.RS
X.sp
X\&.MAKEFILES : makefile.mk Makefile makefile
X.sp
X.RE
X\fBdmake\fP will first look for makefile.mk and then the others.
XIf a prerequisite
Xcannot be found \fBdmake\fP will try to make it before going on to the next
Xprerequisite.  For example, makefile.mk can be checked out of an RCS file
Xif the proper rules for doing so are defined in the startup file.
X.SH SYNTAX
XThis section is a summary of the syntax of makefile statements.
XThe description is given in a style similar to BNF, where { } enclose
Xitems that may appear zero or more times, and [ ] enclose items that
Xare optional.  Alternative productions for a left hand side are indicated
Xby '->', and newlines are significant.  All symbols in \fBbold\fP type
Xare text or names representing text supplied by the user.
X.sp 2
X.RS
X.Ip "Makefile" "\(-> { Statement }"
X.Ip "Statement" "\(-> Macro-Definition"
X\(-> Conditional
X\(-> Rule-Definition
X\(-> Attribute-Definition
X.Ip "Macro-Definition" "\(-> \fBMACRO = LINE\fP"
X\(-> \fBMACRO := LINE\fP
X\(-> \fBMACRO += LINE\fP
X\(-> \fBMACRO +:= LINE\fP
X.Ip "Conditional \(-> " "\fB\&.IF\fR expression"
X   Makefile
X[ \fB.ELSE\fR
X   Makefile ]
X\fB\&.END\fR
X.Ip expression	"\(-> \fBLINE\fR"
X\(-> \fBSTRING == LINE\fR
X\(-> \fBSTRING != LINE\fR
X.sp
X.Ip "Rule-Definition \(-> " "target-definition"
X   [ recipe ]
X.PP
Xtarget-definition \(-> targets [attrs] op { \fBPREREQUISITE\fP } [\fB;\fR rcp-line]
X.Ip "targets" "\(-> target { targets }"
X\(-> \fB"\fRtarget\fB"\fR { targets }
X.Ip "target" "\(-> special-target"
X\(-> \fBTARGET\fR
X.Ip "attrs" "\(-> attribute { attrs }"
X\(-> \fB"\fRattribute\fB"\fR { attrs }
X.Ip "op" "\(-> \fB:\fR { modifier }"
X.Ip "modifier" "\(-> \fB:\fR"
X\(-> \fB^\fR
X\(-> \fB!\fR
X\(-> \fB-\fR
X.Ip "recipe" "\(-> { \fBTAB\fR rcp-line }"
X\(-> [\fB@\fR][\fB-\fR] \fB[
X.Is "recipe \(-> "
X.Ii " "
X   \fR{ \fBLINE\fR }
X.Ii " "
X\fB]\fR
X.Ip "rcp-line" "\(-> [\fB@\fR][\fB-\fR] \fBLINE\fR"
X.sp
X.Ip Attribute-Definition "\(-> attrs \fB:\fR targets"
X.sp
X.Ip "attribute"	 "\(-> \fB.EPILOG\fR"
X\(-> \fB.IGNORE\fR
X\(-> \fB.LIBRARY\fR
X\(-> \fB.NOINFER\fR
X\(-> \fB.PRECIOUS\fR
X\(-> \fB.PROLOG\fR
X\(-> \fB.SETDIR=\fIpath\fP\fR
X\(-> \fB.SILENT\fR
X\(-> \fB.SEQUENTIAL\fR
X\(-> \fB.SYMBOL\fR
X\(-> \fB.UPDATEALL\fR
X.Ip "special-target" "\(-> \fB.ERROR\fR"
X\(-> \fB.EXPORT\fR
X\(-> \fB.GROUPEPILOG\fR
X\(-> \fB.GROUPPROLOG\fR
X\(-> \fB.IMPORT\fR
X\(-> \fB.INCLUDE\fR
X\(-> \fB.INCLUDEDIRS\fR
X\(-> \fB.MAKEFILES\fR
X\(-> \fB.REMOVE\fR
X\(-> \fB.SOURCE\fR
X\(-> \fB.SOURCE.\fIsuffix\fR
X\(-> .\fIsuffix1\fR.\fIsuffix2\fR
X.fi
X.RE
X.sp 1
X.PP
XWhere, \fBTAB\fP represents a <tab> character, \fBSTRING\fP represents an
Xarbitrary sequence of characters, and
X\fBLINE\fP represents a
Xpossibly empty sequence of characters terminated by a non-escaped 
X(not immediately preceded by a backslash '\\') new-line character.
X\fBMACRO\fP, \fBPREREQUISITE\fP,
Xand \fBTARGET\fP each represent a string of characters not
Xincluding space or tab which respectively form the name of a macro,
Xprerequisite or target.
XThe name may itself be a macro expansion expression.
XA \fBLINE\fP can be continued over several physical lines by terminating it with
Xa single backslash character.  Comments are initiated by the
Xpound '\fB#\fR' character and extend to the end of line.
XAll comment text is discarded, a '#' may be placed into the makefile text
Xby escaping it with '\\' (ie. \\# translates to # when
Xit is parsed).
XA group of continued lines may be commented out by placing a single # at the
Xstart of the first line of the group.
XA continued line may not span more than one makefile.
X.PP
X\fBwhite space\fP is defined to be any combination of
X<space>, <tab>, and the sequence \\<nl>
Xwhen \\<nl> is used to terminate a LINE.
XWhen processing \fBmacro\fP definition lines,
Xany amount of white space is allowed on either side of the macro operator
X(=, :=, += or +:=), and
Xwhite space is stripped from both before and after the macro
Xvalue string.
XThe sequence \\<nl> is treated as
Xwhite space during recipe expansion
Xand is deleted from the final recipe string.
XYou must escape the \\<nl> with a \\ in order to get a \\<nl> at the end
Xof a recipe line.
XThe \\<nl> sequence is always deleted from macro values.
X.PP
XWhen processing \fBtarget\fP definition lines,
Xthe recipe for a target must, in general, follow the first definition
Xof the target (See the RULES AND TARGETS section for an exception), and
Xthe recipe may not span across multiple makefiles.
XAny targets and prerequisites found on a target definition line are taken
Xto be white space separated tokens.
XThe rule operator (\fIop\fP in SYNTAX section) is also considered
Xto be a token but does not require
Xwhite space to precede or follow it.  Since the rule operator begins with a `:',
Xtraditional versions of make do not allow the `:' character to
Xform a valid target name.  \fBdmake\fP allows `:' to be present in
Xtarget/prerequisite names as long as the entire target/prerequisite name is
Xquoted.  For example:
X.sp
X\ta:fred : test
X.sp
Xwould be parsed as TARGET = a, PREREQUISITES are fred, :, and test, which
Xis not what was intended.  To fix this you must write:
X.sp
X\t"a:fred" : test
X.sp
XWhich will be parsed as expected.
XSee the EXAMPLES section for how to apply this to a list of targets.
X.SH ATTRIBUTES
X.B dmake
Xdefines several target attributes.  Attributes may be
Xassigned to a single target, a group of targets, or to all targets in the
Xmakefile.  Attributes are used to modify
X\fBdmake\fP actions during target update.
XThe recognized attributes are:
X.sp
X.IP \fB.EPILOG\fP 1.2i
XInsert shell epilog code when executing a group recipe associated with
Xany target having this attribute set.
X.IP \fB.IGNORE\fP 1.2i
XIgnore an error when trying to make any target with this attribute set.
X.IP \fB.LIBRARY\fP 1.2i
XTarget is a library.
X.IP \fB.NOINFER\fP 1.2i
XAny target with this attribute set will not be subjected
Xto transitive closure if it is inferred as a prerequisite 
Xof a target whose recipe and prerequisites are being inferred.
X(i.e. the inference search will not use any prerequisite with this attribute 
Xset, as a target)
X.IP \fB.PRECIOUS\fP 1.2i
XDo not remove this target under any circumstances.
XSet by default for any targets whose corresponding files exist in the file
Xsystem prior to the execution of \fBdmake\fP.
X.IP \fB.PROLOG\fP 1.2i
XInsert shell prolog code when executing a group recipe associated with
Xany target having this attribute set.
X.IP \fB.SEQUENTIAL\fP 1.2i
XForce a sequential make of the associated target's prerequisites.
X.IP \fB.SETDIR\fP 1.2i
XChange current working directory to specified directory when making associated
Xtarget.  The syntax of this attribute is different from the others.  You must
Xspecify the directory at the time the attribute is specified.  To do this
Xsimply give \fI.SETDIR=path\fP as the attribute.  \fIpath\fP is expanded and
Xthe result is used as the value of the directory to change to.
XIf path is surrounded by single quotes then path is not expanded, and is used
Xliterally as the directory name.
XIf the \fIpath\fP contains any `:' characters then the entire attribute string
Xmust be quoted using ".
XIf a target having this attribute set also has the .IGNORE
Xattribute set then if the change to the specified directory fails it will be
Xignored, and no error message will be issued.
X.IP \fB.SILENT\fP 1.2i
XDo not echo the recipe lines when making any target with this attribute set,
Xand do not issue any warnings.
X.IP \fB.SYMBOL\fP 1.2i
XTarget is a library member and is an entry point into a module in the
Xlibrary.  This attribute is used only when searching a library for a target.
XTargets of the form lib((entry)) have this attribute set automatically.
X.IP \fB.UPDATEALL\fP 1.2i
XIndicates that all the targets listed in this rule are updated by the
Xexecution of the accompanying recipe.
XA common example is the production of the
X.I y.tab.c
Xand
X.I y.tab.h
Xfiles by
X.B yacc
Xwhen it is run on a grammar.  Specifying .UPDATEALL in such a rule
Xprevents the running of yacc twice, once for the y.tab.c file and once
Xfor the y.tab.h file.
X.sp
X.PP
XAll attributes are user setable and may be used in one of
Xtwo forms (except .UPDATEALL, use of this attribute in a rule of the first form
Xis illegal)
X.sp
X\tATTRIBUTE_LIST : \fItargets\fP
X.sp
Xassigns the attributes specified by ATTRIBUTE_LIST to each target in
X.I targets
Xor
X.sp
X\t\fItargets\fP ATTRIBUTE_LIST : ...
X.sp
Xassigns the attributes specified by ATTRIBUTE_LIST to each target in
X.I targets.
XIn the first form if
X.I targets
Xis empty (ie. a NULL list), then the
Xlist of attributes will apply to all targets in the makefile
X(this is equivalent to the common Make construct of \fI".IGNORE :"\fP
Xbut has been modified to the notion of an attribute instead of
Xa special target).
XNot all of the attributes have global meaning.
XIn particular, .LIBRARY, .SYMBOL, and .UPDATEALL
Xhave no assigned global meaning.
X.PP
XAny attribute may be used with any target, even with the special targets.
XSome combinations are useless (e.g. .INCLUDE .PRECIOUS: ... ),
Xwhile others are useful (e.g. .INCLUDE .IGNORE : "file.mk" will not complain
Xif file.mk cannot be found using the include file search rules,
Xsee the section on SPECIAL TARGETS for a description of .INCLUDE).
XIf a specified attribute will not be used with the special target a warning
Xis issued and the attribute is ignored.
X.SH MACROS
X.B dmake
Xsupports four types of macro assignment.
XThe first and most familiar is the usual assignment:
X.sp
X\tMACRO = LINE
X.sp
Xwhich causes LINE to be assigned without expansion, as the value of MACRO.
XThe second form:
X.sp
X\tMACRO := LINE
X.sp
Xis new and indicates that LINE should be expanded prior to being assigned as
Xthe value of MACRO.  Future expansions of MACRO do not have the value expanded
Xsince it was expanded when the macro was defined.
XThe third form of macro assignment allows macro values to grow:
X.sp
X\tMACRO += LINE
X.sp
Xadds the value of LINE to the previous value of MACRO separating the two by a
Xsingle space (LINE is not expanded).  The final form:
X.sp
X\tMACRO +:= LINE
X.sp
Xis similar to \fB+=\fP,
Xwith the difference that the value of LINE is expanded before being added to
Xthe previous value of MACRO.
X.PP
XWhen \fBdmake\fP defines a non-environment macro it strips leading and
Xtrailing white space from the macro value.
XMacros imported from the environment via either the .IMPORT special
Xtarget (see the SPECIAL TARGETS section), or the \fB-e\fP, or \fB-E\fP flags
Xare an exception to this rule.  Their values are
Xalways taken literally and white space is never stripped.
XIn addition, macros defined using the .IMPORT special target do
Xnot have their values expanded when they are used within a makefile.
XIn contrast, environment macros that are imported
Xdue to the specification of the \fB-e\fP or \fB-E\fP flags
Xare subject to expansion when used.
X.PP
XTo specify a macro expansion
Xenclose the name in () or {} and precede it with a dollar sign $.
XThus $(TEST) represents an expansion of the macro variable named TEST.
XIf TEST is
Xdefined then $(TEST) is replaced by its expanded value.  If TEST is not
Xdefined then $(TEST) expands to the NULL string (this is equivalent to
Xdefining a macro as 'TEST=' ).  A short form may be used for single character
Xnamed macros.  In this case the parentheses are optional, and $(I) is
Xequivalent to $I.
XMacro expansion is recursive, hence if the value string contains an expression
Xrepresenting a macro expansion, the expansion is performed.  Circular macro
Xexpansions are detected and cause an error to be issued.
X.PP
XWhen defining a macro the given macro name is first expanded before being used
Xto define the macro.  Thus it is possible to define macros whose names
Xdepend on values of other macros.  For example, suppose
X.sp
X\tCWD = $(PWD:b)
X.sp
Xis defined, then the value of $(CWD) is the name of the current directory.
XThis can be used to define macros specific to this directory, for
Xexample:
X.sp
X\t_$(CWD).prt = list of files to print...
X.sp
XThe actual name of the defined macro is a function of the current directory.
XA construct such as this is useful when processing a hierarchy of directories
Xusing .SETDIR attributed targets and a collection of small distributed
Xmakefile stubs.
X.PP
XMacro variables may be defined within the makefile, on the command
Xline, or imported from the environment.
X.PP
X.B \fBdmake\fR
Xsupports several non-standard macro expansions:
XThe first is of the form:
X.RS
X.IP \fI$(macro_name:modifier_list:modifier_list:...)\fR
X.RE
X.LP
Xwhere
X.I modifier_list
Xis chosen from the set { D or d, F or f, B or b, S or s, T or t } and
X.RS
X.sp
X.Is "d "
X.Ii "d "
X\- directory portion of all path names
X.Ii "f"
X\- file (including suffix) portion of path names
X.Ii "b"
X\- file (not including suffix) portion of path names
X.Ii "s"
X\- simple pattern substitution
X.Ii "t"
X\- tokenization.
X.sp
X.RE
XThus if we have the example:
X.LP
X\ttest = d1/d2/d3/a.out f.out d1/k.out
X.LP
XThe following macro expansions produce the values on the right of '-->' after
Xexpansion.
X.RS
X.sp
X.Is "$(test:s/out/in/:f)  "
X.Ii "$(test:d)"
X--> d1/d2/d3/ d1/
X.Ii "$(test:b)"
X--> a f k
X.Ii "$(test:f)"
X--> a.out f.out k.out
X.Ii "${test:db}"
X--> d1/d2/d3/a f d1/k
X.Ii "${test:s/out/in/:f}"
X--> a.in f.in k.in
X.Ii $(test:f:t"+")
X--> a.out+f.out+k.out
X.RE
X.PP
XIf a token ends in a string composed from the value of the macro DIRBRKSTR
X(ie. ends in a directory separator string, e.g. '/' in UNIX) and you use the
X\fB:d\fP modifier then the expansion returns the directory name less the
Xfinal directory separator string.  Thus successive pairs of :d modifiers
Xeach remove a level of directory in the token string.
X.PP
XThe tokenization modifier takes all white space separated tokens from the
Xmacro value and separates them by the quoted separator string.  The separator
Xstring may contain the following escape codes \\a => <bel>,
X\&\\b => <backspace>, \\f => <formfeed>, \\n => <nl>, \\r => <cr>,
X\&\\t => <tab>, \\v => <vertical tab>, \\" => ", and \\xxx => <xxx> where
Xxxx is the octal representation of a character.  Thus the
Xexpansion:
X.LP
X.RS
X.nf
X$(test:f:t"+\\n")
X.RE
X.sp
Xgives:
X.sp
X.RS
Xa.out+
Xf.out+
Xk.out
X.fi
X.RE
X.PP
XThe second non-standard form of macro expansion allows for recursive macros.
XIt is possible to specify a $(\fImacro_name\fR) or ${\fImacro_name\fR} expansion
Xwhere \fImacro_name\fR contains more $( ... ) or ${ ... } macro expansions
Xitself.
X.PP
XFor example $(CC$(_HOST)$(_COMPILER)) will first expand CC$(_HOST)$(_COMPILER)
Xto get a result and use that result as the name of the macro to expand.
XThis is useful for writing a makefile for more than one target
Xenvironment.  As an example consider the following hypothetical case. 
XSuppose that _HOST and _COMPILER are imported from the environment
Xand are set to represent the host machine type and the host compiler
Xrespectively.
X.RS
X.sp
X.nf
XCFLAGS_VAX_CC = -c -O	# _HOST == "_VAX", _COMPILER == "_CC"
XCFLAGS_PC_MSC = -c -ML	# _HOST == "_PC",  _COMPILER == "_MSC"
X.sp
X# redefine CFLAGS macro as:
X.sp
XCFLAGS := $(CFLAGS$(_HOST)$(_COMPILER))
X.fi
X.sp
X.RE
XThis causes CFLAGS to take on a value that corresponds to the
Xenvironment in which the make is being invoked.
X.PP
XThe final non-standard macro expansion is of the form:
X.RS
X.sp
Xstring1{token_list}string2
X.RE
X.LP
Xwhere string1, string2 and token_list are expanded.  After expansion,
Xstring1 is prepended to each token found in token_list and
Xstring2 is appended to each resulting token from the previous prepend.
Xstring1 and string2 are not delimited by white space
Xwhereas the tokens in token_list are.  A null token in the token list 
Xis specified using "".
XThus using another example we have:
X.RS
X.sp
X.Is "test/{ f1  ""f2"" """" }.o    "
X.Ii "test/{f1 f2}.o"
X--> test/f1.o test/f2.o
X.Ii "test/ {f1 f2}.o"
X--> test/ f1.o f2.o
X.Ii "test/{f1 f2} .o"
X--> test/f1 test/f2 .o
X.Ii "test/{ f1  ""f2"" """" }.o"
X--> test/f1.o test/f2.o test/.o
X.sp
X.Ii and
X.sp
X.Is "test/{ d1 d2 }/{ f1 f2 }.o --> "
X.Ii "test/{ d1 d2 }/{ f1 f2 }.o --> "
Xtest/d1/f1.o test/d1/f2.o
Xtest/d2/f1.o test/d2/f2.o
X.sp
X.RE
XSee the SPECIAL MACROS section for a description of the special macros that
X\fBdmake\fP defines and understands.
X.SH "RULES AND TARGETS"
XA makefile contains a series of entries that specify dependencies.
XSuch entries are called \fItarget/prerequisite\fP or \fIrule\fP definitions.
XEach rule definition
Xis optionally followed by a set of lines that provide a recipe for updating
Xany targets defined by the rule.
XWhenever
X.B dmake
Xattempts to bring a target up to date and an explicit recipe is provided with
Xa rule defining the target, that recipe is used to update the
Xtarget.  A rule definition begins with a line having the following syntax:
X.sp
X.RS
X.nf
X\fI<targets>\fP [\fI<attributes>\fP] \fI<ruleop>\fP [\fI<prerequisites>\fP] [;\fI<recipe>\fP]
X.fi
X.RE
X.sp
X.I targets
Xis a non-empty list of targets.  If the target is a
Xspecial target (see SPECIAL TARGETS section below) then it must appear alone
Xon the rule line.  For example:
X.sp
X.RS
X\&.IMPORT .ERROR : ...
X.RE
X.sp
Xis not allowed since both .IMPORT and .ERROR are special targets.
XSpecial targets are not used in the construction of the dependency graph and
Xwill not be made.
X.PP
X.I attributes
Xis a possibly empty list of attributes.  Any attribute defined in the
XATTRIBUTES section above may be specified.  All attributes will be applied to
Xthe list of named targets in the rule definition.  No other targets will
Xbe affected.
X.sp
X.IP NOTE: 0.75i
XAs stated earlier,
Xif both the target list and prerequisite list are empty but the attributes
Xlist is not, then the specified attributes affect all targets in the makefile.
X.sp
X.PP
X.I ruleop
Xis a separator which is used to identify the targets from the prerequisites.
XOptionally it also provides a facility for modifying the way in which
X.B dmake
Xhandles the making of the associated targets.
XIn its simplest form the operator is a single ':', and need not be separated
Xby white space from its neighboring tokens.  It may additionally be followed
Xby any of the modifiers { !, ^, -, : }, where:
X.sp
X.IP \fB!\fP
Xsays execute the recipe for the associated targets once for each out of date
Xprerequisite.  Ordinarily the recipe is executed
Xonce for all out of date prerequisites at the same time.
X.IP \fB^\fP
Xsays to insert the specified prerequisites, if any, before any
Xother prerequisites already associated with the specified targets.
XIn general, it is not useful to specify ^ with an empty
Xlist of prerequisites.
X.IP \fB-\fP
Xsays to clear the previous list of prerequisites before adding
Xthe new prerequisites.  Thus,
X.sp
X\t.SUFFIXES :
X.br
X\t.SUFFIXES : .a .b
X.sp
Xcan be replaced by
X.sp
X\t.SUFFIXES :- .a .b
X.sp
Xhowever the old form still works as expected.  NOTE:  .SUFFIXES is ignored by
X.B dmake
Xit is used here simply as an example.
X.IP \fB:\fP
XWhen the rule operator is not modified by a second ':'
Xonly one set of rules may be specified for making a target.
XMultiple definitions may be used to add to the
Xlist of prerequisites that a target depends on.
XHowever, if a target is multiply defined
Xonly one definition may specify a recipe
Xfor making the target.
X.sp
XWhen a target's rule operator is modified by a second ':'
X(:: for example) then this definition may not be the only
Xdefinition with a recipe for the target.  There may be other :: target
Xdefinition lines that specify a different set of prerequisites with a
Xdifferent recipe for updating the target.  
XAny such target is made if any of the definitions
Xfind it to be out of date
Xwith respect to the related prerequisites
Xand uses the corresponding recipe to update the
Xtarget.
X.sp 
XIn the following simple example, each rule has a `::' \fIruleop\fP.  In such an
Xoperator we call the first `:' the operator, and the second `:' the modifier.
X.sp
X.nf
Xa.o :: a.c b.h
X   first recipe for making a.o
X
Xa.o :: a.y b.h
X   second recipe for making a.o
X.fi
X.sp
XIf a.o is found to be out of date with respect to a.c then the first recipe
Xis used to make a.o.  If it is found out of date with respect to a.y then
Xthe second recipe is used.  If a.o is out of date with respect to
Xb.h then both recipes are invoked to make a.o.
XIn the last case the order of invocation corresponds to the order in which the
Xrule definitions appear in the makefile.
X.PP
XTargets defined using a single `:' operator
Xwith a recipe may be redefined again with a new recipe by using a
X`:' operator with a `:' modifier.
XThis is equivalent to a target having been
Xinitially defined with a rule using a `:' modifier.
XOnce a target is defined using a `:'
Xmodifier it may not be defined again with a recipe using only the `:' operator
Xwith no `:' modifier.  In both cases the use of a `:' modifier creates a new
Xlist of prerequisites and makes it the current prerequisite list for the target.
XThe `:' operator with no recipe always modifies the current list
Xof prerequisites.
XThus assuming each of the following definitions has a recipe attached, then:
X.RS
X.sp
X.nf
Xjoe :  fred ...	(1)
Xjoe :: more ...	(2)
X.sp
Xand
X.sp
Xjoe :: fred ...	(3)
Xjoe :: more ...	(4)
X.sp
X.fi
X.RE
Xare legal and mean:  add the recipe associated with (2), or (4) to the set
Xof recipes for joe, placing them after existing recipes for
Xmaking joe.
XThe construct:
X.RS
X.sp
X.nf
Xjoe :: fred ...	(5)
Xjoe : more ...	(6)
X.sp
SHAR_EOF
echo "End of part 7"
echo "File man/dmake.tf is continued in part 8"
echo "8" > s2_seq_.tmp
exit 0