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