From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 24-JAN-1989 01:57
To:	MRGATE::"ARISIA::EVERHART"
Subj:	MAKE.SHAR (part 1 of 5; repackaged).


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 23 JAN 89 19:25:22 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Mon, 23 Jan 89 18:55:00 PST
Received: by ucbvax.Berkeley.EDU (5.61/1.33)
	id AA12869; Mon, 23 Jan 89 18:37:40 -0800
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 23 Jan 89 17:37:19 GMT
From: tektronix!gvgpsa!gvgpvd!tony@ucbvax.Berkeley.EDU  (Tony Ivanov)
Organization: Grass Valley Group, Inc., Grass Valley, CA
Subject: MAKE.SHAR (part 1 of 5; repackaged).
Message-Id: <1011@gvgpvd.GVG.TEK.COM>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


	This a the VMS public domain MAKE source.  Included with the
source is a GLOBAL MAKEFILE that can be placed in a utility directory
with a logical name "MAKEINIT" pointing to it.  This makefile will
always be searched prior to executing the local makefile (good for
customizing site specific stuff).
	Also included is the source to TOUCH and ECHO (useful
commands that go into makefiles).  Following are installation steps:
    1)	Create a MAKE source directory.
    2)	$ COPY MAKE.SHAR* MAKE.SHAR
    3)	Move MAKE.SHAR to the source directory.
    4)	$ @MAKE.SHAR
    5)	$ @INITIAL.MAKE
From then on (after make is compiled), if you make changes, you can
use MAKE to re-make itself.

	Some notes on make:  I have changed the SYMBOL parsing
algorithm to accept commas and plusses as well as blanks.  This is
quite necessary for VMS command parsing.  Also, I have changed the
terminal I/O to do buffered I/O rather than character I/O since
buffered I/O is much faster.
$! ..................... Cut between dotted lines and save. ....................
$!.............................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.06 11-DEC-1988.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user TONY
$! on 16-DEC-1988 15:05:25.69.
$!
$! ATTENTION: To keep each article below 51 blocks (26112 bytes), this
$!            program has been transmitted in 5 parts.  You should
$!            concatenate ALL parts to ONE file and execute (@) that file.
$!
$! It contains the following 18 files:
$!        MAKE.HLP
$!        INITIAL.MAKE
$!        MAKEFILE.
$!        MAKEFILE.GLOBAL
$!        CHECK.C
$!        ECHO.C
$!        INPUT.C
$!        MACRO.C
$!        MAIN.C
$!        MAKE.C
$!        READER.C
$!        RULES.C
$!        TOUCH.C
$!        VAXVMS.C
$!        H.H
$!        VAXC_SHARE.OPT
$!        VMS_RULES.DOC
$!        TYPES.H
$!
$!==============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.06 11-DEC-1988 requires VMS V4.4 or higher."
$ EXIT 44 ! SS$_ABORT
$VERSION_OK:
$ GOTO START
$!
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY
b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) )
; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE
, b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors 
:= 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN 
& "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION
( BEGINNING_OF( b_part ) ); LOOP EXITIF SEARCH( SPAN( ' ' )@r_trail 
& LINE_END, FORWARD) = 0; POSITION( r_trail ); ERASE( r_trail ); ENDLOOP
; POSITION( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK
( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 )
; IF s_x = '+' THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip 
<> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF
; ENDIF; IF s_x = '-' THEN r_skip := SEARCH( pat_end, FORWARD, EXACT )
; IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip 
:= MARK( NONE ); r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip 
<> 0 THEN POSITION( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET )
; MOVE_VERTICAL( 1 ); MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) 
); ENDIF; ERASE( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF
; IF s_x = 'V' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1
; MOVE_VERTICAL( 1 ); ENDIF; IF s_x = 'X' THEN s_x := ''; IF i_append_line 
<> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF
; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> '' THEN i_errors 
:= i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT
( "The following line could not be unpacked properly:" ); SPLIT_LINE
; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL
( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH
( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 
); COPY_TEXT( ASCII( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDLOOP
; IF i_errors = 0 THEN SET( NO_WRITE, b_errors, ON ); ELSE POSITION
( BEGINNING_OF( b_errors ) ); COPY_TEXT( FAO
( "The following !UL errors were detected while unpacking !AS", i_errors
, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" )
; ENDIF; EXIT; 
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!!,passed." )
$ RETURN
$!
$START:
$ FILE_IS = "MAKE.HLP"
$ CHECKSUM_IS = 2114246176
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X                            MAKE
X            Implementation of Unix make Utility
X                            for
X         TOPS-20 & VMS & MS-DOS & UNIX & EON & OS/9
X                        [18-Apr-87]
X
XMAKE is a version of  a public-domain implementation of  the
XUnix  make  utility.   A  single  source  program   supports
Xversions for TOPS-20, VAX VMS, MS-DOS, UNIX, EON, and  OS/9;
Xthe choice between them is made at compile-time when MAKE is
Xbuilt.  It is compatible to a high degree with the  original
XUnix  version,  as  far  as  the  syntax  of  MAKEFILE's  is
Xconcerned.  The built-in default rules have been modified to
Xbe suitable for TOPS-20, VAX  VMS, and MS-DOS, and a  number
Xof additional rules have been added.  They are given  below.
X
XThe essential ideas behind MAKE are:
X
X        Many  common  tasks  in  software  development   are
X        repetitive (edit - compile -  link - run and  test),
X        and should be encapsulated in a command file to save
X        typing.
X
X        Processing (e.g. compilation)  of a  single file  is
X        unnecessary if that  file, and  its dependent  files
X        (e.g. #include  files)  are older  than  the  output
X        file(s) of the processing step.
X
X        A computer  program  specially constructed  for  the
X        purpose (MAKE) can read  a list of dependencies  and
X        rules from a file, and from them, and from the  file
X        last-write time stamps, determine what steps need to
X        be taken to bring everything up to date.
X
XComplete documentation  on MAKE  can be  found in  any  Unix
Xmanual   on   the   corresponding   man   page   (the   file
X/usr/man/man1/make on most Unix  systems).  The man page  is
Xavailable in INFO  node (UNIXMAN)MAKE  on UTAH-SCIENCE.   An
Xextended description is found in
X
X        S.I. Feldman,  "Make --  A Program  for  Maintaining
X        Computer Programs", pp.  291-300, Unix  Programmer's
X        Manual,  Volume  2,  Holt,  Rinehardt  and   Winston
X        (1983).
X
XThat article is in /usr/doc/make  on most Unix systems,  and
Xis in INFO node MAKE on UTAH-SCIENCE.
X
XThe original version of MAKE  was done by Stuart Feldman  in
X1978.  This  multi-operating-system version  is based  on  a
Xpublic-domain posting  of 3-Dec-86  to the  Usenet  bulletin
Xboard  mod.sources,  its  author  known  only  by  an  EMAIL
Xaddress: Caret@FAIRLIGHT.OZ.  It contained support for Unix,
XOS9, and  EON  operating  systems.  The  TOPS-20,  VMS,  and
XMS-DOS   support   was   added   by   Nelson   H.F.    Beebe
X(BEEBE@UTAH-SCIENCE).
X
XSupport for  VAX VMS  libraries  was borrowed  from  another
Xpublic-domain  VMS  MAKE  by  Todd  Aven.   This  permits  a
Xfilename   in    a    MAKEFILE    to    be    replaced    by
X"libname.xlb(modulename)".   The   library   filename   must
Xinclude the file extension, since  it cannot be inferred  by
Xcontext.  Here is a simple example:
X
Xfoo.olb(bar):`009bar.obj
X`009library foo.olb bar.obj
X`009delete bar.obj
X
Xfee.exe:`009fee.obj foo.olb(bar)
X`009link fee,foo/lib
X
XWith library targets,  the macro $@  expands to the  library
Xname, and $% to the  module name.  Library support is  still
Xweak in that there is no  way in the current MAKE syntax  to
Xspecify a  default  rule  for installing  a  module  into  a
Xlibrary, since the rule syntax assumes the files differ only
Xin extension.
X
XUnder Unix, when MAKE determines that it needs to execute  a
Xshell command to update a target  file, it issues a call  to
Xsystem() in the standard C library.  The command is executed
Xby a fresh copy of the shell, and it returns an exit code (0
Xon success, non-zero on  error) to the  shell which in  turn
Xreturns that code to MAKE.
X
XThe implementation of system()  with the KCC compiler  under
XTOPS-20 differs somewhat, in  that the shell (TOPS-20  EXEC)
Xis fed its commands  from the terminal  input buffer, as  if
Xthey were typed  by the user,  exactly like the  DO and  MIC
Xcommands and the batch job controller do, instead of getting
Xthem from a file.  This  mechanism is necessary because  the
XEXEC has not been trained to exit gracefully at  end-of-file
Xin a top-level command  file.  The net  effect is the  same,
Xwith the exception that it  is possible for user  type-ahead
Xto be mixed  in with  the input  MAKE is  stuffing into  the
Xterminal input buffer;  therefore, when  running MAKE,  keep
Xyour fingers off the keys until it is done.
X
XIf you wish to have  MAKE's commands executed in batch,  the
Xcommand list can be captured in a file, and not executed  by
XMAKE, as follows:
X
X        make -n >foo.ctl
X        submit foo
X
XTOPS-20 commands do  not return any  command status code  to
Xtheir parent, so a TOPS-20 MAKE  run may attempt to do  more
Xsteps than it  would under Unix,  since it normally  assumes
Xthat each step succeeds.
X
XThe touch (-t) option is not yet implemented in the  TOPS-20
Xand VAX VMS versions of MAKE.
X
X[ This  version of make  has been  modifed to include -t for`032
X  VAX VMS -- Tony Ivanov, Grass Valley Group ]
X
XUnlike  Unix  make,   this  MAKE  has   been  built  to   be
Xcase-insensitive, both  for command-line  switches, and  for
Xrules and file  names in makefiles.   A compile-time  switch
Xcan select case sensitivity if desired.
X
XIn order  to  support multi-line  strings  to be  passed  to
Xsystem() (usually  a  program  invocation  and  its  input),
XTOPS-20 MAKE provides for the substition of "\n" literals in
Xrule lines by newlines prior to calling system.  Here is  an
Xexample:
X
Xliblcl: fileof.rel jfnof.rel freass.rel system.rel getlog.rel
X        delete liblcl.rel
X        maklib\n\
X        liblcl=freass,fileof/a,getlog/a,jfnof/a,system/a\n\
X        liblcl=liblcl/index\n\
X        `026
X        copy liblcl.rel.0 c:
X        delete liblcl.rel
X
XNote that  the  MAKLIB  invocation actually  consists  of  4
Xlines.  The backslash on the first 3 is necessary to get the
Xrule picked up as one string, and the "\n" sequences will be
Xconverted to newlines by doexp() before the rule line (which
Xis really 4 lines) is passed to system().
X
XMAKE has fairly lax parsing  rules, and the only  characters
Xthat are  particulary  significant are  white  space  (token
Xseparators),  initial  tab  (on  a  rule  line),  colon  and
Xsemicolon following  a  target  name, and  equals  in  macro
Xassignments.    Nevertheless,    these   characters    could
Xconceivably be  required  in names,  particularly  colon  in
XTOPS-20, VMS, and MS-DOS filenames.  Therefore, an extension
Xto Unix make is adopted which permits a backslash to protect
Xthe following  character from  special interpretation.   The
Xfollowing sequences are recognized:
X
X        \n      LF, newline
X        \t      HT, horizontal tab
X        \b      BS, backspace
X        \r      CR, carriage return
X        \f      FF, formfeed
X        \\      \, backslash
X        \'      ', single quote
X        \ddd    ddd, character corresponding to 1, 2, or 3
X                octal digit bit pattern.
X
XAny other  backslash-char  pair  is  reduced  to  char;  for
Xexample, \= will be reduced to =, and \\ to \.
X
X[ Also, this  version of make allows "commas and plusses" to
X  separate tokens.  This is useful for VAX VMS commands such
X  as:
X        CC=cc
X        LD=link
X
X        SRC=a.c+b.c+c.c
X        OBJ=a.obj,b.obj,c.obj
X        LIBS=,sys$$library\:vaxcrtl.olb/lib
X
X        PROG.EXE: $(OBJ)
X                $(CC) $(SRC)
X                $(LD) $(OBJ) $(LIBS)
X  These changes made by Tony Ivanov, Grass Valley Group. ]
X
XHere is the complete list  of built-in TOPS-20 MAKE  macros,
Xrules, and suffixes.  It was produced by requesting MAKE  to
Xprint its built-in values by executing
X
X        MAKE -p
X
Xin a PHOTO session, then editing the output PHOTO log.  Note
Xthat it includes rules for compiling source code in C, FAIL,
XFORTRAN,  MACRO, MIDAS,  PASCAL,   and  SFTRAN3,   and   for
Xprocessing various  TeX  files.  All  compiler  and  program
Xnames used  in  built-in  rules are  defined  by  macros  to
Xfacilitate modifying  MAKE's behavior.   Finally, macros  RM
Xand MV are used for DELETE and RENAME, to facilitate porting
XMAKEFILE's from TOPS-20 to Unix.
X
X        $ = $
X        AFLAGS =
X        AMSTEX = AMSTeX
X        AMSTEXFLAGS = \batchmode
X        AS = compile
X        CC = kcc
X        CFLAGS =
X        FC = compile
X        FFLAGS = /debug:(argument,label)
X        LATEX = LaTeX
X        LATEXFLAGS = \batchmode
X        MV = rename
X        PC = compile
X        PFLAGS =
X        RM = delete
X        SF3 = sf3
X        SLITEX = SliTeX
X        SLITEXFLAGS = \batchmode
X        TEX = TeX
X        TEXFLAGS = \batchmode
X        YACC = yacc
X
X        .atx.dvi:
X        -       $(AMSTEX) $(AMSTEXFLAGS) \input $<
X
X
X        .amstex.dvi:
X        -       $(AMSTEX) $(AMSTEXFLAGS) \input $<
X
X
X        .c.rel:
X        -       $(CC) $(CFLAGS) -c $<
X
X
X        .fai.rel:
X        -       $(AS) $(AFLAGS) $<
X
X
X        .mac.rel:
X        -       $(AS) $(AFLAGS) $<
X
X
X        .mid.rel:
X        -       $(AS) $(AFLAGS) $<
X
X
X        .for.rel:
X        -       $(FC) /fortran/language:"$(FFLAGS)" $<
X
X
X        .f.rel:
X        -       $(FC) /fortran/language:"$(FFLAGS)" $<
X
X
X        .ltx.dvi:
X        -       $(LATEX) $(LATEXFLAGS) \input $<
X
X
X        .latex.dvi:
X        -       $(LATEX) $(LATEXFLAGS) \input $<
X
X
X        .pas.rel:
X        -       $(PC) /pascal/language:"$(PFLAGS)" $<
X
X
X        .p.rel:
X        -       $(PC) /pascal/language:"$(PFLAGS)" $<
X
X
X        .sf3.for:
X        -       $(SF3) $(SF3FLAGS) $<
X
X
X        .stx.dvi:
X        -       $(SLITEX) $(SLITEXFLAGS) \input $<
X
X
X        .slitex.dvi:
X        -       $(SLITEX) $(SLITEXFLAGS) \input $<
X
X
X        .tex.dvi:
X        -       $(TEX) $(TEXFLAGS) \input $<
X
X
X        .y.c:
X        -       $(YACC) $(YFLAGS) $<
X        -       $(MV) ytab.c $@
X
X
X        .y.rel:
X        -       $(YACC) $(YFLAGS) $<
X        -       $(CC) $(CFLAGS) -c ytab.c
X        -       $(RM) ytab.c
X        -       $(MV) ytab.rel $@
X
X        .SUFFIXES: .exe .rel .dvi .c .y .l .mac .fai .mid .sf3 .for .f \
X                   .pas .p .tex .latex .ltx .slitex .stx .amstex .atx \
X                   .inc .h
$ GOSUB UNPACK_FILE
$ FILE_IS = "INITIAL.MAKE"
$ CHECKSUM_IS = 1696560800
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$ on error then goto end
X$ on control_Y then goto end
X$ sv = f$verify ("YES")
X$`009CC/LIST CHECK.C,INPUT.C,MACRO.C,MAIN.C,MAKE.C,READER.C,RULES.C,VAXVMS.C
X$`009LINK/EXE=MAKE.EXE CHECK.OBJ,INPUT.OBJ,MACRO.OBJ,MAIN.OBJ,MAKE.OBJ, -
X`009READER.OBJ,RULES.OBJ,VAXVMS.OBJ,VAXC_SHARE.OPT/OPT
X$!`009LINK/EXE=MAKE.EXE CHECK.OBJ,INPUT.OBJ,MACRO.OBJ,MAIN.OBJ,MAKE.OBJ, -
X$!`009READER.OBJ,RULES.OBJ,VAXVMS.OBJ,SYS$LIBRARY:VAXCRTL.OLB/LIB
X$ end:`009sv=f$verify(sv)
$ GOSUB UNPACK_FILE
$ FILE_IS = "MAKEFILE."
$ CHECKSUM_IS = 775957548
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X#
X#`009This is the make file for "make"
X#
X
XPROGRAM =`009MAKE
X
X#`009These are system dependent variables
X#`009`009INSTALL_DIR -`009`009# Where the program will be installed.
X#`009`009PROG_NAME -`009`009# Actual name of the program.
X#`009`009CFLAGS - `009`009# How to get listings during compilation.
X#`009`009LD -`009`009`009# What the name of the image loader is.
V#`009`009IMAGE_NAMER -`009`009# What the flag is to create an image with a ce
Xrtain name.
X#`009`009LDFLAGS -`009`009# How to link in run-time libraries.
V#`009`009PURGE -`009`009`009# How to remove duplicate file names...meaningles
Xs for UNIX.
X#`009`009RENAME -`009`009# How to change the name of a file..."mv" for UNIX.
X#`009`009COPY -`009`009`009# How to copy files..."cp" for UNIX.
X#`009`009SHAR -`009`009`009# How to make a "shar" file.
X#
XINSTALL_DIR`009=GLIB:
XTARGET_DIR`009=
XPROG_NAME`009=$(PROGRAM).EXE
XCFLAGS`009`009=/list
XLD`009`009=link
XIMAGE_NAMER`009=/exe=
XLDFLAGS`009`009=,vaxc_share/opt
XPURGE`009`009=purge
XRENAME`009`009=rename
XCOPY`009`009=copy/replace/nolog
XSHAR`009`009=vms_shar
X#
X#`009Source and object files.
X#
XSOURCE`009`009=CHECK.C,INPUT.C,MACRO.C,MAIN.C,MAKE.C,READER.C,\
X`009`009 RULES.C,VAXVMS.C
X
XOBJECTS`009`009=CHECK.OBJ,INPUT.OBJ,MACRO.OBJ,MAIN.OBJ,MAKE.OBJ,\
X`009`009 READER.OBJ,RULES.OBJ,VAXVMS.OBJ
X
VSHAR_FILES`009=MAKE.HLP,INITIAL.MAKE,MAKEFILE.*,*.C,*.H,*.OPT,*.DOC,GLIBSRC:T
XYPES.H
X#
X#`009Main target
X#
X$(PROGRAM):`009$(TARGET_DIR)$(PROG_NAME)
X`009`009@make install
X`009`009@make clean
X`009`009@touch $(PROGRAM)
X
X$(TARGET_DIR)$(PROG_NAME):`009$(OBJECTS)
X`009`009$(LD) $(IMAGE_NAMER) $(TARGET_DIR)$(PROG_NAME) $(OBJECTS) $(LDFLAGS)
X
Xinstall:`009$(TARGET_DIR)$(PROG_NAME)
X`009`009$(PURGE) $(TARGET_DIR)$(PROG_NAME)
X`009`009$(COPY) $(TARGET_DIR)$(PROG_NAME) $(INSTALL_DIR)
X`009`009$(PURGE) $(INSTALL_DIR)$(PROG_NAME)
X`009`009@touch install
X
Xclean:
X`009`009$(PURGE)
X
Xshar:`009`009$(SHAR_FILES)
X`009`009$(SHAR) $(SHAR_FILES) make.shar
X`009`009@echo "Be sure to copy $$$$$$README to the MAKE.SHAR1_OF_*.\007"
X#
X#`009Miscellaneous dependencies.
X#
XCHECK.obj:`009h.h
XINPUT.obj:`009h.h
XMACRO.obj:`009h.h
XMAIN.obj:`009h.h
XMAIN.obj:`009sys$$library:errno.h
XMAKE.obj:`009h.h
XMAKE.obj:`009sys$$library:stat.h
XMAKE.obj:`009sys$$library:errno.h
XREADER.obj:`009h.h
XRULES.obj:`009h.h
XVAXVMS.obj:`009sys$$library:descrip.h
XVAXVMS.obj:`009sys$$library:ssdef.h
$ GOSUB UNPACK_FILE
$ FILE_IS = "MAKEFILE.GLOBAL"
$ CHECKSUM_IS = 743154659
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X#
X#`009This is the default makefile to set up standard
X#`009rules for GVG.
X#
X#`009`009CFLAGS -`009Default C compilation flags.
X#`009`009FFLAGS -`009Default FORTRAN compilation flags.
X#`009`009AFLAGS -`009Default MACRO compilation flags.
X#`009`009LD -`009`009Loader name.
X#`009`009RM -`009`009File remover name.
X#`009`009RTL_SHARE -`009Command to link in shareable run-time libraries.
X#`009`009FORRTL_SHARE -`009Command to link in shareable run-time libraries.
X#`009`009LIBS -`009`009List of library names.
X#
XFFLAGS`009`009=/list
XCFLAGS`009`009=/list
XAFLAGS`009`009=/list
XLD`009`009=link
XRM`009`009=delete/nolog
XCRTL_SHARE`009=,vaxc_share/opt
XFORRTL_SHARE`009=
XLIBS`009`009=
X.c.exe:
X`009@make $*.obj
X`009$(LD) $(LDFLAGS) $*.obj $(LIBS) $(CRTL_SHARE)
X`009@$(RM) $*.obj;
X
X.for.exe:
X`009@make $*.obj
X`009$(LD) $(LDFLAGS) $*.obj $(LIBS) $(FORRTL_SHARE)
X`009@$(RM) $*.obj;
X
X.mar.exe:
X`009@make $*.obj
X`009$(LD) $(LDFLAGS) $*.obj $(LIBS)
X`009@$(RM) $*.obj;
X
X#
X#`009The following definitions are used for RUNOFF.
X#`009`009RC -`009`009Runoff command.
X#`009`009RFLAGS -`009Default RUNOFF flags.
X#`009`009MEMFLAGS -`009Runoff flags used to create .MEM files.
X#`009`009BRNFLAGS -`009Runoff flags used to create .BRN files.
X#`009`009RNTFLAGS -`009Runoff flags used to create .RNT files.
X#`009`009MECFLAGS -`009Runoff flags used to create .MEC files.
X#
X.SUFFIXES:`009.mem .rno .mec .rnt .brn
XRC =`009`009runoff
XRFLAGS =`009/right=6
X.rno.mem:
X`009$(RC) $(RFLAGS)$(MEMFLAGS) $*.rno
X
X.rno.brn:
X`009$(RC)/intermediate $(RFLAGS)$(BRNFLAGS) $*.rno
X
X.brn.rnt:
X`009$(RC)/contents $(RNTFLAGS) $*.brn
X
X.rnt.mec:
X`009$(RC) $(RFLAGS)$(MECFLAGS) $*.rnt
$ GOSUB UNPACK_FILE
$ FILE_IS = "CHECK.C"
$ CHECKSUM_IS = 2101212558
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/*
X *`009Check structures for make.
X */
X
X#include "h.h"
X
X
X/*
X *`009Prints out the structures as defined in memory.  Good for check
X *`009that you make file does what you want (and for debugging make).
X */
Xvoid
Xprt()
X`123
X    register NAMEP np;
X    register DEPENDP dp;
X    register LINEP lp;
X    register CMDP cp;
X    register MACROP mp;
X
X
X    for (mp = macrohead; mp; mp = mp->m_next)
X`009fprintf(stderr, "%s = %s\n", mp->m_name, mp->m_val);
X
X    fputc('\n', stderr);
X
X    for (np = namehead.n_next; np; np = np->n_next)
X    `123
X`009if (np->n_flag & N_DOUBLE)
X`009    fprintf(stderr, "%s::\n", np->n_name);
X`009else
X`009    fprintf(stderr, "%s:\n", np->n_name);
X`009if (np == firstname)
X`009    fprintf(stderr, "(MAIN NAME)\n");
X`009for (lp = np->n_line; lp; lp = lp->l_next)
X`009`123
X`009    fputc(':', stderr);
X`009    for (dp = lp->l_dep; dp; dp = dp->d_next)
X`009`009fprintf(stderr, " %s", dp->d_name->n_name);
X`009    fputc('\n', stderr);
X
X`009    for (cp = lp->l_cmd; cp; cp = cp->c_next)
X`009`009fprintf(stderr, "-%c%s\n", TAB, cp->c_cmd);
X
X`009    fputc('\n', stderr);
X`009`125
X`009fputc('\n', stderr);
X    `125
X`125
X
X
X/*
X *`009Recursive routine that does the actual checking.
X */
Xvoid
Xcheck(np)
XNAMEP np;
X`123
X    register DEPENDP dp;
X    register LINEP lp;
X
X
X    if (np->n_flag & N_MARK)
X    `123
X`009sprintf(str1, "Circular dependency from %s", np->n_name);
X`009fatal(str1);
X    `125
X
X
X    np->n_flag `124= N_MARK;
X
X    for (lp = np->n_line; lp; lp = lp->l_next)
X`009for (dp = lp->l_dep; dp; dp = dp->d_next)
X`009    check(dp->d_name);
X
X    np->n_flag &= `126N_MARK;
X`125
X
X
X/*
X *`009Look for circular dependancies.
X *`009ie.
X *`009`009a: b
X *`009`009b: a
X *`009is a circular dep
X */
Xvoid
Xcirch()
X`123
X    register NAMEP np;
X
X
X    for (np = namehead.n_next; np; np = np->n_next)
X`009check(np);
X`125
X
X
X/*
X *`009Check the target .PRECIOUS, and mark its dependentd as precious
X */
Xvoid
Xprecious()
X`123
X    register DEPENDP dp;
X    register LINEP lp;
X    register NAMEP np;
X
X
X    if (!((np = newname(".PRECIOUS"))->n_flag & N_TARG))
X`009return;
X
X    for (lp = np->n_line; lp; lp = lp->l_next)
X`009for (dp = lp->l_dep; dp; dp = dp->d_next)
X`009    dp->d_name->n_flag `124= N_PREC;
X`125
$ GOSUB UNPACK_FILE
$ FILE_IS = "ECHO.C"
$ CHECKSUM_IS = 709352348
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
Xmain (argc, argv)
X`009int`009argc;
X`009char`009*argv[];
X`123
X`009for (--argc;  argc;  argc--)
V`009`123`009squeeze (*(++argv));`009`009`009/* convert back-slash characters
X to ascii. */
X`009`009if (strchr(*argv,'%'))`009`009`009/* can't handle formats yet */
X`009`009`009printf ("%s",*argv);
X`009`009else
X`009`009`009printf (*argv);
X`009`009putchar (' ');
X`009`125
X`009putchar ('\n');
X`125
X
X
X
Xsqueeze(s)
Xregister char *s;
X/**
X ** Expand standard C escape sequences in-place in the argument
X ** string.  The valid escapes are:
X **
X ** `009\n`009LF, newline
X ** `009\t`009HT, horizontal tab
X ** `009\b`009BS, backspace
X ** `009\r`009CR, carriage return
X ** `009\f`009FF, formfeed
X ** `009\\`009\, backslash
X ** `009\'`009', single quote
X ** `009\ddd`009ddd, character corresponding to 1, 2, or 3 octal digit
X ** `009`009bit pattern.
X **
X ** Any other backslash-char pair is reduced to char.
X **/
X`123
X    register int c;
X    register int k;
X    register char *result;
X    char *original;
X
X    original = s;
X
X    for (result = s; *s; /* NO-OP */ )
X    `123
X`009if (*s != '\\')
X`009    *result++ = *s;
X`009else`009`009`009/* have backslashed character */
X`009`123
X`009    switch (*(++s))
X`009    `123
X`009    case '\0':`009`009/* end of string reached */
X`009`009break;
X
X`009    case '0':
X`009    case '1':
X`009    case '2':
X`009    case '3':
X`009    case '4':
X`009    case '5':
X`009    case '6':
X`009    case '7':
X`009`009c = (int) ((*s) - '0');
X`009`009for (k = 0; k < 2; ++k)
X`009`009`123`009`009/* collect octal digit string */
X`009`009    ++s;
X`009`009    if (('0' <= (*s)) && ((*s) <= '7'))
X`009`009`009c = 8 * c + (int) ((*s) - '0');
X`009`009    else`009/* advanced past octal digit */
X`009`009    `123
X`009`009`009--s;
X`009`009`009break;
X`009`009    `125
X`009`009`125
X`009`009*result++ = (char) c;
X`009`009break;
X
X`009    case 'n':
X`009`009*result++ = '\n';
X`009`009break;
X
X`009    case 't':
X`009`009*result++ = '\t';
X`009`009break;
X
X`009    case 'b':
X`009`009*result++ = '\b';
X`009`009break;
X
X`009    case 'r':
X`009`009*result++ = '\r';
X`009`009break;
X
X`009    case 'f':
X`009`009*result++ = '\f';
X`009`009break;
X
X`009    case '\\':
X`009`009*result++ = '\\';
X`009`009break;
X
X`009    case '\'':
X`009`009*result++ = '\'';
X`009`009break;
X
X`009    default:`009`009/* \x becomes x for all other x's */
X`009`009*result++ = *s;
X`009`009break;
X`009    `125
X`009`125
X`009if (*s)
X`009    ++s;
X    `125
X    *result = '\0';
X
X`125
$ GOSUB UNPACK_FILE
$ FILE_IS = "INPUT.C"
$ CHECKSUM_IS = 57070876
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/*
X *`009Parse a makefile
X */
-+-+-+-+-+ End of part 1 +-+-+-+-+-
-- 
/* My opinions...             *  Tony Ivanov   MS-4B       *  ...ucbvax!   */
/* shared by my company?!...  *  Grass Valley Group, Inc.  *  tektronix!   */
/* you've got to be kidding!  *  P.O. Box 1114             *  gvgpsa!      */
/* "tony@gvgpvd.GVG.TEK.COM"  *  Grass Valley, CA  95945   *  gvgpvd!tony  */

