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