From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 25-DEC-1988 16:49
To:	MRGATE::"ARISIA::EVERHART"
Subj:	MAKE.SHAR (part 5 of 5)


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Tue, 20 DEC 88 00:10:21 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Tue, 20 Dec 88 00:01:05 PST
Received: by ucbvax.Berkeley.EDU (5.61/1.33)
	id AA27617; Mon, 19 Dec 88 23:28:52 PST
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: 5 Dec 88 23:35:02 GMT
From: tektronix!gvgpsa!gvgpvd!tony@ucbvax.Berkeley.EDU  (Tony Ivanov)
Organization: Grass Valley Group, Inc., Grass Valley, CA
Subject: MAKE.SHAR (part 5 of 5)
Message-Id: <926@gvgpvd.GVG.TEK.COM>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


$Part5:
$ File_is="H.H"
$ Check_Sum_is=975913857
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X/*
X *`009Include header for make
X */
X
X/* Include the most-needed system files */
X#include <stdio.h>
X#include <ctype.h>
X
X#ifdef EON
Xtypedef long time_t;
X#endif
X
X#ifdef KCC_20
X#include <types.h>`009`009/* need for time_t */
X#endif
X
X#ifdef MSC
X#include <sys/types.h>`009`009/* need for time_t */
X#include <sys/utime.h>
X#include <process.h>`009`009/* for library type declarations */
X#include <stdlib.h>`009`009/* for library type declarations */
X#include <string.h>`009`009/* for library type declarations */
X#include <time.h>`009`009/* for library type declarations */
X#define index strchr
X#define rindex strrchr
X#endif
X
X#ifdef OS9
Xtypedef long time_t;
X#endif
X
X#ifdef UNIX
X#include <sys/types.h>`009`009/* need for time_t */
X#endif
X
X#ifdef VMS
X#include <types.h>`009`009/* need for time_t */
X#define index strchr
X#define rindex strrchr
X#define system vms_system`009/* UNIX-like system service for VMS. */
X#define unlink vms_unlink`009/* UNIX-like system service for VMS. */
X#define CASE_INSENSITIVE`009/* Very hard to make "make" work without this! */
X#define MAYBE_REVERT`009`009/* Good idea in MAKE.C...look at it. */
X#endif
X
X#ifdef VMS
X#define EXIT vms_exit
X#else
X#define EXIT exit
X#endif
X
X#ifndef uchar
X#ifdef OS9
Xtypedef char uchar;
Xtypedef int void;
X#define fputc`009`009putc
X#else
Xtypedef unsigned char uchar;
X#endif
X#endif
X
Xtypedef uchar bool;
X
X#define NOTIME`009`009((time_t)0)
X#define TRUE`009`009((bool)1)
X#define FALSE`009`009((bool)0)
X#define max(a,b)`009((a)>(b)?(a):(b))
X
X#ifdef EON
X#define MAKEFILES`009"Makefile"
X#define MORE`009`009"\\\n"`009/* how to continue shell command lines */
X#define NAMESEP`009`009';'`009/* for makeinit(); this may need changing */
X#define TAB`009`009'\t'
X#endif
X
X#ifdef KCC_20
X#define MAKEFILES`009"Makefile"
X#define MORE`009`009"\n"`009/* how to continue shell command lines */
X#define NAMESEP`009`009';'`009/* for makeinit(); this may need changing */
X#define TAB`009`009'\t'
X#endif
X
X#ifdef MSC
X#define MAKEFILES`009"Makefile"
X#define MORE`009`009"\\\n"`009/* how to continue shell command lines */
X#define NAMESEP`009`009';'`009/* for makeinit(); this may need changing */
X#define TAB`009`009'\t'
X#endif
X
X#ifdef OS9
X#define MAKEFILES`009"Makefile"
X#define MORE`009`009"\\\n"`009/* how to continue shell command lines */
X#define NAMESEP`009`009';'`009/* for makeinit(); this may need changing */
X#define TAB`009`009' '`009/* OS9 seems not to have tab, why? */
X#endif
X
X#ifdef UNIX
X#define MAKEFILES "makefile Makefile s.makefile s.Makefile SCCS/s.makefile \
XSCCS/s.Makefile"
X#define MORE`009`009"\\\n"`009/* how to continue shell command lines */
X#define NAMESEP`009`009';'`009/* for makeinit(); this may need changing */
X#define TAB`009`009'\t'
X#endif
X
X#ifdef VMS
X#define MAKEFILES`009"Makefile"
X#define MORE`009`009"\n"`009/* how to continue shell command lines */
X#define NAMESEP`009`009';'`009/* for makeinit(); this may need changing */
X#define TAB`009`009'\t'
X#endif
X
X#ifdef MSC
X#define MAXSTRING (4096)`009/* Line size -- BIG for long dependency lists */
X#else
X#define MAXSTRING (20480)`009/* Line size -- BIG for long dependency lists */
X#endif
X
X/* Make structure pointer types so we can use them in struct's */
Xtypedef struct cmd *CMDP;
Xtypedef struct depend *DEPENDP;
Xtypedef struct line *LINEP;
Xtypedef struct macro *MACROP;
Xtypedef struct name *NAMEP;
X
X/*
X *`009A name.  This represents a file, either to be made, or existant
X */
Xtypedef struct name
X{
X    NAMEP n_next;`009`009/* Next in the list of names */
X    char *n_name;`009`009/* Called */
X    LINEP n_line;`009`009/* Dependencies */
X    time_t n_time;`009`009/* Modify time of this name */
X    uchar n_flag;`009`009/* Info about the name */
X}   NAME;
X
X#define N_MARK`009`0090x01`009/* For cycle check */
X#define N_DONE`009`0090x02`009/* Name looked at */
X#define N_TARG`009`0090x04`009/* Name is a target */
X#define N_PREC`009`0090x08`009/* Target is precious */
X#define N_DOUBLE`0090x10`009/* Double colon target */
X#define N_DEFAULT`0090x20`009/* Default (in makefile name list) */
X
X/*
X *`009Definition of a target line.
X */
X
Xtypedef struct line
X{
X    LINEP l_next;`009`009/* Next line (for ::) */
X    DEPENDP l_dep;`009`009/* Dependents for this line */
X    CMDP l_cmd;`009`009`009/* Commands for this line */
X}   LINE;
X
X/*
X *`009List of dependents for a line
X */
Xtypedef struct depend
X{
X    DEPENDP d_next;`009`009/* Next dependent */
X    NAMEP d_name;`009`009/* Name of dependent */
X}   DEPEND;
X
X
X/*
X *`009Commands for a line
X */
Xtypedef struct cmd
X{
X    CMDP c_next;`009`009/* Next command line */
X    char *c_cmd;`009`009/* Command line */
X}   CMD;
X
X
X/*
X *`009Macro storage
X */
Xtypedef struct macro
X{
X    MACROP m_next;`009`009/* Next variable */
X    char *m_name;`009`009/* Called ... */
X    char *m_val;`009`009/* Its value */
X    uchar m_flag;`009`009/* Infinite loop and permanent flags */
X}   MACRO;
X
X#define M_SEEN`009`0090x01`009/* macro name seen in search loop */
X#define M_PERMANENT`0090x02`009/* macro is permanent (command line) */
X
X#define PERMANENT`009TRUE
X#define TEMPORARY`009FALSE
X
X
X/*
X *`009Default rules structure
X */
X
Xtypedef struct rule
X{
X    char *r_target;`009`009/* target name */
X    char *r_command;`009`009/* commands to build target */
X}   RULE;
X
Xextern int debug;
Xextern bool domake;
Xextern bool dotouch;
Xextern NAMEP firstname;
Xextern bool ignore;
Xextern int lineno;
Xextern MACROP macrohead;
Xextern char *myname;
Xextern struct name namehead;
Xextern bool quest;
Xextern bool rules;
Xextern bool silent;
Xextern char str1[];
X
X#ifndef VMS
Xextern int errno;
X#endif
X
X#ifdef ANSI`009`009`009/* ANSI function and argument type
X`009`009`009`009   declarations */
Xvoid 
Xcheck(NAMEP);
Xvoid 
Xcirch(void);
Xvoid 
Xdocmd2(NAMEP, LINEP);
Xvoid 
Xdocmds(NAMEP);
Xvoid 
Xdoexp(char **, char *, int *, char *);
Xint 
Xdosh(char *, char *);
Xbool 
Xdyndep(NAMEP);
Xvoid 
Xerror(char *);
Xvoid 
Xexpand(char *);
Xvoid 
Xfatal(char *);
Xchar *
Xgetenv(char *);
Xbool 
Xgetline(char *, FILE *);
Xchar *
Xgetmacro(char *);
XMACROP 
Xgetmp(char *);
Xchar *
Xgettok(char **);
Xchar *
Xindex(char *, char);
Xvoid 
Xinput(FILE *);
Xvoid 
Xmain(int, char **);
Xint 
Xmake(NAMEP, int);
Xvoid 
Xmake1(NAMEP, LINEP, DEPENDP);
Xvoid 
Xmakeinit(void);
Xvoid 
Xmakerules(void);
X
X#ifndef MSC
Xchar *
Xmalloc(int);
X#endif
X
Xvoid 
Xmodtime(NAMEP);
XCMDP 
Xnewcmd(char *, CMDP);
XDEPENDP 
Xnewdep(NAMEP, DEPENDP);
Xvoid 
Xnewline(NAMEP, DEPENDP, CMDP, bool);
XNAMEP 
Xnewname(char *);
Xchar *
Xnewstring(char *, char *);
Xvoid 
Xnewsuffix(char *);
Xvoid 
Xprecious(void);
Xvoid 
Xprt(void);
Xvoid 
Xprtcmd(CMDP, int);
Xvoid 
Xprtdepend(DEPENDP, int);
Xvoid 
Xprtlevel(int);
Xvoid 
Xprtline(LINEP, int);
Xvoid 
Xprtname(NAMEP, int);
Xchar *
Xrindex(char *, char);
XMACROP 
Xsetmacro(char *, char *, bool);
Xvoid 
Xsqueeze(char *);
Xint 
Xstrcm2(char *, char *);
Xchar *
Xsuffix(char *);
Xvoid 
Xtouch(NAMEP);
Xvoid 
Xusage(void);
X
X#else`009`009`009`009/* old-style function declarations */
X
Xvoid check();
Xvoid circh();
Xvoid docmd2();
Xvoid docmds();
Xvoid doexp();
Xint dosh();
Xbool dyndep();
Xvoid error();
Xvoid expand();
Xvoid fatal();
Xchar *getenv();
Xbool getline();
Xchar *getmacro();
XMACROP getmp();
Xchar *gettok();
Xchar *index();
Xvoid input();
Xvoid main();
Xint make();
Xvoid make1();
Xvoid makeinit();
Xvoid makerules();
X
X#ifndef MSC
Xchar *malloc();
X#endif
X
Xvoid modtime();
XCMDP newcmd();
XDEPENDP newdep();
Xvoid newline();
XNAMEP newname();
Xchar *newstring();
Xvoid newsuffix();
Xvoid precious();
Xvoid prt();
Xvoid prtcmd();
Xvoid prtdepend();
Xvoid prtlevel();
Xvoid prtline();
Xvoid prtname();
Xchar *rindex();
XMACROP setmacro();
Xvoid squeeze();
Xint strcm2();
Xchar *suffix();
Xvoid touch();
Xvoid usage();
X#endif
X
X/* Define some convenient shorthands for null typecasts */
X#define NULL_CHARP`009((char *)NULL)
X#define NULL_CMDP`009((CMDP)NULL)
X#define NULL_DEPENDP`009((DEPENDP)NULL)
X#define NULL_FILEP`009((FILE *)NULL)
X#define NULL_LINEP`009((LINEP)NULL)
X#define NULL_MACROP`009((MACROP)NULL)
X#define NULL_NAMEP`009((NAMEP)NULL)
X
X#ifdef CASE_INSENSITIVE
X#define strcmp strcm2`009`009/* host is not case-sensitive */
X#endif
$ GoSub Convert_File
$ File_is="VAXC_SHARE.OPT"
$ Check_Sum_is=1549289361
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
XSYS$LIBRARY:VAXCRTL.EXE/SHARE
$ GoSub Convert_File
$ File_is="VMS_RULES.DOC"
$ Check_Sum_is=809189236
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
XAMSTEX =`009AMSTeX
XAMSTEXFLAGS =`009/batch
XAS =`009`009macro
XCC =`009`009cc
XCFLAGS =`009/debug=(symbols,traceback)/nolist
XFC =`009`009fortran
XFFLAGS =`009/debug=(symbols,traceback)/nolist
XLATEX =`009`009LaTeX
XLATEXFLAGS =`009/batch
XMV =`009`009rename
XPC =`009`009pascal
XPFLAGS =`009/debug=(symbols,traceback)/nolist
XRM =`009`009delete
XSF3 =`009`009sf3
XSLITEX =`009SliTeX
XSLITEXFLAGS =`009/batch
XTEX =`009`009TeX
XTEXFLAGS =`009/batch
XYACC =`009`009yacc
X
X.atx.dvi .amstex.dvi:
X`009$(AMSTEX) $(AMSTEXFLAGS) $<
X.c.obj:
X`009$(CC) $(CFLAGS) $<
X.for.obj .f.obj .ftn.obj:
X`009$(FC) $(FFLAGS) $<
X.ltx.dvi .latex.dvi:
X`009$(LATEX) $(LATEXFLAGS) $<
X.mar.obj:
X`009$(AS) $(AFLAGS) $<
X.pas.obj .p.obj:
X`009$(PC) $(PFLAGS) $<
X.sf3.for:
X`009$(SF3) $(SF3FLAGS) $<
X.stx.dvi .slitex.dvi:
X`009$(SLITEX) $(SLITEXFLAGS) $<
X.tex.dvi:
X`009$(TEX) $(TEXFLAGS) $<
X.y.c:
X`009$(YACC) $(YFLAGS) $<
X`009$(MV) ytab.c $@
X.y.obj:
X`009$(YACC) $(YFLAGS) $<
X`009$(CC) $(CFLAGS) ytab.c
X`009$(RM) ytab.c
X`009$(MV) ytab.obj $@
X
V.SUFFIXES: .exe .obj .dvi .c .y .l .mar .sf3 for .f .ftn .pas .p .tex .latex .l
Xtx .slitex .stx .amstex .atx .inc .h";
$ GoSub Convert_File
$ Exit
-- 
/* 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  */

