159243Sobrien#
259243Sobrien# C Shell with process control; VM/UNIX VAX Makefile
359243Sobrien# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
459243Sobrien#
559243Sobrien# With an input editor, command completion, etc. and ported to all sorts of
659243Sobrien# things; Paul Placeway, CIS Dept., Ohio State University
759243Sobrien#
859243SobrienSHELL=/bin/sh
9100616SmpVERSION=6.12
1059243SobrienBUILD=tcsh
1159243Sobrien
1259243Sobrien################################################################
1359243Sobrien## CFLAGS.  For various -D things, see config.h
1459243Sobrien################################################################
1559243Sobrien#
1659243Sobrien# These are the default suffixes from .c to .o and -c to get there
1759243Sobrien# but to use the global optimizer on the mips boxes, see below
1859243Sobrien#
1959243SobrienSUF=o
2059243SobrienCF=-c
2159243Sobrien
2259243SobrienINCLUDES=-I. -I..
2359243Sobrien
2459243SobrienLFLAGS=$(INCLUDES)
2559243Sobrien#LFLAGS=$(INCLUDES) -Zn10000		# hpux lint
2659243Sobrien
2759243Sobrien
2859243Sobrien#CFLAGS= $(INCLUDES) -g			# debug
2959243Sobrien#CFLAGS= $(INCLUDES) -O			# production
3059243Sobrien#CFLAGS= $(INCLUDES) 			# Broken optimizers....
3159243Sobrien
3259243Sobrien#CFLAGS= -g -pg $(INCLUDES) -DPROF
3359243Sobrien#CFLAGS= -O -pg $(INCLUDES) -DPROF
3459243Sobrien
3559243Sobrien# gcc 1.00-1.37
3659243Sobrien#CFLAGS=-O $(INCLUDES) -finline-functions -fstrength-reduce 
3759243Sobrien
3859243Sobrien# gcc 1.37-1.40
3959243Sobrien#CFLAGS=-O $(INCLUDES) -fcombine-regs -finline-functions -fstrength-reduce 
4059243Sobrien# add -msoft-float for 68881 machines.
4159243Sobrien
4259243Sobrien# gcc 2.0
4359243Sobrien# On the sparc, don't use -O2; it breaks setjmp() and vfork()
4459243Sobrien#CFLAGS=-O $(INCLUDES)
4559243Sobrien
4659243Sobrien# gcc-2.1+
4759243Sobrien#CFLAGS=-O2 $(INCLUDES)
4859243Sobrien
4959243Sobrien# lucid c on suns
5059243Sobrien#CFLAGS=-O5 $(INCLUDES)
5159243Sobrien
5259243Sobrien# gcc 2.1 on linux
5359243Sobrien#CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES)
5459243Sobrien
5559243Sobrien# HP/UX 8.0, 9.0
5659243Sobrien#CFLAGS= $(INCLUDES) +O3 -Aa
5759243Sobrien
5859243Sobrien# Ultrix 4.2a
5959243Sobrien#CFLAGS= $(INCLUDES) -O -Olimit 2000
6059243Sobrien
6159243Sobrien# Intel Paragon OSF/1 with PGI compilers
6259243Sobrien#CFLAGS=-O -Mnodebug -Mnoperfmon $(INCLUDES)
6359243Sobrien
6459243Sobrien# DEC Alpha OSF/1
6559243Sobrien#CFLAGS= -O2 $(INCLUDES) -Olimit 2000	## Normal Optimization
6659243Sobrien#CFLAGS= -O3 $(INCLUDES) -Olimit 2000	## Full Optimization - may not work
6759243Sobrien#CF=-j
6859243Sobrien#SUF=u
6959243Sobrien#.SUFFIXES: .u
7059243Sobrien
7159243Sobrien# for silicon graphics (and other mips compilers) -- use the
7259243Sobrien# global optimizer! (-O3).
7359243Sobrien# On SGI 4.0+ you need to add -D__STDC__ too.
7459243Sobrien#CFLAGS= -O3 $(INCLUDES) 
7559243Sobrien#CFLAGS= -O3 $(INCLUDES) -Olimit 2000	## Ultrix 4.2a
7659243Sobrien#CF=-j
7759243Sobrien#SUF=u
7859243Sobrien#.SUFFIXES: .u 				## Ultrix and gnu-make need that
7959243Sobrien
8059243Sobrien# mips systems
8159243Sobrien# CFLAGS= $(INCLUDES) -O -systype bsd43 -Wf,-XNd5000 -Wf,-XNp6000 -Olimit 2000
8259243Sobrien
8359243Sobrien# for at&t machines
8459243Sobrien#CFLAGS= -O -Ksd $(INCLUDES)
8559243Sobrien
8659243Sobrien# Stardent Titan
8759243Sobrien#CFLAGS = $(INCLUDES) -O -43
8859243Sobrien
8959243Sobrien# Stardent Stellar or sunos4 /bin/cc or Solaris2.1 /opt/SUNWspro/bin/cc
9059243Sobrien#CFLAGS = $(INCLUDES) -O4
9159243Sobrien
9259243Sobrien# Intergraph clipper CLIX 3.1
9359243Sobrien#CFLAGS= -w -O2 $(INCLUDES)
9459243Sobrien
9559243Sobrien# Dnix 5.3
9659243Sobrien#CFLAGS = -O -X7
9759243Sobrien
9859243Sobrien# Pyramid OS/x
9959243Sobrien#CFLAGS = -OG
10059243Sobrien
10159243Sobrien# Multiflow (5M binary... if you choose -O5!)
10259243Sobrien#CFLAGS = -O5 -sb_trace 0
10359243Sobrien
10459243Sobrien# DDE Supermax Unix SYSV Rel III.
10559243Sobrien# CFLAGS= -O3
10659243Sobrien
10759243Sobrien# Apollo's with cc [apollo builtins don't work with gcc]
10859243Sobrien# and apollo should not define __STDC__ if it does not have
10959243Sobrien# the standard header files. RT's (aos4.3) need that too;
11059243Sobrien# you might want to skip the -O on the rt's... Not very wise.
11159243Sobrien# AIX/ESA needs -D_IBMESA on command line (this may disappear by GA)
11259243Sobrien#DFLAGS=-U__STDC__ 
11359243Sobrien#DFLAGS=-D_IBMESA
11459243Sobrien# On aix2.2.1 we need more compiler space.
11559243Sobrien#DFLAGS=-Nd4000 -Nn3000
11659243Sobrien# AU/X 2.0 needs a flag for POSIX (read the config file)
11759243Sobrien#DFLAGS=-Zp
11859243Sobrien# Tektronix 4300 running UTek 4.0 (BSD 4.2) needs:
11959243Sobrien#DFLAGS = -DUTek -DBSD
12059243Sobrien# VMS_POSIX needs:
12159243Sobrien#DFLAGS=-D_VMS_POSIX
12259243Sobrien# Multiflow
12359243Sobrien#DFLAGS=-DMULTIFLOW
12459243Sobrien# DELL SVR4
12559243Sobrien#DFLAGS=-DDELL
12659243SobrienDFLAGS=
12759243Sobrien#DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"'
12859243Sobrien
12959243Sobrien
13059243Sobrien################################################################
13159243Sobrien## LDFLAGS.  Define something here if you need to
13259243Sobrien################################################################
13359243SobrienLDFLAGS= 			## The simplest, suitable for all.
13459243Sobrien#LDFLAGS= -s			## Stripped. Takes less space on disk.
13559243Sobrien#LDFLAGS= -s -n			## Pure executable. Spares paging over
13659243Sobrien# 				## the network for machines with local
13759243Sobrien#				## swap but external /usr/local/bin .
13859243Sobrien#LDFLAGS= -s -n -Bstatic	## Without dynamic links. (SunOS)
13959243Sobrien#LDFLAGS= -Wl,-s,-n		## Stripped, shared text (Unicos)
14059243Sobrien#LDFLAGS= -s -static		## Link statically. (linux)
14159243Sobrien#LDFLAGS= -s -N			## Impure executable (linux)
14259243Sobrien
14359243Sobrien################################################################
14459243Sobrien## LIBES.  Pick one, or roll your own.
14559243Sobrien################################################################
14659243Sobrien#LIBES= -ltermcap 			 ## BSD style things
14759243Sobrien#LIBES= -ltermcap			 ## SunOS, HP-UX, pyramid
14859243Sobrien#LIBES= -ltermcap			 ## Linux
14959243Sobrien#LIBES= -ltermcap -lshadow		 ## Linux with PW_SHADOW
15059243Sobrien#LIBES= -ltermcap -lsec			 ## Tek XD88/10 (UTekV) with PW_SHADOW
15159243Sobrien#LIBES= -ltermcap -lsec			 ## Motorola MPC (sysV88) with PW_SHADOW
15259243Sobrien#LIBES= -ltermcap -lcs			 ## Mach
15359243Sobrien#LIBES= -ltermcap -lbsd			 ## DEC osf1 on the alpha
15459243Sobrien#LIBES= -ltermcap -lbsd			 ## Intel paragon
15559243Sobrien#LIBES= -ltermcap -lbsd			 ## Clipper intergraph
15659243Sobrien#LIBES= -ltermcap -lseq			 ## Sequent's Dynix
15759243Sobrien#LIBES= -ltermcap -lauth		 ## Ultrix with Enhanced Security
15859243Sobrien#LIBES= -ltermcap -ldir -lx		 ## Xenix 386 style things
15959243Sobrien#LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
16059243Sobrien#LIBES= -lcurses			 ## AIX on the rt
16159243Sobrien#LIBES= -lcurses			 ## TitanOS on the stellar
16259243Sobrien#LIBES= -ltermlib -lsocket -lnsl	 ## SysV4 w/o BSDTIMES or Solaris 2
16359243Sobrien#LIBES= -lcurses			 ## SysV3 w/o networking
16459243Sobrien#LIBES= -lcurses -lnet			 ## SysV3 with networking
16559243Sobrien#LIBES= -lcurses -ldir			 ## SysV2 w/o networking & dirlib
16659243Sobrien#LIBES= -lcurses -ldir -lnet		 ## SysV2 with networking & dirlib
16759243Sobrien#LIBES= -lcurses -lbsd			 ## AIX on the IBM 370 or rs6000 or ps2
16859243Sobrien#LIBES= -lcurses -lbsd			 ## ETA10
16959243Sobrien#LIBES= -lcurses -lbsd			 ## Irix3.1 on the SGI-IRIS4D
17059243Sobrien#LIBES= -lcurses -lbsd -lc_s		 ## Irix3.3 on the SGI-IRIS4D w/o yp
17159243Sobrien#LIBES= -lcurses -lsun -lbsd -lc_s	 ## Irix3.3 on the SGI-IRIS4D with yp
17259243Sobrien#LIBES= -lcurses -lsocket -lbsd		 ## Amdahl UTS 2.1
17359243Sobrien#LIBES= -lcurses -lsocket		 ## Intel's hypercube.
17459243Sobrien#LIBES= -lcurses -lsocket		 ## ns32000 based Opus.
17559243Sobrien#LIBES= -lcurses -lcposix		 ## ISC 2.2 without networking
17659243Sobrien#LIBES= -lcposix -lc_s -lcurses -linet	 ## ISC 2.2 with networking
17759243Sobrien#LIBES= -lcurses -lsec -lc_s		 ## ISC 2.0.2 without networking
17859243Sobrien#LIBES= -lcurses -linet -lsec -lc_s	 ## ISC 2.0.2 with networking
17959243Sobrien#LIBES= -lcurses -lintl -lcrypt		 ## SCO SysVR3.2v2.0
18059243Sobrien#LIBES= -lcurses -lintl -lsocket -lcrypt ## SCO+ODT1.1
18159243Sobrien#LIBES= -lposix -ltermcap		 ## A/UX 2.0
18259243Sobrien#LIBES= -lposix -ltermcap -lc_s		 ## A/UX 3.0
18359243Sobrien#LIBES= -ldirent -lcurses		 ## att3b1 cc w/o shared lib & dirlib
18459243Sobrien#LIBES= -shlib -ldirent -lcurses	 ## att3b1 gcc with shared lib & dirlib
18559243Sobrien#LIBES= -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a ## SysV4 with BSDTIMES
18659243Sobrien#LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
18759243Sobrien#LIBES= -ltermc				 ## emx under OS/2
18859243SobrienLIBES=					 ## Minix, VMS_POSIX
18959243Sobrien#LIBES= -ltermcap -lcrypt		 ## Multiflow
19059243Sobrien#LIBES= -ltermcap -lcrypt		 ## NetBSD
19159243Sobrien#LIBES= -lcurses 			 ## DDE Supermax
19259243Sobrien
19359243Sobrien################################################################
19459243Sobrien## EXTRAFLAGS and EXTRALIBS
19559243Sobrien################################################################
19659243Sobrien# Compiling for HESIOD
19759243Sobrien#HESDEF = -DHESIOD -I/usr/athena/include
19859243Sobrien#HESLIB = -L/usr/athena/lib -lhesiod
19959243Sobrien#
20059243Sobrien# Compiling for AFS with kerberos authentication
20159243Sobrien#AFSLIBDIR = /usr/afsws/lib
20259243Sobrien#AFSDEF = -DAFS -I/usr/afsws/include
20359243Sobrien#AFS33LIB = -laudit
20459243Sobrien#
20559243Sobrien#Solaris and HPUX require the BSD libraries with AFS.
20659243Sobrien#We use -lc to use only what we require.
20759243Sobrien#AFSAUXLIB = -lsocket -lnsl -lc -lucb                    # Solaris
20859243Sobrien#AFSAUXLIB = -lc -lBSD                                   # HPUX   
20959243Sobrien#
21059243Sobrien#AFSLIB = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik\
21159243Sobrien#         -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\
21259243Sobrien#         $(AFSLIBDIR)/afs/util.a $(AFS33LIB) $(AFSAUXLIB)
21359243Sobrien#
21459243Sobrien
21559243SobrienEXTRAFLAGS = $(HESDEF) $(AFSDEF)
21659243SobrienEXTRALIBS = $(HESLIB) $(AFSLIB)
21759243Sobrien
21859243Sobrien
21959243Sobrien# The difficult choice of a c-compiler...
22059243Sobrien# First, you should try your own c-compiler. 
22159243Sobrien# Gcc -traditional is also a safe choice. 
22259243Sobrien# If you think that you have good include files try gcc -Wall...
22359243Sobrien# If you want to take out -traditional, make sure that your sys/ioctl.h
22459243Sobrien# is fixed correctly, otherwise you'll be stopped for tty input, or you
22559243Sobrien# will lose the editor and job control.
22659243Sobrien
22759243Sobrien# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
22859243Sobrien# on the suns does not know how to make dynamically linked binaries.
22959243Sobrien#CC=	gcc -Wall -pipe -B/bin/	# -ansi -pedantic
23059243Sobrien#CC=	gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux)
23159243Sobrien#CC=	cc
23259243Sobrien#CC=	occ
23359243Sobrien#CC=	acc
23459243Sobrien#CC=	pcc
23559243Sobrien#CC=	hc -w
23659243SobrienCC=	c89	# For VMS/POSIX
23759243Sobrien#CC=	/bin/cc	# For suns, w/o gcc and SVR4
23859243Sobrien#CC=	/usr/lib/sun.compile/cc  # FPS 500 (+FPX) with Sun C compiler
23959243Sobrien#CC=	/opt/SUNWspro/bin/cc	# Solaris 2.1
24059243Sobrien#CC=	scc 	# Alliant fx2800
24159243Sobrien#CC=	lcc	-wa 
24259243SobrienED=	ed
24359243SobrienAS=	as
24459243SobrienRM=	rm
24559243SobrienCXREF=	/usr/ucb/cxref
24659243SobrienVGRIND=	csh /usr/ucb/vgrind
24759243SobrienCTAGS=	/usr/ucb/ctags
24859243Sobrien#XSTR= /usr/ucb/xstr
24959243SobrienSCCS=	/usr/local/sccs
25059243SobrienPARALLEL=12				# Make the multi-max run fast.
25159243Sobrien#P=&					# Use Sequent's parallel make
25259243SobrienP=
25359243SobrienDESTDIR=/usr/local
25459243SobrienMANSECT=1
25559243SobrienDESTBIN=${DESTDIR}/bin
25659243SobrienDESTMAN=${DESTDIR}/man/man${MANSECT}
25759243Sobrien# DESTMAN=${DESTDIR}/catman/man${MANSECT}	 # A/UX
25859243Sobrien# DESTMAN=${DESTDIR}/usr/share/man/man${MANSECT} # Stardent Vistra (SysVR4)
25959243Sobrien# DESTMAN=/usr/catman/1l			 # Amiga unix (SysVR4)
26059243SobrienFTPAREA=/usr/spool/ftp
26159243Sobrien
26259243SobrienASSRCS=	sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
26359243Sobrien	sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
26459243Sobrien	sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
26559243Sobrien	sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h 
26659243SobrienPSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
26759243Sobrien	vms.termcap.c
26859243SobrienSHSRCS= ${ASSRCS} ${PSSRCS}
26959243SobrienSHOBJS=	sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
27059243Sobrien	sh.char.${SUF} sh.exp.${SUF} sh.func.${SUF} sh.glob.${SUF} \
27159243Sobrien	sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} sh.misc.${SUF} \
27259243Sobrien	sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} sh.sem.${SUF} \
27359243Sobrien	sh.set.${SUF} sh.time.${SUF} glob.${SUF} mi.termios.${SUF} \
27459243Sobrien	ma.setp.${SUF} vms.termcap.${SUF}
27559243Sobrien
27659243SobrienTWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
27759243Sobrien	tw.comp.c tw.color.c
27859243SobrienTWOBJS=	tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \
27959243Sobrien	tw.comp.${SUF} tw.color.${SUF}
28059243Sobrien
28159243SobrienEDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
28259243Sobrien	ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
28359243SobrienEDOBJS=	ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \
28459243Sobrien	ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF}
28559243Sobrien
28659243SobrienTCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
287145479Smp	tc.func.c tc.os.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
28859243Sobrien	tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
28959243Sobrien	tc.who.c tc.h
29059243SobrienTCOBJS=	tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
291145479Smp	tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.os.${SUF} tc.printf.${SUF} \
29259243Sobrien	tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \
29359243Sobrien	tc.vers.${SUF} tc.who.${SUF} 
29459243Sobrien
29559243SobrienPVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32
296354195SbrooksAVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \
29759243Sobrien	WishList config_f.h eight-bit.me glob.3 patchlevel.h \
29859243Sobrien	pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
299354195Sbrooks	complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
300354195Sbrooks	gethost.c tcsh.man2html configure.ac aclocal.m4
30159243Sobrien
30259243SobrienVHSRCS=${PVSRCS} ${AVSRCS}
30359243Sobrien
30459243SobrienCONFSRCS=config/* 
30559243Sobrien
30659243SobrienALLSRCS=  ${SHSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${VHSRCS}
30759243SobrienDISTSRCS= ${PSSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${AVSRCS}
30859243Sobrien
30959243Sobrien
31059243SobrienOBJS= ${SHOBJS} ${TWOBJS} ${EDOBJS} ${TCOBJS}
31159243Sobrien
31259243Sobrien
31359243Sobrienall: ${BUILD}
31459243Sobrien
31559243Sobrientcsh:$(P) ${OBJS} 
31659243Sobrien	rm -f tcsh core
31759243Sobrien	${CC} -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
31859243Sobrien
31959243Sobrien# Purify
32059243Sobrienpure:$(P) ${OBJS} 
32159243Sobrien	rm -f tcsh core
32259243Sobrien	purify `echo ${CC} | sed -e s,-B/bin/,,` -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
32359243Sobrien# OS/2
32459243Sobrientcsh.exe: tcsh
32559243Sobrien	emxbind tcsh
32659243Sobrien
32759243Sobriengethost:  gethost.c sh.err.h tc.const.h sh.h
32859243Sobrien	rm -f gethost
32959243Sobrien	${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${DFLAGS} gethost.c ${LIBES} ${EXTRALIBS}
33059243Sobrien
33159243Sobrientc.defs.c:	gethost host.defs
33259243Sobrien	@rm -f $@
33359243Sobrien	@echo "/* Do not edit this file, make creates it */" > $@
33459243Sobrien	./gethost host.defs >> $@
33559243Sobrien
33659243Sobrientcsh.ps: tcsh.man
33759243Sobrien	rm -f tcsh.ps
33859243Sobrien	-ptroff -man tcsh.man > tcsh.ps
33959243Sobrien
34059243Sobrien
34159243Sobrien#.c.${SUF}:
34259243Sobrien#	${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $<
34359243Sobrien
34459243Sobrien# _VMS_POSIX #module addition
34559243Sobrien.c.${SUF}:
34659243Sobrien	@(echo '\#module '`echo $< | sed -e 's/\./_/g'`; cat $<) > $*..c
34759243Sobrien	@echo ${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*.c
34859243Sobrien	@${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*..c
34959243Sobrien	@mv $*..o $*.o
35059243Sobrien	@rm -f $*..c
35159243Sobrien
35259243Sobrien
35359243Sobrien# Don't do any special massaging of C files for sharing of strings!!
35459243Sobrien# it causes weird segmentation faults on some systems.
35559243Sobrien#.c.o:
35659243Sobrien#	${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
35759243Sobrien#	${CC} ${CF} ${CFLAGS} x.c 
35859243Sobrien#	mv -f x.o $*.o
35959243Sobrien#	rm -f x.c
36059243Sobrien
36159243Sobrien#ed.init.o: ed.init.c
36259243Sobrien#	${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
36359243Sobrien#	${CC} -R ${CF} ${CF} x.c 
36459243Sobrien#	mv -f x.o $*.o
36559243Sobrien#	rm -f x.c
36659243Sobrien
36759243Sobrien#strings.o: strings
36859243Sobrien#	${XSTR}
36959243Sobrien#	${CC} -c -R xs.c
37059243Sobrien#	mv -f xs.o strings.o
37159243Sobrien#	rm -f xs.c
37259243Sobrien
37359243Sobrien##.DEFAULT:
37459243Sobrien##	${SCCS} get $<
37559243Sobrien
37659243Sobrien##.DEFAULT:
37759243Sobrien##	co $<
37859243Sobrien
37959243Sobriened.defns.h: ed.defns.c
38059243Sobrien	@rm -f $@
38159243Sobrien	@echo '/* Do not edit this file, make creates it. */' > $@
38259243Sobrien	@echo '\#ifndef _h_ed_defns' >> $@
38359243Sobrien	@echo '\#define _h_ed_defns' >> $@
38459243Sobrien	grep '[FV]_' ed.defns.c | grep '^\#define' >> $@
38559243Sobrien	@echo '\#endif /* _h_ed_defns */' >> $@
38659243Sobrien
38759243Sobriensh.err.h: sh.err.c
38859243Sobrien	@rm -f $@
38959243Sobrien	@echo '/* Do not edit this file, make creates it. */' > $@
39059243Sobrien	@echo '\#ifndef _h_sh_err' >> $@
39159243Sobrien	@echo '\#define _h_sh_err' >> $@
39259243Sobrien	grep 'ERR_' sh.err.c | grep '^#define' >> $@
39359243Sobrien	@echo '\#endif /* _h_sh_err */' >> $@
39459243Sobrien
39559243Sobrientc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
39659243Sobrien	@rm -f $@
39759243Sobrien	@echo '/* Do not edit this file, make creates it. */' > $@
39859243Sobrien	@echo '\#ifndef _h_tc_const' >> $@
39959243Sobrien	@echo '\#define _h_tc_const' >> $@
40059243Sobrien	${CC} -E $(INCLUDES) ${DFLAGS} -D_h_tc_const tc.const.c | \
40159243Sobrien	    grep 'Char STR' | \
402100616Smp	    sed -e 's/Char \([a-zA-Z0-9_]*\) *\[ *\].*/extern Char \1[];/' | \
40359243Sobrien	    sort >> $@
40459243Sobrien	@echo '\#endif /* _h_tc_const */' >> $@
40559243Sobrien
40659243Sobriencsh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF}
40759243Sobrien	rm -f csh.prof
40859243Sobrien	ld -X mcrt0.${SUF} ${OBJS} -o csh.prof ${LIBES} -lc
40959243Sobrien
41059243Sobriensh.prof.${SUF}:
41159243Sobrien	cp sh.c sh.prof.c
41259243Sobrien	${CC} ${CF} ${CFLAGS} -DPROF sh.prof.c
41359243Sobrien
41459243Sobrienlint: tc.const.h ed.defns.h
41559243Sobrien	lint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
41659243Sobrien
41759243Sobrienalint: tc.const.h ed.defns.h
41859243Sobrien	alint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
41959243Sobrien
42059243Sobrienprint:
42159243Sobrien	@pr READ_ME
42259243Sobrien	@pr makefile makefile.*
42359243Sobrien	@(size -l a.out; size *.${SUF}) | pr -h SIZES
42459243Sobrien	@${CXREF} sh*.c | pr -h XREF
42559243Sobrien	@ls -l | pr 
42659243Sobrien	@pr sh*.h [a-rt-z]*.h sh*.c alloc.c
42759243Sobrien
42859243Sobrienvprint:
42959243Sobrien	@pr -l84 READ_ME TODO
43059243Sobrien	@pr -l84 makefile makefile.*
43159243Sobrien	@(size -l a.out; size *.${SUF}) | pr -l84 -h SIZES
43259243Sobrien	@${CXREF} sh*.c | pr -l84 -h XREF
43359243Sobrien	@ls -l | pr -l84
43459243Sobrien	@${CXREF} sh*.c | pr -l84 -h XREF
43559243Sobrien	@pr -l84 sh*.h [a-rt-z]*.h sh*.c alloc.c
43659243Sobrien
43759243Sobrienvgrind:
43859243Sobrien	@cp /dev/null index
43959243Sobrien	@for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
44059243Sobrien	@for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
44159243Sobrien	@vgrind -t -x -h Index index >/crp/bill/csh/index.t
44259243Sobrien
44359243Sobrieninstall: tcsh 
44459243Sobrien	-mv -f ${DESTBIN}/tcsh  ${DESTBIN}/tcsh.old
44559243Sobrien	cp tcsh ${DESTBIN}/tcsh
44659243Sobrien	-strip ${DESTBIN}/tcsh
44759243Sobrien	chmod 555 ${DESTBIN}/tcsh
44859243Sobrien
44959243Sobrieninstall.man: tcsh.man
45059243Sobrien	-rm -f ${DESTMAN}/tcsh.${MANSECT}
45159243Sobrien	cp tcsh.man ${DESTMAN}/tcsh.${MANSECT}
45259243Sobrien	chmod 444 ${DESTMAN}/tcsh.${MANSECT}
45359243Sobrien
45459243Sobrien# Amiga Unix
45559243Sobrien#install.man: tcsh.man
45659243Sobrien#        compress tcsh.man
45759243Sobrien#	cp tcsh.man.Z ${DESTMAN}/tcsh.Z
45859243Sobrien#	chmod 444 ${DESTMAN}/tcsh.Z
45959243Sobrien
46059243Sobrien# Apple A/UX
46159243Sobrien#install.man: tcsh.man
46259243Sobrien#	-rm -f ${DESTMAN}/tcsh.${MANSECT}.Z
46359243Sobrien#	nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z
46459243Sobrien#	chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z
46559243Sobrien
46659243Sobrienclean:
46759243Sobrien	${RM} -f a.out strings x.c xs.c tcsh tcsh.a _MAKE_LOG core gethost
46859243Sobrien	${RM} -f *.${SUF} sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c
46959243Sobrien	${RM} -f tcsh.*.m tcsh.*.cat
47059243Sobrien
47159243Sobrienveryclean: clean
47259243Sobrien	${RM} -f config.h
47359243Sobrien	${RM} -f *~ #*
47459243Sobrien
47559243Sobrientags:	/tmp
47659243Sobrien	${CTAGS} sh*.c
47759243Sobrien
47859243Sobrientar.Z:
47959243Sobrien	rm -f tcsh-${VERSION}.tar.Z
48059243Sobrien	rm -rf tcsh-${VERSION} 
48159243Sobrien	mkdir tcsh-${VERSION} tcsh-${VERSION}/config
48259243Sobrien	cp ${ALLSRCS} tcsh-${VERSION}
48359243Sobrien	cp ${CONFSRCS} tcsh-${VERSION}/config
48459243Sobrien	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
48559243Sobrien	tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
48659243Sobrien	rm -rf tcsh-${VERSION}
48759243Sobrien
48859243Sobrientar.gz:
48959243Sobrien	rm -f tcsh-${VERSION}.tar.gz
49059243Sobrien	rm -rf tcsh-${VERSION} 
49159243Sobrien	mkdir tcsh-${VERSION} tcsh-${VERSION}/config
49259243Sobrien	cp ${ALLSRCS} tcsh-${VERSION}
49359243Sobrien	cp ${CONFSRCS} tcsh-${VERSION}/config
49459243Sobrien	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
49559243Sobrien	tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz
49659243Sobrien	rm -rf tcsh-${VERSION}
49759243Sobrien
49859243Sobrienshar:
49959243Sobrien	rm -f tcsh-*.shar
50059243Sobrien	rm -rf tcsh-${VERSION} 
50159243Sobrien	mkdir tcsh-${VERSION} tcsh-${VERSION}/config
50259243Sobrien	cp ${ALLSRCS} tcsh-${VERSION}
50359243Sobrien	cp ${CONFSRCS} tcsh-${VERSION}/config
50459243Sobrien	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
50559243Sobrien	MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \
50659243Sobrien		 tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \
50759243Sobrien		 tcsh-${VERSION}/?*/set?*
50859243Sobrien	rm -rf tcsh-${VERSION}
50959243Sobrien
51059243Sobriencatalogs:
51159243Sobrien	@(cd nls; make catalogs)
51259243Sobrien
51359243Sobrientcsh-${VERSION}.tar.Z:
51459243Sobrien	rm -rf tcsh-${VERSION} 
51559243Sobrien	rm -f tcsh-${VERSION}.tar tcsh-${VERSION}.tar.Z DIFFS.[123]
51659243Sobrien	mkdir tcsh-${VERSION}
51759243Sobrien	./MAKEDIFFS bsd
51859243Sobrien	mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh-${VERSION}
51959243Sobrien	cp ${DISTSRCS} tcsh-${VERSION}
52059243Sobrien	mkdir tcsh-${VERSION}/config
52159243Sobrien	cp ${CONFSRCS} tcsh-${VERSION}/config
52259243Sobrien	cp Makefile tcsh-${VERSION}/Makefile.new
52359243Sobrien	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
52459243Sobrien	tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
52559243Sobrien	rm -rf tcsh-${VERSION}
52659243Sobrien
52759243Sobrientcsh.tahoe-${VERSION}.tar.Z:
52859243Sobrien	rm -rf tcsh.tahoe-${VERSION} 
52959243Sobrien	rm -f tcsh.tahoe-${VERSION}.tar tcsh.tahoe-${VERSION}.tar.Z DIFFS.[123]
53059243Sobrien	mkdir tcsh.tahoe-${VERSION}
53159243Sobrien	./MAKEDIFFS tahoe
53259243Sobrien	mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.tahoe-${VERSION}
53359243Sobrien	cp ${DISTSRCS} tcsh.tahoe-${VERSION}
53459243Sobrien	mkdir tcsh.tahoe-${VERSION}/config
53559243Sobrien	cp ${CONFSRCS} tcsh.tahoe-${VERSION}/config
53659243Sobrien	cp Makefile tcsh.tahoe-${VERSION}/Makefile.new
53759243Sobrien	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
53859243Sobrien	tar cvf - tcsh.tahoe-${VERSION} | compress > tcsh.tahoe-${VERSION}.tar.Z
53959243Sobrien	rm -rf tcsh.tahoe-${VERSION}
54059243Sobrien
54159243Sobrientcsh.reno-${VERSION}.tar.Z:
54259243Sobrien	rm -rf tcsh.reno-${VERSION} 
54359243Sobrien	rm -f tcsh.reno-${VERSION}.tar tcsh.reno-${VERSION}.tar.Z DIFFS.[123]
54459243Sobrien	mkdir tcsh.reno-${VERSION}
54559243Sobrien	./MAKEDIFFS reno
54659243Sobrien	mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.reno-${VERSION}
54759243Sobrien	cp ${DISTSRCS} tcsh.reno-${VERSION}
54859243Sobrien	mkdir tcsh.reno-${VERSION}/config
54959243Sobrien	cp ${CONFSRCS} tcsh.reno-${VERSION}/config
55059243Sobrien	cp Makefile tcsh.reno-${VERSION}/Makefile.new
55159243Sobrien	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
55259243Sobrien	tar cvf - tcsh.reno-${VERSION} | compress > tcsh.reno-${VERSION}.tar.Z
55359243Sobrien	rm -rf tcsh.reno-${VERSION}
55459243Sobrien
55559243Sobrienftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z
55659243Sobrien	cp tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z ${FTPAREA}
55759243Sobrien	cp tcsh.man ${FTPAREA}
55859243Sobrien
55959243Sobrien#
56059243Sobrien# Dependencies
56159243Sobrien#
56259243Sobrienconfig.h: config_f.h
56359243Sobrien
564145479SmpTCH=tc.h tc.const.h tc.decls.h tc.nls.h tc.os.h tc.sig.h
56559243SobrienSHH=sh.h sh.types.h sh.char.h sh.err.h sh.dir.h sh.proc.h pathnames.h \
56659243Sobrien    sh.decls.h ${TCH}
56759243SobrienTWH=tw.h tw.decls.h
56859243SobrienEDH=ed.h ed.decls.h
56959243Sobrien
57059243Sobrien# EDH
57159243SobrienEDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \
57259243Sobrien      sh.set.${SUF} tc.bind.${SUF} tc.os.${SUF} tc.prompt.${SUF} \
57359243Sobrien      tc.sched.${SUF} tw.parse.${SUF}
57459243Sobrien${EDOBJS} ${EDINC} : ${EDH}
57559243Sobrien
57659243Sobrien# SHH
57759243Sobrien${OBJS}: config.h ${SHH}
57859243Sobrien
57959243Sobrien# TWH
58059243SobrienTWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \
581145479Smp      sh.set.${SUF} tc.func.${SUF} tc.nls.${SUF}
58259243Sobrien${TWOBJS} ${TWINC}: ${TWH}
58359243Sobrien
58459243Sobrien# glob.h
58559243Sobrienglob.${SUF} sh.glob.${SUF}: glob.h
58659243Sobrien
58759243Sobrien# ed.defns.h
58859243SobrienEDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
58959243Sobrien${EDOBJS} ${EDDINC}: ed.defns.h
59059243Sobrien
59159243Sobrien# tc.defs.o
59259243Sobrientc.defs.${SUF}:	tc.defs.c sh.h
593