150471Speter# $FreeBSD$
21556Srgrimes#	@(#)Makefile	8.1 (Berkeley) 5/31/93
31556Srgrimes#
41556Srgrimes# C Shell with process control; VM/UNIX VAX Makefile
51556Srgrimes# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
61556Srgrimes#
71556Srgrimes# To profile, put -DPROF in DEFS and -pg in CFLAGS, and recompile.
81556Srgrimes
9156813Sru.include <bsd.own.mk>
10156813Sru
1159576SobrienTCSHDIR= ${.CURDIR}/../../contrib/tcsh
1259355Sobrien.PATH: ${TCSHDIR}
1359355Sobrien
141556SrgrimesPROG=	csh
15117036Sgordon.if defined(RESCUE)
16117036SgordonDFLAGS= -D_PATH_TCSHELL='"/rescue/${PROG}"'
17117036Sgordon.else
1869551SacheDFLAGS= -D_PATH_TCSHELL='"/bin/${PROG}"'
19117036Sgordon.endif
2069640SobrienCFLAGS+= -I. -I${.CURDIR} -I${TCSHDIR} ${DFLAGS}
21231990SmpWARNS?=	1
2259355SobrienSRCS=	sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
2359355Sobrien	sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
2459355Sobrien	sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
2569415Sache	sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h
2659355SobrienSRCS+=	sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h
2759355SobrienSRCS+=	tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
2859355Sobrien	tw.comp.c tw.color.c
2959355SobrienSRCS+=	ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
3059355Sobrien	ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
3159355SobrienSRCS+=	tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
32145481Smp	tc.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
3359355Sobrien	tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
3459355Sobrien	tc.who.c tc.h
3569415SacheGENHDRS= ed.defns.h sh.err.h tc.const.h tc.defs.c
3660599SbdeSRCS+=	${GENHDRS}
371556Srgrimes
3860029SjkoshyMLINKS= csh.1 tcsh.1
3951090Ssheldonh# MLINKS for Shell built in commands for which there are no userland
4051090Ssheldonh# utilities of the same name are handled with the associated manpage,
4151090Ssheldonh# builtin.1 in share/man/man1/.
4251090Ssheldonh
4362759SacheDPADD=	${LIBTERMCAP} ${LIBCRYPT}
4462759SacheLDADD=	-ltermcap -lcrypt
451556Srgrimes
4659393SobrienLINKS=	${BINDIR}/csh ${BINDIR}/tcsh
4759393Sobrien
4869415SacheCLEANFILES= ${GENHDRS} gethost csh.1
4960599Sbde
50156813Sru.if ${MK_EXAMPLES} != "no"
5190559SmpFILESDIR= ${SHAREDIR}/examples/tcsh
5290559SmpFILES= complete.tcsh csh-mode.el
53148673Sphk.endif
5490559Smp
5599257SruCATALOGS=	et:et_EE.ISO8859-15 \
5699257Sru		finnish:fi_FI.ISO8859-1 \
5799257Sru		french:fr_FR.ISO8859-1 \
5899257Sru		german:de_DE.ISO8859-1 \
5999257Sru		greek:el_GR.ISO8859-7 \
6099257Sru		italian:it_IT.ISO8859-1 \
6199257Sru		ja:ja_JP.eucJP \
6299257Sru		russian:ru_RU.KOI8-R \
6399257Sru		spanish:es_ES.ISO8859-1 \
6499257Sru		ukrainian:uk_UA.KOI8-U
6599257Sru
6699257SruNLSLINKS_fi_FI.ISO8859-1= fi_FI.ISO8859-15
6799257SruNLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
6899257Sru		fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 \
6999257Sru		fr_CH.ISO8859-15 fr_FR.ISO8859-15
7099257SruNLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
7199257Sru		de_CH.ISO8859-15 de_DE.ISO8859-15
7299257SruNLSLINKS_it_IT.ISO8859-1= it_CH.ISO8859-1 it_CH.ISO8859-15 it_IT.ISO8859-15
7399257SruNLSLINKS_es_ES.ISO8859-1= es_ES.ISO8859-15
7499257Sru
75156813Sru.if ${MK_NLS_CATALOGS} == "no" || defined(RESCUE)
76155835SumeCFLAGS+= -DNO_NLS_CATALOGS
77155835Sume.else
78155835SumeCFLAGS+= -DHAVE_ICONV
79219061Sume.if ${MK_ICONV} != "no"
80219061SumeNLSLINKS_de_DE.ISO8859-1 += de_AT.UTF-8 de_CH.UTF-8 de_DE.UTF-8
81219061SumeNLSLINKS_el_GR.ISO8859-7 = el_GR.UTF-8
82219061SumeNLSLINKS_es_ES.ISO8859-1 += es_ES.UTF-8
83219061SumeNLSLINKS_et_EE.ISO8859-15 = et_EE.UTF-8
84219061SumeNLSLINKS_fi_FI.ISO8859-1 += fi_FI.UTF-8
85219061SumeNLSLINKS_fr_FR.ISO8859-1 += fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8 fr_FR.UTF-8
86219061SumeNLSLINKS_it_IT.ISO8859-1 += it_CH.UTF-8 it_IT.UTF-8
87219061SumeNLSLINKS_ja_JP.eucJP = ja_JP.SJIS ja_JP.UTF-8
88219061SumeNLSLINKS_ru_RU.KOI8-R = ru_RU.CP1251 ru_RU.CP866 ru_RU.ISO8859-5 ru_RU.UTF-8
89219061SumeNLSLINKS_uk_UA.KOI8-U = uk_UA.ISO8859-5 uk_UA.UTF-8
90219061Sume.else
91219061Sume# Above links can be installed from ports/shells/tcsh_nls
92219061Sume
93219061SumeGENHDRS+= iconv.h
94155835SumeSRCS+=	iconv_stub.c
95219061Sume
96219061Sumeiconv.h: ${.CURDIR}/iconv_stub.h
97219061Sume	cp ${.CURDIR}/iconv_stub.h ${.TARGET}
98155835Sume.endif
99219061Sume.endif
100155835Sume
10199257SruNLSNAME= tcsh
10299257Sru
10399257Sru.for catalog in ${CATALOGS}
10499257SruNLS+=		${catalog:C/.*://}
10599257SruNLSSRCDIR_${catalog:C/.*://}= ${TCSHDIR}/nls/${catalog:C/:.*//}
106155835SumeNLSSRCFILES_${catalog:C/.*://}!= cd ${NLSSRCDIR_${catalog:C/.*://}}; echo charset set[0-9]*
10799257Sru.endfor
10899257Sru
10959355Sobriencsh.1: tcsh.man
110115898Skuriyama	cat ${.ALLSRC} > ${.TARGET}
1111556Srgrimes
11269551Sachebuild-tools: gethost
11369551Sache
11469415Sachegethost: gethost.c sh.err.h tc.const.h sh.h
11569415Sache	@rm -f ${.TARGET}
116219061Sume	${CC} -o gethost ${LDFLAGS} ${CFLAGS:C/-DHAVE_ICONV//} \
117219061Sume	    ${TCSHDIR}/gethost.c
11869415Sache
119231990Smptc.defs.c: gethost ${TCSHDIR}/host.defs
12069415Sache	@rm -f ${.TARGET}
12169415Sache	@echo "/* Do not edit this file, make creates it */" > ${.TARGET}
122231990Smp	./gethost ${TCSHDIR}/host.defs >> ${.TARGET}
12369415Sache
12459355Sobriened.defns.h: ed.defns.c
12527965Ssteve	@rm -f ${.TARGET}
12627965Ssteve	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
12759355Sobrien	@echo '#ifndef _h_ed_defns' >> ${.TARGET}
12859355Sobrien	@echo '#define _h_ed_defns' >> ${.TARGET}
12959355Sobrien	grep '[FV]_' ${TCSHDIR}/ed.defns.c | grep '^#define' >> ${.TARGET}
13059355Sobrien	@echo '#endif /* _h_ed_defns */' >> ${.TARGET}
13159355Sobrien
13259355Sobriensh.err.h: sh.err.c
13359355Sobrien	@rm -f ${.TARGET}
13459355Sobrien	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
13559355Sobrien	@echo '#ifndef _h_sh_err' >> ${.TARGET}
13659355Sobrien	@echo '#define _h_sh_err' >> ${.TARGET}
13769415Sache	grep 'ERR_' ${.ALLSRC} | grep '^#define' >> ${.TARGET}
13859355Sobrien	@echo '#endif /* _h_sh_err */' >> ${.TARGET}
1391556Srgrimes
14059355Sobrientc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
14127969Ssteve	@rm -f ${.TARGET}
14227969Ssteve	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
14359355Sobrien	@echo '#ifndef _h_tc_const' >> ${.TARGET}
14459355Sobrien	@echo '#define _h_tc_const' >> ${.TARGET}
145219061Sume	${CC} -E ${CFLAGS:C/-DHAVE_ICONV//} ${.ALLSRC} -D_h_tc_const | \
146219061Sume	    grep 'Char STR' | \
1471556Srgrimes	    sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
14827969Ssteve	    sort >> ${.TARGET}
14959355Sobrien	@echo '#endif /* _h_tc_const */' >> ${.TARGET}
1501556Srgrimes
1511556Srgrimes.include <bsd.prog.mk>
152