# File:   PSAIL.MAK ==> Makefile for creating PSAIL, its runtimes and
#			Documentation.
#
#	  P. Lemkin
#	  Image Processing Section
#	  National Cancer Institute, DCBD, LTB
#	  FCRF, Build 469 Room 150B
#	  Frederick, MD 21701
#
# 		Revised September 6, 1987
# 		Revised February 19, 1987
# 		Revised February 14, 1987
# 		February 6, 1987
#		Version: @V.56.09
#
#
# --	INTRODUCTION
# --	------------
# This Makefile is used to create an PSAIL executable core image,
# runtime library and documentation. It was initially modeled
# after from the C-kermit 'Makefile' called CKUKER.MAK (Version 2.04
# July 31, 1986) but has since acquired a life of its own. However,
# all small systems such as PDP11's (BSD2.9 and PC or PC/XT using
# PC/IX etc) are not included since we need a ^&real machine\& with
# more memory space to run PSAIL. In general, since PSAIL uses vanilla
# C syntax and C library calls, there is is not much that needs to be
# changed between systems.
#
# The 'Makefile' is used to to build the 'psail' compiler and
# 'sairun.o', 'psrung.o' etc. libraries in archive 'libSAIL.o' for UNIX
# and UNIX-like systems.
#
# The toplevel Makefile is renamed from ~/psail/psail.mak.

#
# --	DIRECTORIES in P = . 		(typically P = ~/psail)
# --	---------------------------
# The PSAIL compiler sources are in 		M = P/module
# The PSAIL C source runtime libraries are in	R = P/runtim
# The PSAIL extra files used at runtime are in 	F = P/runfiles
#	    and are moved to			/usr/local/bin
# The PSAIL documentation is in 		D = P/doc
# The PSAIL core image is put into		/usr/local/bin.
#

# --	BUILDING PSAIL
# --	--------------
# Read instructions below before proceeding, then rename this file to
# "makefile" or "Makefile". Then run 'make <keyword>' from the
# following list. Eg. to create a system for BSD4.2, type:
#		 'make bsd'
#
#
# Note that there is also other 'make' operations possible:
#
#	make all		- to make vanilla psail compiler and
#				  runtimes. Actually invoked when do
#				  make for a particular system
#				  (see the table below).
#	make backup             -copy all PSAIL directories to BKUPHOST
#	make cleanup		- to remove all .o files.
#	make dir		- to print all psail directories.
#	make demo		- run PSAIL on 'demo.sai' validation
#				  test suite to test new compiler.
#	make doc		- to generate manuals and other
#				  documentation.
#	make install		- to install the compiler and
# 				  runtimes in the appropriate
#				  directories.
#	make lint		- to run lint on all .c files.
#	make print		- to list all .c and .h files.
#	make saber		- make saber.ld file for debugging
#	make tar		- to create tar file of PSAIL 
#				  directories for distribution.
#
# TABLE OF SYSTEMS FOR WHICH YOU CAN BUILD PSAIL
# ----------------------------------------------
# For System                                        You Type
# ----------                                        --------
# for Amdahl UTS 2.4 on IBM 370 compatibles,        make uts24
# for Amdahl UTS 5.8 on IBM 370 compatibles,        make uts58
# for AT&T 3Bx systems,                             make att3bx
# for AT&T generic System III/V,                    make sys3
# for AT&T generic System III/V w/sep. instr/data,  make sys3nid
# for AT&T UNIX Version 7 (aka 7th Edition),        make v7
# for BBN C/70 with IOS 2.0,                        make c70
# for Berkeley UNIX 4.x,                            make bsd
# for CONVEX running 4.3BSD,                        make convex
# for CRAY XMP's running UNICOS O.S.,               make crayxmp
# for CRAY-2 running UNICOS O.S.,                   make cray2
# for ENCORE running System V,                      make encore
# for Fortune 16:32, For:Pro 1.7,                   make ft17
# for Interactive Sys III on other systems,         make is3
# for MIPS bsd system,         			    make bsd
# for NCR Tower 1632, OS 1.02,                      make tower1
# for NCR Tower 1632 with System V,                 make sys3
# for OPUS Fairchild CLIPPER  system V,             make sys5
# for Pyramid System,             		    make bsd
# for Ridge32 (ROS 3.2)                             make ridge
# for Valid Scaldstar (????),                       make valid
# for Whitechapel MG-1 GENIX 1.3,                   make whitechapel
# for Xenix (i.e Microsoft) (/286, PC/AT, etc),     make xenix
#            . . .                                      . . .
#
#
####################################################################
#
# 	NOTES  (*** need to edit ***)
# 	-----
#
# In many cases, the -O (optimize) compiler switch is omitted. Feel
# free to add it (to your particular system make eg. sys3:) if you
# trust your optimizer.
#
# "make bsd" should produce a working PSAIL for both 4.1 and 4.2bsd
# on VAX, SUN, and Pyramid computers.
#
# Either "make sys3" or "make sys3nid" tends to produce a working
# version on any ATT System III or System V system, including
# Motorola Four Phase, Callan Unistar, Cadmus, NCR Tower,
# HP9836 Series 200, Plexus, Masscomp/RTU, Heurikon, etc etc (for
# exceptions, see below. AT&T 3Bx systems have their own entry).
#
# The "make sys3nid" is equivalent to "make sys3" but leaves out the -i
# option, which is used indicate that separate instruction and data
# (text) spaces are to be used. Some systems don't support this option,
# others may require it. If one of these options doesn't work on your
# System III or System V system, try the other.
#
# As far as PSAIL goes, there is no functional difference between ATT
# System III and System V, so there is no need for a separate 
# "make sys5" entry.
#
# *** IS THE ?? MARKED COMMENTS AND CODE NECESSARY ??? ***
#?? For version 7, several variables must be defined to the values
#?? associated with your system. BOOTNAME=/edition7 is the kernel
#?? image on okstate's Perkin-Elmer 3230. Others will probably be
#?? /UNIX. PROCNAME=proc is the name of the structure assigned to each
#?? process on okstate's system.
#??
#?? This may be "_proc" or some other variation. See <sys/proc.h> for
#?? more info on your systems name conventions. NPROCNAME=nproc is the
#?? name of a kernal variable that tells how many "proc" structures
#?? there are. Again this may be different on your system, but nproc
#?? will probably be somewhere.
#??
#?? The variable NPTYPE is the type of the nproc variable -- int,
#?? short, etc. which can probably be gleaned from <sys/param.h>.
#?? The definition of DIRECT is a little more in depth. If nlist()
#?? returns, for "proc" only, the address of the array, then you should
#?? define DIRECT as it is below. If however, nlist() returns the
#?? address of a pointer to the array, then you should give DIRECT a
#?? null definition (DIRECT=). The extern declaration in <sys/proc.h>
#?? should clarify this for you. If it is "extern struct proc *proc",
#?? then you should NOT define DIRECT. If it is "extern struct proc
#?? proc[]", then you should probably define DIRECT as it is below.
#
#  Other systems may require some special treatment:
# *** CHECK IF STILL TRUE ***
#
# For HP9000 series 500, use "make sys3nid", but
# In <sairun.c>, don't #include <sys/file.h> or ioctl.h.
#
# For Ridge32 (ROS3.2), use "make sys3", but
# Don't #include <sys/file.h> in <sairun.c>
#
# For Altos 986 with Xenix 3.0, use "make sys3", but
# Get rid of any "(void)"'s (they're only there for Lint anyway)
#
#######################################################################
#
# V7-specific variables.
# These are set up for Perkin-Elmer 3230 V7 UNIX:
#
PROC=proc
DIRECT=
NPROC=nproc
NPTYPE=int		# -- may want to set to long -PFL@V.56.02
BOOTFILE=/edition7
#
# ( For TRS-80 Xenix, use PROC=_proc, DIRECT=-DDIRECT, NPROC=_Nproc,
# NPTYPE=short, BOOTFILE=/xenix)
#
####################################################################
#  Compile and Link variables:
####################################################################
CC= cc				# -- name of C compiler
CFLAGS= 			# -- C compiler flags
LIBES= -lc -lm			# -- C library .h header flags
LINTFLAGS= -p			# -- Lint flags
LNKFLAGS=			# -- linker (i.e. ld) flags

#
###################################################################
#  Directory alias variables
###################################################################
P= $$HOME/psail			# -- top level PSAIL directory.
M= $(P)/module			# -- source files for PSAIL compiler.
R= $(P)/runtim			# -- source files for PSAIL runtime lib.
F= $(P)/runfiles		# -- files used by PSAIL at runtime.
D= $(P)/doc			# -- files used to create documentation.
PRUNINSTALL= /usr/local/bin	# -- where install .o runtime libraries
PINSTALL= /usr/local/bin	# -- where install PSAIL compiler;
MANDIR = /usr/man/manl
BKUPDIR = psail/bkup
BKUPHOST = uvip.peter


#
###################################################################
#  File list variables
###################################################################
# --	MODULE files;
# -- PSAIL compiler objects;
OBJPSAIL= $(M)/psglbv.o $(M)/psdbug.o $(M)/psinit.o $(M)/pssymtab.o \
	$(M)/pschek.o $(M)/pscvt.o $(M)/pspprt.o $(M)/psgc.o \
	$(M)/psfsma.o $(M)/psfsmb.o $(M)/psfsmc.o $(M)/psfsmd.o \
	$(M)/psfsme.o $(M)/pslex.o $(M)/psparse.o $(M)/psmain.o 

# -- PSAIL compiler sources;
SRCPSAIL= $(M)/psglbv.c $(M)/psdbug.c $(M)/psinit.c $(M)/pssymtab.c \
	$(M)/pschek.c $(M)/pscvt.c $(M)/pspprt.c $(M)/psgc.c \
	$(M)/psfsma.c $(M)/psfsmb.c $(M)/psfsmc.c $(M)/psfsmd.c \
	$(M)/psfsme.c $(M)/pslex.c $(M)/psparse.c $(M)/psmain.c

# -- PSAIL compiler .h's and secondary .h's;
HDRPSAIL= $(M)/psparam.h $(M)/psmacro.h $(M)/psrglb.h 
HDR2PSAIL= $(M)/psglbv.h $(M)/psdbug.h $(M)/psinit.h $(M)/pssymtab.h \
	$(M)/pschek.h $(M)/pscvt.h $(M)/pspprt.h $(M)/psgc.h \
	$(M)/psfsma.h $(M)/psfsmb.h $(M)/psfsmc.h $(M)/psfsmd.h \
	$(M)/psfsme.h $(M)/pslex.h $(M)/psparse.h

# -- RUNTIME files;
# -- runtime objects;
OBJSAIRUN= $(R)psrglb.o $(R)psrun1.o $(R)psrun2.o $(R)psrun3.o \
	$(R)psrun4.o $(R)psrun5.o $(R)psrun6.o $(R)psrun7.o \
	$(R)psrun8.o $(R)psrun9.o

# -- runtime sources;
SRCSAIRUN= $(R)psrglb.c $(R)psrun1.c $(R)psrun2.c $(R)psrun3.c \
	$(R)psrun4.c $(R)psrun5.c $(R)psrun6.c $(R)psrun7.c \
	$(R)psrun8.c $(R)psrun9.c

# -- common SAIRUN runtime .h's;
HDRSAIRUN= config.h confg2.h $(R)psrdef.h $(R)psrglb.h sairun.h \
	$(R)psrung.h

# -- 2ndary runtime .h's;
HDR2SAIRUN= $(R)psrglb.h $(R)psrun1.h $(R)psrun2.h $(R)psrun3.h \
	$(R)psrun4.h $(R)psrun5.h $(R)psrun6.h $(R)psrun7.h \
	$(R)psrun8.h $(R)psrun9.h

# -- FILES USED BY PSAIL AT RUNTIME;
PRUNFILES= $(F)/*.txt$ $(F)/*.tgf$ $(F)/*.ini$ $(F)/*.map$ $(F)/*.cod

# -- FILES USED TO CONSTRUCT PSAIL DOCUMENTATION;
TEXSRC = intro.tex \					# -- chapter 1 
	runp.tex wordfq.sai wordfq.c psuser.prp \
	psref.prp \		 			# -- chapter 2 
	runtim.tex \					# -- chapter 3 
	mapc.tex \					# -- chapter 4 
	portcd.tex \					# -- chapter 5 
	ptleap.tex \					# -- chapter 6 
	dbfcts.tex \					# -- chapter 7
	demo.tex demo.sai demo1.sai demo2.req demo3.sai \
	demo4.sai demo5.req demo6.sai demo6.req demo.c\	# -- Appendix A
	errmsg.tex \					# -- Appendix B
	install.tex \					# -- Appendix C
	buglist.tex sail.err \				# -- Appendix D
	symtab.tex \					# -- Appendix E
	prcevt.tex \					# -- Appendix F
	records.tex \					# -- Appendix G
	typeck.tex \					# -- Appendix H
	lspext.tex \					# -- Appendix I
	modules.tex \					# -- Appendix J
	keywords.tex \					# -- Appendix K
	hfiles.tex \					# -- Appendix L
	l4emul.tex					# -- Appendix M



PDOCFILES= $(D)/*.prp $(D)/$(TEXSRC)

#
#
####################################################################
#
# Dependencies Section:
#
####################################################################
make:
	@echo 'Make what?  You are making PSAIL for which system?'


# --	[ALL] Build the WHOLE ENCHELADA...;
all: psail sairun psrung psrunl psrunp psrunw psrunx
	# -- [1] PSAIL compiler itself;
	# -- [2] basic PSAIL runtime support;
	# -- [3] PSAIL STRING Garbage Collector;
	# -- [4] Optional PSAIL LEAP runtime package;
	# -- [5] Optional PSAIL PROCESSES runtime pkg;
	# -- [6] Optional PSAIL PROFILE runtime pkg;
	# -- [7] Optional PSAIL Extn'd MATH runtim pkg;


# -- 	[1] PSAIL compiler itself;
psail:	$(OBJPSAIL)				# -- *.o files;
	$(CC) $(LIBES) $(LNKFLAGS) -o $(M)/psail ($OBJPSAIL)

$(OBJPSAIL):	$(HDRPSAIL)	# -- primary .h files;

psglbv.h: $(M)/psparam.h $(M)/psmacro.h $(M)/psglbv.c

psglbv.o: $(HDRPSAIL) $(M)/psglbv.c

psdbug.o: $(HDRPSAIL) $(M)/pscvt.h $(M)/pspprt.h $(M)/pschek.h \
	$(M)/psinit.h $(M)/psdbug.c

psinit.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/pssymtab.h $(M)/pscvt.h \
	$(M)/pschek.h $(M)/pslex.h $(M)/psparse.h $(M)/psinit.c

pssymtab.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/pscvt.h $(M)/pschek.h \
	$(M)/pslex.h $(M)/psparse.h $(M)/pssymtab.c

pschek.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/pssymtab.h $(M)/pscvt.h \
	$(M)/psfsme.h $(M)/pslex.h $(M)/psparse.h $(M)/pschek.c

pscvt.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/pssymtab.h $(M)/pschek.h \
	$(M)/pslex.h $(M)/psparse.h $(M)/pscvt.c

pspprt.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/pschek.h $(M)/pslex.h \
	$(M)/pspprt.c

psgc.o: $(HDRPSAIL) $(M)/psinit.h $(M)/psdbug.h $(M)/pssymtab.h \
	$(M)/pscvt.h $(M)/psprt.h $(M)/pschek.h $(M)/pslex.h
	$(M)/psgc.c

psfsma.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/psgc.h $(M)/pssymtab.h \
	$(M)/pscvt.h $(M)/psprt.h $(M)/pschek.h $(M)/psfsmb.h \
	$(M)/psfsmc.h $(M)/psfsmd.h $(M)/psfsme.h $(M)/pslex.h \
	$(M)/psparse.h $(M)/psfsma.c

psfsmb.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/psgc.h $(M)/pssymtab.h \
	$(M)/pscvt.h $(M)/pschek.h $(M)/psfsma.h $(M)/psfsmc.h \
	$(M)/psfsmd.h $(M)/psfsme.h $(M)/pslex.h $(M)/psparse.h \
	$(M)/psfsmb.c

psfsmc.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/psgc.h $(M)/pssymtab.h \
	$(M)/pscvt.h $(M)/pschek.h $(M)/psfsma.h $(M)/psfsmb.h \
	$(M)/psfsmd.h $(M)/psfsme.h $(M)/pslex.h $(M)/psparse.h \
	$(M)/psfsmc.c

psfsmd.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/psgc.h $(M)/pssymtab.h \
	$(M)/pscvt.h $(M)/pschek.hpsfsma.h $(M)/psfsmb.h \
	$(M)/psfsmc.h $(M)/psfsme.h $(M)/pslex.h $(M)/psparse.h \
	$(M)/psfsmd.c

psfsme.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/psgc.h $(M)/pssymtab.h \
	$(M)/pscvt.h $(M)/pschek.hpsfsma.h $(M)/psfsmb.h \
	$(M)/psfsmc.h $(M)/pslex.h $(M)/psparse.h $(M)/psfsme.c

pslex.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/pssymtab.h $(M)/pscvt.h \
	$(M)/pschek.h $(M)/psfsma.h $(M)/psparse.h $(M)/pslex.c

psparse.o: $(HDRPSAIL) $(M)/psdbug.h $(M)/psgc.h $(M)/pssymtab.h \
	$(M)/pscvt.h $(M)/psprt.h $(M)/pschek.h $(M)/psfsma.h
	$(M)/psfsmb.h $(M)/psfsmc.h $(M)/psfsmd.h $(M)/psfsme.h \
	$(M)/psparse.c

psmain.o: $(HDRPSAIL) $(HDR2PSAIL) $(M)/psmain.c


# --	[2] <sairun> PSAIL runtime emulation library;
sairun:	$(OBJSAIRUN)		# *.o files;
	$(CC) $(LIBES) $(LNKFLAGS) -c ($R)/sairun.c

$(OBJSAIRUN):	$(HDRSAIRUN)	# -- primary .h files;

sairun.h:	config.h     # -- also if sairun.c changed functionally
sairun.o: $(HDRSAIRUN) $(HDR2SAIRUN) $(R)/sairun.c


# --	[3] <psrunG> PSAIL String Garbage Collector runtime library
psrung:	psrung.o
	$(CC) $(LIBES) $(LNKFLAGS) -c $(R)/psrung.c

psrung.o: $(HDRSAIRUN) $(R)/psrung.c


# --	[4] <psrunL> PSAIL LEAP associative language runtime library
psrunl:	psrunl.o
	$(CC) $(LIBES) $(LNKFLAGS) -c $(R)/psrunl.c

psrunl.o:  $(HDRSAIRUN) $(R)/psrunl.c


# --	[5] <psrunP> PSAIL PROCESSES, EVENTS and INTERRUPTS runtime
# --	library;
psrunp: psrunp.o
	$(CC) $(LIBES) $(LNKFLAGS) -c $(R)/psrunp.c

psrunp.o:  $(HDRSAIRUN) $(R)/psrunp.c


# --	[6] <psrunW> PSAIL profiling runtime library
psrunw: psrunw.o
	$(CC) $(LIBES) $(LNKFLAGS) -c $(R)/psrunw.c

psrunw.o: $(HDRSAIRUN) $(R)/psrunw.c


# --	[7] <psrunX> PSAIL extended math runtime library
psrunx: psrunx.o
	$(CC) $(LIBES) $(LNKFLAGS) -c $(R)/psrunx.c

psrunx.o: $(HDRSAIRUN) $(R)/psrunx.c



# --    [BACKUP] backup $HOME/psail to BKUP host system.
backup:
	cd $(P); \
	rcp -r $(P) $(BKUPHOST):$(BKUPDIR)
	echo "Finished Backup of $(P) to $(BKUPHOST):$(BKUPDIR)"


# --	[CLEANUP] Cleanup all .o files and other trash;
cleanup:
	rm $(OBJPSAIL); \
	rm $(OBJSAIRUN); \
	rm $(M)/psail; \
	rm $(P)/psail.lint; \
	rm $(P)/psail.lst; \
	echo "Finished CLEANUP of $(P)"




# --	[DEMO] Run PSAIL on the DEMO.SAI validation test suite;
demo:  psail
	psail -nocheck -countFSM -extensions -noCondEval $(P)/demo.sai; \
	diff $(P)/demo.c $(P)/demo.std > $(P)/demo.dif
# -- NOTE: there WILL BE some differences primiarily the date
# -- in the COMPILER!BANNER expansions. But that is all.



# --	[DIR] print directories of all psail subdirectories;
dir:
	ls -lF $(P); \	# -- main directory
	ls -lF $(M); \	# -- PSAIL compiler modules
	ls -lF $(R); \	# -- runtime sources
	ls -lF $(F); \	# -- run time files needed by PSAIL
	ls -lF $(D)	# -- documentation


# --	[DOC] Compile, using TEX, the PSAIL documentation and
# --	reference manuals;
doc: psuser.tex psref.tex
# -- NOTE: @V.56.03 add ABOVE DEPENDENCIES when preprno+mknroff are
# --       working;
	tex $(D)/psuser.tex > $(D)/psuser.doc; \
	tex $(D)/psref.tex > $(D)/psref.doc

# -- NOTE: when get preptex (map *.texsrc to .NEW) file then do it here.
# -- the $(TEXSRC) are the TeX equivalents of the current RUNOFF .RNO files.
psuser:  $(TEXSRC)
	preptex $(D)/psuser.prp > $(D)/psuser.tex
psref.tex: $(TEXSRC)
	preptex $(D)/psref.prp > $(D)/psref.tex




# --	[INSTALL] Install the PSAIL compiler in $(PINSTALL) and
# --	runtimes in $(PRUNINSTALL) directories.
# --	Also create the PSAIL runtime library archeive libSAIL.o;
install: psail $(OBJSAIRUN)
	cp $(M)/psail $(PINSTALL); \		# -- executable PSAIL
	chmod 755 $(PINSTALL)/psail; \
	cp $(PRUNFILES) $(PINSTALL); \		# -- auxillary run files
	ar pc libSAIL.o $(OBJSAIRUN); \		# -- create PSAIL library
	cp $(R)/libSAIL.o $(PRUNINSTALL); \
	chmod 755 $(PRUNINSTALL)/libSAIL.o


# --	[LINT] Lint all of the files in both /module and /runtim;
lint:
	cp /dev/null $(P)/psail.lint; \
	lint $(LINTFLAGS) $(M)/$(SRCPSAIL) >> $(P)/psail.lint; \
	lint $(LINTFLAGS) $(R)/$(SRCSAIRUN) >> $(P)/psail.lint; \
	lint $(LINTFLAGS) $(R)/psrung.c >> $(P)/psail.lint; \
	lint $(LINTFLAGS) $(R)/psrunl.c >> $(P)/psail.lint; \
	lint $(LINTFLAGS) $(R)/psrunp.c >> $(P)/psail.lint; \
	lint $(LINTFLAGS) $(R)/psrunw.c >> $(P)/psail.lint; \
	lint $(LINTFLAGS) $(R)/psrunx.c >> $(P)/psail.lint


# --	[PRINT] Print all .c and .h files in both /module and /runtim
# --	into file $(P)/psail.lst;
print:
	cp /dev/null $(P)/psail.lst
	for x ($(M)/*.h $(M)/*.c); \
		cat -n $x | pr -f -h $x >> $(P)/psail.lst; \
	done; \
	for x ($(R)/*.h $(R)/*.c); \
		cat -n $x | pr -f -h $x >> $(P)/psail.lst; \
	done; \
	for x ($(F)/*); \
		cat -n $x | pr -f -h $x >> $P)/psail.lst; \
	done


# --	[SABER] create a 'saber.ld' file for debugging with the
#	Saber C debugger (for Vaxes and SUNS).
#	The saber.ld is then loaded into Saber-C C debugger using
#	      #include "saber.ld"    C statement.
# 	NOTE: it is setup for debugging the <sairun.c> etc
#	runtime package. You might want to make another one
#	for debugging the PSAIL compiler proper.
#
saber.ld: $(SRCSAIRUN) $(HDRSAIRUN) $(HDR2SAIRUN)
saber:  saber.ld
	rm -rf saber.ld
	echo "setopt(\"load_options\", \"$(CFLAGS)\");" > saber.ld
	echo "load( \"$(SRCSAIRUN)\" ); " >> saber.ld
	echo "load( \"$(HDRSAIRUN)\" ); " >> saber.ld
	echo "load( \"$(HDR2SAIRUN)\" ); " >> saber.ld
	echo "load( \"$(LIBES)\" ); " >> saber.ld
	echo "load( \"$(PSAILRLIB)\" ); " >> saber.ld
	echo "load( \"-lc\" ); " >> saber.ld
	echo "Script 'saber.ld' for Saber-C is finished."



# --	[TAR] Make TAR file of all EXPORT PSAIL FILES;
tar:	cleanup
	rm ~/psail.tar; \
	tar cvf ~/psail.tar .




####################################################################
#
# Make commands for specific systems:
#
####################################################################

# --	Only difference from sys3 is lock file stuff...;
att3bx:
	make all "CFLAGS = -DUXIII -DATT3BX -DDEBUG -DTLOG -i -O" \
		"LNKFLAGS = -i"


# --	Berkeley UNIX 4.1 or 4.2 (and presumably also 4.3);
bsd:
	make all "CFLAGS= -DBSD4 -DDEBUG -DTLOG"


# --	Convex is 4.3BSD;
convex:
	make bsd


# --	CRAY XMP processors with UNICOS (System/V) operating system;
# --	Mostly System-V but with some differences;
crayxmp:
	make sys5

# --	CRAY-2 processor with UNICOS (System/V) operating system;
# --	Mostly System-V but with some differences;
cray2:
	make sys5


# --	BBN C/70 with IOS 2.0;
# --	Mostly Berkeley-like, but with some ATTisms;
c70:
	make all "CFLAGS= -DBSD4 -DC70 -DDEBUG -DTLOG"


# --	ENCORE with SYSTEM-V;
encore:	
	make sys5


# --	Fortune 16:32, For:Pro 1.7 (mostly like 4.1BSD);
ft17:
	make all "CFLAGS= -DDEBUG -DTLOG -DBSD4 -DFT17"


# --	Interactive Corp System III port in general (large systems
# --	only);
is3:
	make all "CFLAGS = -DISIII -DUXIII -DDEBUG -DTLOG \
		-Ddata=datax -O -i" "LNKFLAGS = -i"


# --	Ridge32 using ROS 3.2 is sys3 with some changes;
ridge:
	make all "CLFAGS=-DUXIII -i -O" "LNKFLAGS= -i"


# --	Generic ATT System III or System V (with I&D space);
sys3:
	make all "CFLAGS = -DUXIII -DDEBUG -DTLOG -i -O" \
		 "LNKFLAGS = -i"


# --	Generic ATT System III or System V (no I&D space);
sys3nid:
	make all "CFLAGS = -DUXIII -DDEBUG -DTLOG -O" "LNKFLAGS ="


# --	In case they type "make sys5"...;
sys5:
	make sys3


# --	NCR Tower 1632, OS 1.02;
tower1:
	make all "CFLAGS= -DDEBUG -DTLOG -DTOWER1"


# --	Amdahl UTS 2.4 on IBM 370 series compatible mainframes.
# --	Mostly like V7, but can't do initrawq() buffer peeking;
uts24:
	make all "CFLAGS=-DV7 -DDEBUG -DTLOG \
		-DPROCNAME=\\\"$(PROC)\\\" \
		-DUTS24 -DBOOTNAME=\\\"$(BOOTFILE)\\\" \
		-DNPROCNAME=\\\"$(NPROC)\\\" \
		-DNPTYPE=$(NPTYPE) $(DIRECT)"


# --	Amdahl UTS 5.8 on IBM 370 series compatible mainframes;
# --	Mostly like SYSTEM-V.3;
uts58:
	make sys5


# --	Valid Scaldstar.
# --	Berkeleyish, but need to change some variable names;
valid:
	make all "CFLAGS= -DBSD4 -Dcc=ccx -DFREAD=1"

# --	AT&T 3B-series computers running System V;
# --	Version 7 UNIX - large systems (can not build for PDP11 class
# --	systems);
v7:
	make all "CFLAGS=-DV7 -DDEBUG -DTLOG \
		-DPROCNAME=\\\"$(PROC)\\\" \
		-DBOOTNAME=\\\"$(BOOTFILE)\\\" \
		-DNPROCNAME=\\\"$(NPROC)\\\" \
		-DNPTYPE=$(NPTYPE) $(DIRECT)"


# --	Whitechapel MG-1 GENIX 1.3;
whitechapel:
	make bsd


# --	Microsoft "Xenix/286" e.g. for IBM PC/AT;
xenix:
	make all "CFLAGS= -DXENIX -DUXIII -DDEBUG -DTLOG \
		-F 3000 -i" "LNKFLAGS = -F 3000 -i"



########################################################
# --	LIST OF AND SEMANTICS OF 'CFLAGS' -D FLAGS
########################################################
# --		-DATT3BX			= UNIX ATT3B.x
# --		-DBSD4				= BSD4.x system
# --		-DC70				= BBN C/70 UNIX
# --		-DFT17				= Fortune UNIX
# --		-DISIII				= UNIX I.S. version III
# --		-DTOWER1			= NCR TOWER UNIX
# --		-DUTS24				= AMDAHL UTS UNIX
# --		-DUXIII				= UNIX Version III
# --		-DV7				= UNIX Version 7
# --		-DXENIX				= XENIX
# --		-DDEBUG				= KERMIT debugging
# -- 		-DTLOG				= ???
# --		-DPROCNAME=\\\"$(PROC)\\\" 	= ???
# --		-DBOOTNAME=\\\"$(BOOTFILE)\\\" 	= ???
# --		-DNPROCNAME=\\\"$(NPROC)\\\" 	= ???
# --		-DNPTYPE=$(NPTYPE) $(DIRECT)"	= ???
#
# --	 ---> END OF PSAIL.MAK < ---
