Makefile.in revision 195609
1# $tcsh: Makefile.in,v 3.40 2009/06/24 22:09:05 christos Exp $
2#	Makefile.in	4.3	6/11/83
3#
4# C Shell with process control; VM/UNIX VAX Makefile
5# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
6#
7# With an input editor, command completion, etc. and ported to all sorts of
8# things; Paul Placeway, CIS Dept., Ohio State University
9#
10SHELL=/bin/sh
11VERSION=@PACKAGE_VERSION@
12BUILD=tcsh$(EXEEXT)
13VPATH=@srcdir@
14srcdir=@srcdir@
15
16################################################################
17## CFLAGS.  For various -D things, see config.h
18################################################################
19#
20# These are the default suffixes from .c to .o and -c to get there
21# but to use the global optimizer on the mips boxes, see below
22#
23SUF=o
24CF=-c
25
26CPPFLAGS=-I. -I$(srcdir)
27
28LFLAGS=
29#LFLAGS= -Zn10000		# hpux lint
30
31
32CFLAGS = @CFLAGS@		# This is set by autoconf.
33#CFLAGS= -g			# debug
34#CFLAGS= -O			# production
35#CFLAGS= 			# Broken optimizers....
36
37#CFLAGS= -g -pg -DPROF
38#CFLAGS= -O -pg -DPROF
39
40# gcc 1.00-1.37
41#CFLAGS= -O -finline-functions -fstrength-reduce 
42
43# gcc 1.37-1.40
44#CFLAGS= -O -fcombine-regs -finline-functions -fstrength-reduce 
45# add -msoft-float for 68881 machines.
46
47# gcc 2.0
48# On the sparc, don't use -O2; it breaks setjmp() and vfork()
49#CFLAGS= -O
50
51# gcc-2.1+
52#CFLAGS= -O2
53
54# lucid c on suns
55#CFLAGS= -O5
56
57# gcc 2.1 on linux
58#CFLAGS= -O6 -fomit-frame-pointer
59
60# HP/UX 8.0, 9.0
61#CFLAGS= +O3 -Aa
62
63# Ultrix 4.2a
64#CFLAGS= -O -Olimit 2000
65
66# Intel Paragon OSF/1 with PGI compilers
67#CFLAGS= -O -Mnodebug -Mnoperfmon
68
69# DEC Alpha OSF/1
70#CFLAGS= -O2 -Olimit 2000	## Normal Optimization
71#CFLAGS= -O3 -Olimit 2000	## Full Optimization - may not work
72#CF=-j
73#SUF=u
74#.SUFFIXES: .u
75
76# for silicon graphics (and other mips compilers) -- use the
77# global optimizer! (-O3).
78# On SGI 4.0+ you need to add -D__STDC__ too.
79#CFLAGS= -O3
80#CFLAGS= -O3 -Olimit 2000	## Ultrix 4.2a
81#CF=-j
82#SUF=u
83#.SUFFIXES: .u 				## Ultrix and gnu-make need that
84
85# mips systems
86# CFLAGS= -O -systype bsd43 -Wf,-XNd5000 -Wf,-XNp6000 -Olimit 2000
87
88# for at&t machines
89#CFLAGS= -O -Ksd
90
91# Stardent Titan
92#CFLAGS = -O -43
93
94# Stardent Stellar or sunos4 /bin/cc or Solaris2.1 /opt/SUNWspro/bin/cc
95#CFLAGS = -O4
96
97# Intergraph clipper CLIX 3.1
98#CFLAGS= -w -O2
99
100# Dnix 5.3
101#CFLAGS = -O -X7
102
103# Pyramid OS/x
104#CFLAGS = -OG
105
106# Multiflow (5M binary... if you choose -O5!)
107#CFLAGS = -O5 -sb_trace 0
108
109# DDE Supermax Unix SYSV Rel III.
110# CFLAGS= -O3
111
112# SINIX RMx00
113#CFLAGS= -O # -D_POSIX_SOURCE # -kansi
114
115# Apollo's with cc [apollo builtins don't work with gcc]
116# and apollo should not define __STDC__ if it does not have
117# the standard header files. RT's (aos4.3) need that too;
118# you might want to skip the -O on the rt's... Not very wise.
119# AIX/ESA needs -D_IBMESA on command line (this may disappear by GA)
120#DFLAGS=-U__STDC__ 
121#DFLAGS=-D_IBMESA
122# On aix2.2.1 we need more compiler space.
123#DFLAGS=-Nd4000 -Nn3000
124# AU/X 2.0 needs a flag for POSIX (read the config file)
125#DFLAGS=-Zp
126# Tektronix 4300 running UTek 4.0 (BSD 4.2) needs:
127#DFLAGS = -DUTek -DBSD
128# VMS_POSIX needs:
129#DFLAGS=-D_VMS_POSIX
130# Multiflow and PCC compilers don't like void typedefs.
131# You may also need -U__STDC__ if you use pcc (i.e. ibmrt aos4.3).
132#DFLAGS=-DMULTIFLOW
133#DFLAGS=-DPCC
134# DELL SVR4
135#DFLAGS=-DDELL
136#DFLAGS=
137#DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"'
138## The following is set by autoconf.
139DFLAGS = -D_PATH_TCSHELL='"${bindir}/tcsh"' @DFLAGS@ @CPPFLAGS@
140
141
142################################################################
143## LDFLAGS.  Define something here if you need to
144################################################################
145LDFLAGS= @LDFLAGS@		## This is set by autoconf.
146#LDFLAGS= 			## The simplest, suitable for all.
147#LDFLAGS= -s			## Stripped. Takes less space on disk.
148#LDFLAGS= -s -n			## Pure executable. Spares paging over
149# 				## the network for machines with local
150#				## swap but external /usr/local/bin .
151#LDFLAGS= -s -n -Bstatic	## Without dynamic linking. (SunOS/cc)
152#LDFLAGS= -s -n -static		## Without dynamic linking. (SunOS/gcc)
153#LDFLAGS= -Wl,-s,-n		## Stripped, shared text (Unicos)
154#LDFLAGS= -s -static		## Link statically. (linux)
155#LDFLAGS= -s -N			## Impure executable (linux)
156
157################################################################
158## SBINLDFLAGS.  Flags to build a tcsh suitable for installation in
159##		 in /sbin under Solaris with gcc. See the "tcsh.sbin"
160##		 target.
161################################################################
162SBINLDFLAGS=-Wl,-R/etc/lib,-I/etc/lib/ld.so.1,-ldl,-Bstatic
163
164################################################################
165## LIBES.  Pick one, or roll your own.
166################################################################
167LIBES= @LIBS@	 			 ## This is set by autoconf.
168#LIBES= -ltermcap 			 ## BSD style things
169#LIBES= -ltermcap			 ## SunOS, HP-UX, pyramid
170#LIBES= -ltermcap			 ## Linux
171#LIBES= -ltermcap -lshadow		 ## Linux with PW_SHADOW
172#LIBES= -ltermcap -lsec			 ## Tek XD88/10 (UTekV) with PW_SHADOW
173#LIBES= -ltermcap -lsec			 ## Motorola MPC (sysV88) with PW_SHADOW
174#LIBES= -ltermcap -lcs			 ## Mach
175#LIBES= -ltermcap -lbsd			 ## DEC osf1 on the alpha
176#LIBES= -ltermcap -lbsd			 ## Intel paragon
177#LIBES= -ltermcap -lbsd			 ## Clipper intergraph
178#LIBES= -ltermcap -lseq			 ## Sequent's Dynix
179#LIBES= -ltermcap -lauth		 ## Ultrix with Enhanced Security
180#LIBES= -ltermcap -ldir -lx		 ## Xenix 386 style things
181#LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
182#LIBES= -lcurses			 ## AIX on the rt
183#LIBES= -lcurses			 ## TitanOS on the stellar
184#LIBES= -ltermlib -lsocket -lnsl	 ## SysV4 w/o BSDTIMES or Solaris 2
185#LIBES= -lcurses			 ## SysV3 w/o networking
186#LIBES= -lcurses -lnet			 ## SysV3 with networking
187#LIBES= -lcurses -ldir			 ## SysV2 w/o networking & dirlib
188#LIBES= -lcurses -ldir -lnet		 ## SysV2 with networking & dirlib
189#LIBES= -lcurses -lbsd			 ## AIX on the IBM 370 or rs6000 or ps2
190#LIBES= -lcurses -lbsd			 ## ETA10
191#LIBES= -lcurses -lbsd			 ## Irix3.1 on the SGI-IRIS4D
192#LIBES= -lcurses -lbsd -lc_s		 ## Irix3.3 on the SGI-IRIS4D w/o yp
193#LIBES= -lcurses -lsun -lbsd -lc_s	 ## Irix3.3 on the SGI-IRIS4D with yp
194#LIBES= -lcurses -lsocket -lbsd		 ## Amdahl UTS 2.1
195#LIBES= -lcurses -lsocket		 ## Intel's hypercube.
196#LIBES= -lcurses -lsocket		 ## ns32000 based Opus.
197#LIBES= -lcurses -lcposix		 ## ISC 2.2 without networking
198#LIBES= -lcposix -lc_s -lcurses -linet	 ## ISC 2.2 with networking
199#LIBES= -lcurses -lsec -lc_s		 ## ISC 2.0.2 without networking
200#LIBES= -lcurses -linet -lsec -lc_s	 ## ISC 2.0.2 with networking
201#LIBES= -lcurses -lintl -lcrypt		 ## SCO SysVR3.2v2.0
202#LIBES= -lcurses -lintl -lsocket -lcrypt ## SCO+ODT1.1
203#LIBES= -lposix -ltermcap		 ## A/UX 2.0
204#LIBES= -lposix -ltermcap -lc_s		 ## A/UX 3.0
205#LIBES= -ldirent -lcurses		 ## att3b1 cc w/o shared lib & dirlib
206#LIBES= -shlib -ldirent -lcurses	 ## att3b1 gcc with shared lib & dirlib
207#LIBES= -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a ## SysV4 with BSDTIMES
208#LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
209#LIBES= -ltermc				 ## emx under OS/2
210#LIBES=					 ## Minix, VMS_POSIX
211#LIBES= -ltermcap -lcrypt		 ## Multiflow
212#LIBES= -ltermcap -lcrypt		 ## NetBSD
213#LIBES= -lcurses 			 ## DDE Supermax
214
215################################################################
216## EXTRAFLAGS and EXTRALIBS
217################################################################
218# Compiling for AFS with kerberos authentication
219#AFSLIBDIR = /usr/afsws/lib
220#AFSDEF = -DAFS -I/usr/afsws/include
221#AFS33LIB = -laudit
222#
223#Solaris and HPUX require the BSD libraries with AFS.
224#We use -lc to use only what we require.
225#AFSAUXLIB = -lsocket -lnsl -lc -lucb                    # Solaris
226#AFSAUXLIB = -lc -lBSD                                   # HPUX   
227#
228#AFSLIB = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik\
229#         -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\
230#         $(AFSLIBDIR)/afs/util.a $(AFS33LIB) $(AFSAUXLIB)
231#
232
233EXTRAFLAGS = @HESDEF@ $(AFSDEF)
234EXTRALIBS = @HESLIB@ $(AFSLIB) @LIBICONV@
235
236
237
238# The difficult choice of a c-compiler...
239# First, you should try your own c-compiler. 
240# Gcc -traditional is also a safe choice. 
241# If you think that you have good include files try gcc -Wall...
242# If you want to take out -traditional, make sure that your sys/ioctl.h
243# is fixed correctly, otherwise you'll be stopped for tty input, or you
244# will lose the editor and job control.
245
246# This is for setting your C preprocessor value.
247CPP = @CPP@ # This is set by autoconf.
248# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
249# on the suns does not know how to make dynamically linked binaries.
250CC = @CC@ # This is set by autoconf.
251#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings -Wextra
252#CC=	gcc -Wall -pipe -B/bin/	# -ansi -pedantic
253#CC=	gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux)
254#CC=	shlicc 	# BSDI2.1 w/ shared libraries
255#CC=	cc
256#CC=	occ
257#CC=	acc
258#CC=	pcc
259#CC=	hc -w
260#CC=	c89	# For VMS/POSIX
261#CC=	/bin/cc	# For suns, w/o gcc and SVR4
262#CC=	/usr/lib/sun.compile/cc  # FPS 500 (+FPX) with Sun C compiler
263#CC=	/opt/SUNWspro/bin/cc	# Solaris 2.1
264#CC=	scc 	# Alliant fx2800
265#CC=	cc	-h0,ansi,novector,float0 # for NEC SX-4
266#CC=	lcc	-wa 
267ED=	ed
268AS=	as
269RM=	rm
270CXREF=	/usr/ucb/cxref
271VGRIND=	csh /usr/ucb/vgrind
272CTAGS=	/usr/ucb/ctags
273#XSTR= /usr/ucb/xstr
274SCCS=	/usr/local/sccs
275PARALLEL=12				# Make the multi-max run fast.
276#P=&					# Use Sequent's parallel make
277P=
278prefix=@prefix@
279exec_prefix=@exec_prefix@
280bindir=@bindir@
281mandir=@datarootdir@/man
282MANSECT=1
283DESTBIN=${DESTDIR}${bindir}
284DESTMAN=${DESTDIR}${mandir}/man${MANSECT}
285# DESTMAN=${DESTDIR}/catman/man${MANSECT}	 # A/UX
286# DESTMAN=${DESTDIR}/usr/share/man/man${MANSECT} # Stardent Vistra (SysVR4)
287# DESTMAN=/usr/catman/1l			 # Amiga unix (SysVR4)
288EXEEXT=@EXEEXT@
289FTPAREA=/usr/spool/ftp
290
291ASSRCS=	sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
292	sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
293	sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
294	sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h \
295	tw.color.c
296PSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
297	vms.termcap.c
298SHSRCS= ${ASSRCS} ${PSSRCS}
299SHOBJS=	sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
300	sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \
301	sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \
302	sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \
303	sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} \
304	mi.termios.${SUF} ma.setp.${SUF} vms.termcap.${SUF}
305
306TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
307	tw.comp.c tw.color.c
308TWOBJS=	tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \
309	tw.comp.${SUF} tw.color.${SUF}
310
311EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
312	ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
313EDOBJS=	ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \
314	ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF}
315
316TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
317	tc.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
318	tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
319	tc.who.c tc.h
320TCOBJS=	tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
321	tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} tc.printf.${SUF} \
322	tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \
323	tc.vers.${SUF} tc.who.${SUF} 
324
325PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32
326AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
327	WishList config_f.h eight-bit.me glob.3 patchlevel.h \
328	pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
329	README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
330	host.defs gethost.c tcsh.man2html configure.in configure config.h.in \
331	tests/testsuite.at
332TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \
333	tests/expr.at tests/lexical.at tests/mb-eucjp.at tests/mb-utf8.at \
334	tests/noexec.at tests/syntax.at tests/subst.at tests/variables.at \
335	tests/sh.dol.at
336
337VHSRCS=${PVSRCS} ${AVSRCS}
338
339CONFSRCS=config/* 
340
341ALLSRCS=  ${SHSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${VHSRCS}
342DISTSRCS= ${PSSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${AVSRCS} $(TESTFILES)
343
344
345OBJS= ${SHOBJS} ${TWOBJS} ${EDOBJS} ${TCOBJS}
346
347
348all: ${BUILD}
349
350tcsh$(EXEEXT):$(P) ${OBJS} 
351	rm -f tcsh$(EXEEXT) core
352	${CC} -o tcsh$(EXEEXT) ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
353
354tcsh.sbin:$(P) ${OBJS} 
355	rm -f tcsh.sbin core
356	${CC} -o tcsh.sbin ${SBINLDFLAGS} ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
357
358# Purify
359pure:$(P) ${OBJS} 
360	rm -f tcsh$(EXEEXT) core
361	purify `echo ${CC} | sed -e s,-B/bin/,,` -o tcsh$(EXEEXT) ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
362# OS/2
363#tcsh.exe: tcsh
364#	emxbind tcsh
365
366gethost:  gethost.c sh.err.h tc.const.h sh.h
367	rm -f gethost
368	${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} $(srcdir)/gethost.c ${LIBES} ${EXTRALIBS}
369
370tc.defs.c:	gethost host.defs
371	@rm -f $@.tmp
372	@echo "/* Do not edit this file, make creates it */" > $@.tmp
373	./gethost $(srcdir)/host.defs >> $@.tmp
374	@if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi
375
376tcsh.ps: tcsh.man
377	rm -f tcsh.ps
378	-ptroff -t -man $(srcdir)/tcsh.man > tcsh.ps
379
380.c.${SUF}:
381	${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $<
382
383.SUFFIXES: .s .i
384
385.c.i:
386	${CC} -E ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $< | cat -s > $@
387
388.c.s:
389	${CC} -S ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $<
390
391# _VMS_POSIX #module addition
392#.c.${SUF}:
393#	@(echo '#module '`echo $< | sed -e 's/\./_/g'`; cat $<) > $*..c
394#	@echo ${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*.c
395#	@${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*..c
396#	@mv $*..o $*.o
397#	@rm -f $*..c
398
399
400# Don't do any special massaging of C files for sharing of strings!!
401# it causes weird segmentation faults on some systems.
402#.c.o:
403#	${CPP} ${CFLAGS} ${CPPFLAGS} $*.c | ${XSTR} -c -
404#	${CC} ${CF} ${CFLAGS} ${CPPFLAGS} x.c 
405#	mv -f x.o $*.o
406#	rm -f x.c
407
408#ed.init.o: ed.init.c
409#	${CPP} ${CFLAGS} ${CPPFLAGS} $*.c | ${XSTR} -c -
410#	${CC} -R ${CF} ${CFLAGS} ${CPPFLAGS} x.c 
411#	mv -f x.o $*.o
412#	rm -f x.c
413
414#strings.o: strings
415#	${XSTR}
416#	${CC} -c -R xs.c
417#	mv -f xs.o strings.o
418#	rm -f xs.c
419
420##.DEFAULT:
421##	${SCCS} get $<
422
423##.DEFAULT:
424##	co $<
425
426ed.defns.h: ed.defns.c
427	@rm -f $@.tmp
428	@echo '/* Do not edit this file, make creates it. */' > $@.tmp
429	@echo '#ifndef _h_ed_defns' >> $@.tmp
430	@echo '#define _h_ed_defns' >> $@.tmp
431	grep '[FV]_' $(srcdir)/ed.defns.c | grep '^#define' >> $@.tmp
432	@echo '#endif /* _h_ed_defns */' >> $@.tmp
433	@if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi
434
435sh.err.h: sh.err.c
436	@rm -f $@.tmp
437	@echo '/* Do not edit this file, make creates it. */' > $@.tmp
438	@echo '#ifndef _h_sh_err' >> $@.tmp
439	@echo '#define _h_sh_err' >> $@.tmp
440	grep 'ERR_' $(srcdir)/sh.err.c | grep '^#define' >> $@.tmp
441	@echo '#endif /* _h_sh_err */' >> $@.tmp
442	@if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi
443
444tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
445	@rm -f $@.tmp
446	@echo '/* Do not edit this file, make creates it. */' > $@.tmp
447	@echo '#ifndef _h_tc_const' >> $@.tmp
448	@echo '#define _h_tc_const' >> $@.tmp
449	${CPP} $(CPPFLAGS) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
450	    $(srcdir)/tc.const.c | \
451	    sed -n -e 's/^\(Char STR[a-zA-Z0-9_]*\) *\[ *\].*/extern \1[];/p' | \
452	    sort >> $@.tmp
453	@echo '#endif /* _h_tc_const */' >> $@.tmp
454	@if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi
455
456$(srcdir)/tests/package.m4: $(srcdir)/configure.in
457	{								   \
458	  echo '# Signature of the current package.';			   \
459	  echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])';	   \
460	  echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])';   \
461	  echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])';   \
462	  echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])';	   \
463	  echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
464	} >$(srcdir)/tests/package.m4
465
466$(srcdir)/tests/testsuite: $(srcdir)/tests/package.m4 $(srcdir}/tests/testsuite.at $(TESTFILES)
467	autom4te --language=autotest -I $(srcdir)/tests \
468		$(srcdir)/tests/testsuite.at -o $@.tmp
469	mv $@.tmp $@
470
471atconfig: config.status
472	$(SHELL) ./config.status ./atconfig
473
474
475csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF}
476	rm -f csh.prof
477	ld -X mcrt0.${SUF} ${OBJS} -o csh.prof ${LIBES} -lc
478
479sh.prof.${SUF}:
480	cp sh.c sh.prof.c
481	${CC} ${CF} ${CFLAGS} ${CPPFLAGS} -DPROF sh.prof.c
482
483lint: tc.const.h ed.defns.h
484	lint ${DFLAGS} ${CPPFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
485
486alint: tc.const.h ed.defns.h
487	alint ${DFLAGS} ${CPPFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
488
489print:
490	@pr READ_ME
491	@pr makefile makefile.*
492	@(size -l a.out; size *.${SUF}) | pr -h SIZES
493	@${CXREF} sh*.c | pr -h XREF
494	@ls -l | pr 
495	@pr sh*.h [a-rt-z]*.h sh*.c alloc.c
496
497vprint:
498	@pr -l84 READ_ME TODO
499	@pr -l84 makefile makefile.*
500	@(size -l a.out; size *.${SUF}) | pr -l84 -h SIZES
501	@${CXREF} sh*.c | pr -l84 -h XREF
502	@ls -l | pr -l84
503	@${CXREF} sh*.c | pr -l84 -h XREF
504	@pr -l84 sh*.h [a-rt-z]*.h sh*.c alloc.c
505
506vgrind:
507	@cp /dev/null index
508	@for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
509	@for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
510	@vgrind -t -x -h Index index >/crp/bill/csh/index.t
511
512install-strip: install
513
514install: tcsh$(EXEEXT) 
515	-mkdir -p ${DESTBIN}
516	-mv -f ${DESTBIN}/tcsh$(EXEEXT)  ${DESTBIN}/tcsh.old
517	cp tcsh$(EXEEXT) ${DESTBIN}/tcsh$(EXEEXT)
518	-strip ${DESTBIN}/tcsh$(EXEEXT)
519	chmod 755 ${DESTBIN}/tcsh$(EXEEXT)
520
521install.man: tcsh.man
522	-mkdir -p ${DESTMAN}
523	-rm -f ${DESTMAN}/tcsh.${MANSECT}
524	cp $(srcdir)/tcsh.man ${DESTMAN}/tcsh.${MANSECT}
525	chmod 444 ${DESTMAN}/tcsh.${MANSECT}
526
527install.cygwin: install install.man
528	-mkdir -p ${DESTDIR}${prefix}/share/doc/tcsh
529	cp ${srcdir}/FAQ ${srcdir}/Fixes ${DESTDIR}${prefix}/share/doc/tcsh
530	cp ${srcdir}/NewThings ${srcdir}/README ${DESTDIR}${prefix}/share/doc/tcsh
531	cp ${srcdir}/WishList ${srcdir}/Y2K ${DESTDIR}${prefix}/share/doc/tcsh
532	perl ${srcdir}/tcsh.man2html ${srcdir}/tcsh.man
533	cp -rp tcsh.html ${DESTDIR}${prefix}/share/doc/tcsh
534	-mkdir -p ${DESTDIR}/etc/defaults/etc/profile.d
535	-mkdir -p ${DESTDIR}/etc/profile.d
536	-mkdir -p ${DESTDIR}/etc/postinstall
537	-mkdir -p ${DESTDIR}/etc/preremove
538	cp -p ${srcdir}/cygwin/csh.cshrc ${DESTDIR}/etc/defaults/etc
539	cp -p ${srcdir}/cygwin/csh.login ${DESTDIR}/etc/defaults/etc
540	cp -p ${srcdir}/cygwin/bindkey.tcsh ${DESTDIR}/etc/defaults/etc/profile.d
541	cp -p ${srcdir}/complete.tcsh ${DESTDIR}/etc/defaults/etc/profile.d
542	cp -p ${srcdir}/cygwin/postinstall.sh ${DESTDIR}/etc/postinstall/tcsh.sh
543	cp -p ${srcdir}/cygwin/preremove.sh ${DESTDIR}/etc/preremove/tcsh.sh
544
545# Amiga Unix
546#install.man: tcsh.man
547#        compress tcsh.man
548#	cp tcsh.man.Z ${DESTMAN}/tcsh.Z
549#	chmod 444 ${DESTMAN}/tcsh.Z
550
551# Apple A/UX
552#install.man: tcsh.man
553#	-rm -f ${DESTMAN}/tcsh.${MANSECT}.Z
554#	nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z
555#	chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z
556
557clean:
558	${RM} -f a.out strings x.c xs.c tcsh$(EXEEXT) tcsh.a _MAKE_LOG gethost
559	${RM} -f *.${SUF} *.i *.s
560	${RM} -f sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c
561	${RM} -f tcsh.*.m tcsh.*.cat
562
563veryclean: clean
564	${RM} -f Makefile config.h config_p.h
565	${RM} -f config.status config.cache config.log tcsh.ps
566	${RM} -f missing
567	${RM} -rf autom4te.cache
568	${RM} -f *~ #*
569
570distclean: veryclean
571
572cleandir: veryclean
573
574tags:	/tmp
575	${CTAGS} sh*.c
576
577tar.Z:
578	rm -f tcsh-${VERSION}.tar.Z
579	rm -rf tcsh-${VERSION} 
580	-mkdir tcsh-${VERSION} tcsh-${VERSION}/config tcsh-${VERSION}/tests
581	cp ${ALLSRCS} tcsh-${VERSION}
582	cp ${CONFSRCS} tcsh-${VERSION}/config
583	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
584	tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
585	rm -rf tcsh-${VERSION}
586
587tar.gz:
588	rm -f tcsh-${VERSION}.tar.gz
589	rm -rf tcsh-${VERSION} 
590	-mkdir tcsh-${VERSION} tcsh-${VERSION}/config tcsh-${VERSION}/tests
591	cp ${ALLSRCS} tcsh-${VERSION}
592	cp ${CONFSRCS} tcsh-${VERSION}/config
593	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
594	tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz
595	rm -rf tcsh-${VERSION}
596
597shar:
598	rm -f tcsh-*.shar
599	rm -rf tcsh-${VERSION} 
600	-mkdir tcsh-${VERSION} tcsh-${VERSION}/config tcsh-${VERSION}/tests
601	cp ${ALLSRCS} tcsh-${VERSION}
602	cp ${CONFSRCS} tcsh-${VERSION}/config
603	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
604	MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \
605		 tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \
606		 tcsh-${VERSION}/?*/set?*
607	rm -rf tcsh-${VERSION}
608
609catalogs:
610	@(cd nls; make catalogs)
611
612tcsh-${VERSION}.tar.Z:
613	rm -rf tcsh-${VERSION} 
614	rm -f tcsh-${VERSION}.tar tcsh-${VERSION}.tar.Z DIFFS.[123]
615	-mkdir tcsh-${VERSION} tcsh-${VERSION}/tests
616	./MAKEDIFFS bsd
617	mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh-${VERSION}
618	cp ${DISTSRCS} tcsh-${VERSION}
619	-mkdir tcsh-${VERSION}/config
620	cp ${CONFSRCS} tcsh-${VERSION}/config
621	cp Makefile tcsh-${VERSION}/Makefile.new
622	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
623	tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
624	rm -rf tcsh-${VERSION}
625
626tcsh.tahoe-${VERSION}.tar.Z:
627	rm -rf tcsh.tahoe-${VERSION} 
628	rm -f tcsh.tahoe-${VERSION}.tar tcsh.tahoe-${VERSION}.tar.Z DIFFS.[123]
629	-mkdir tcsh.tahoe-${VERSION}
630	./MAKEDIFFS tahoe
631	mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.tahoe-${VERSION}
632	cp ${DISTSRCS} tcsh.tahoe-${VERSION}
633	-mkdir tcsh.tahoe-${VERSION}/config
634	cp ${CONFSRCS} tcsh.tahoe-${VERSION}/config
635	cp Makefile tcsh.tahoe-${VERSION}/Makefile.new
636	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
637	tar cvf - tcsh.tahoe-${VERSION} | compress > tcsh.tahoe-${VERSION}.tar.Z
638	rm -rf tcsh.tahoe-${VERSION}
639
640tcsh.reno-${VERSION}.tar.Z:
641	rm -rf tcsh.reno-${VERSION} 
642	rm -f tcsh.reno-${VERSION}.tar tcsh.reno-${VERSION}.tar.Z DIFFS.[123]
643	-mkdir tcsh.reno-${VERSION}
644	./MAKEDIFFS reno
645	mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.reno-${VERSION}
646	cp ${DISTSRCS} tcsh.reno-${VERSION}
647	-mkdir tcsh.reno-${VERSION}/config
648	cp ${CONFSRCS} tcsh.reno-${VERSION}/config
649	cp Makefile tcsh.reno-${VERSION}/Makefile.new
650	tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
651	tar cvf - tcsh.reno-${VERSION} | compress > tcsh.reno-${VERSION}.tar.Z
652	rm -rf tcsh.reno-${VERSION}
653
654ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z
655	cp tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z ${FTPAREA}
656	cp tcsh.man ${FTPAREA}
657
658autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in
659
660$(srcdir)/configure: $(srcdir)/configure.in
661	cd $(srcdir) && autoconf
662
663$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
664$(srcdir)/stamp-h.in: $(srcdir)/configure.in
665	cd $(srcdir) && autoheader
666	@echo timestamp > $(srcdir)/stamp-h.in
667
668check: atconfig $(srcdir)/tests/testsuite
669	$(SHELL) $(srcdir)/tests/testsuite
670
671#
672# Dependencies
673#
674config.h: config_f.h
675
676TCH=tc.h tc.const.h tc.decls.h tc.nls.h tc.os.h tc.sig.h
677SHH=sh.h sh.types.h sh.char.h sh.err.h sh.dir.h sh.proc.h pathnames.h \
678    sh.decls.h ${TCH}
679TWH=tw.h tw.decls.h
680EDH=ed.h ed.decls.h
681
682# EDH
683EDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \
684      sh.set.${SUF} tc.bind.${SUF} tc.os.${SUF} tc.prompt.${SUF} \
685      tc.sched.${SUF} tw.parse.${SUF} tw.color.${SUF}
686${EDOBJS} ${EDINC} : ${EDH}
687
688# SHH
689${OBJS}: config.h ${SHH}
690
691# TWH
692TWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \
693      sh.set.${SUF} tc.func.${SUF} tc.nls.${SUF} tw.color.${SUF}
694${TWOBJS} ${TWINC}: ${TWH}
695
696# glob.h
697glob.${SUF} sh.glob.${SUF}: glob.h
698
699# ed.defns.h
700EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
701${EDOBJS} ${EDDINC}: ed.defns.h
702
703# tc.defs.o
704tc.defs.${SUF}:	tc.defs.c sh.h
705