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