Makefile revision 297250
150471Speter# $FreeBSD: head/bin/csh/Makefile 297250 2016-03-24 21:48:13Z bdrewery $
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
9265420Simp.include <src.opts.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
43275028SbaptLIBADD=	termcapw crypt
441556Srgrimes
4559393SobrienLINKS=	${BINDIR}/csh ${BINDIR}/tcsh
4659393Sobrien
4769415SacheCLEANFILES= ${GENHDRS} gethost csh.1
4860599Sbde
49156813Sru.if ${MK_EXAMPLES} != "no"
5090559SmpFILESDIR= ${SHAREDIR}/examples/tcsh
5190559SmpFILES= complete.tcsh csh-mode.el
52148673Sphk.endif
5390559Smp
54295204SumeCATALOGS=	et:et_EE.UTF-8 \
55295204Sume		finnish:fi_FI.UTF-8 \
56295204Sume		french:fr_FR.UTF-8 \
57295204Sume		german:de_DE.UTF-8 \
58295204Sume		greek:el_GR.UTF-8 \
59295204Sume		italian:it_IT.UTF-8 \
60295204Sume		ja:ja_JP.UTF-8 \
61295204Sume		russian:ru_RU.UTF-8 \
62295204Sume		spanish:es_ES.UTF-8 \
63295204Sume		ukrainian:uk_UA.UTF-8
6499257Sru
65295224SbdreweryNLSLINKS_de_DE.UTF-8 = de_AT.UTF-8 de_CH.UTF-8
66295204SumeNLSLINKS_fr_FR.UTF-8 = fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8
67295204SumeNLSLINKS_it_IT.UTF-8 = it_CH.UTF-8
6899257Sru
69156813Sru.if ${MK_NLS_CATALOGS} == "no" || defined(RESCUE)
70155835SumeCFLAGS+= -DNO_NLS_CATALOGS
71155835Sume.else
72155835SumeCFLAGS+= -DHAVE_ICONV
73219061Sume.if ${MK_ICONV} != "no"
74295204SumeNLSLINKS_de_DE.UTF-8 += de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
75295204Sume		de_CH.ISO8859-15 de_DE.ISO8859-1 de_DE.ISO8859-15
76295204SumeNLSLINKS_el_GR.UTF-8 = el_GR.ISO8859-7
77295204SumeNLSLINKS_es_ES.UTF-8 = es_ES.ISO8859-1 es_ES.ISO8859-15
78295204SumeNLSLINKS_et_EE.UTF-8 = et_EE.ISO8859-15
79295204SumeNLSLINKS_fi_FI.UTF-8 = fi_FI.ISO8859-1 fi_FI.ISO8859-15
80295204SumeNLSLINKS_fr_FR.UTF-8 += fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
81295204Sume		fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 \
82295204Sume		fr_CH.ISO8859-15 fr_FR.ISO8859-1 fr_FR.ISO8859-15
83295204SumeNLSLINKS_it_IT.UTF-8 += it_CH.ISO8859-1 it_CH.ISO8859-15 it_IT.ISO8859-1 \
84295204Sume		it_IT.ISO8859-15
85295204SumeNLSLINKS_ja_JP.UTF-8 = ja_JP.SJIS ja_JP.eucJP
86295204SumeNLSLINKS_ru_RU.UTF-8 = ru_RU.CP1251 ru_RU.CP866 ru_RU.ISO8859-5 ru_RU.KOI8-R
87295204SumeNLSLINKS_uk_UA.UTF-8 = uk_UA.ISO8859-5 uk_UA.KOI8-U
88219061Sume.else
89219061Sume# Above links can be installed from ports/shells/tcsh_nls
90219061Sume
91219061SumeGENHDRS+= iconv.h
92155835SumeSRCS+=	iconv_stub.c
93219061Sume
94219061Sumeiconv.h: ${.CURDIR}/iconv_stub.h
95277273Swill	${CP} ${.CURDIR}/iconv_stub.h ${.TARGET}
96155835Sume.endif
97219061Sume.endif
98155835Sume
9999257SruNLSNAME= tcsh
10099257Sru
10199257Sru.for catalog in ${CATALOGS}
10299257SruNLS+=		${catalog:C/.*://}
10399257SruNLSSRCDIR_${catalog:C/.*://}= ${TCSHDIR}/nls/${catalog:C/:.*//}
104155835SumeNLSSRCFILES_${catalog:C/.*://}!= cd ${NLSSRCDIR_${catalog:C/.*://}}; echo charset set[0-9]*
10599257Sru.endfor
10699257Sru
10759355Sobriencsh.1: tcsh.man
108115898Skuriyama	cat ${.ALLSRC} > ${.TARGET}
1091556Srgrimes
11069551Sachebuild-tools: gethost
11169551Sache
11269415Sachegethost: gethost.c sh.err.h tc.const.h sh.h
11369415Sache	@rm -f ${.TARGET}
114219061Sume	${CC} -o gethost ${LDFLAGS} ${CFLAGS:C/-DHAVE_ICONV//} \
115219061Sume	    ${TCSHDIR}/gethost.c
11669415Sache
117231990Smptc.defs.c: gethost ${TCSHDIR}/host.defs
11869415Sache	@rm -f ${.TARGET}
11969415Sache	@echo "/* Do not edit this file, make creates it */" > ${.TARGET}
120231990Smp	./gethost ${TCSHDIR}/host.defs >> ${.TARGET}
12169415Sache
12259355Sobriened.defns.h: ed.defns.c
12327965Ssteve	@rm -f ${.TARGET}
12427965Ssteve	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
12559355Sobrien	@echo '#ifndef _h_ed_defns' >> ${.TARGET}
12659355Sobrien	@echo '#define _h_ed_defns' >> ${.TARGET}
12759355Sobrien	grep '[FV]_' ${TCSHDIR}/ed.defns.c | grep '^#define' >> ${.TARGET}
12859355Sobrien	@echo '#endif /* _h_ed_defns */' >> ${.TARGET}
12959355Sobrien
13059355Sobriensh.err.h: sh.err.c
13159355Sobrien	@rm -f ${.TARGET}
13259355Sobrien	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
13359355Sobrien	@echo '#ifndef _h_sh_err' >> ${.TARGET}
13459355Sobrien	@echo '#define _h_sh_err' >> ${.TARGET}
13569415Sache	grep 'ERR_' ${.ALLSRC} | grep '^#define' >> ${.TARGET}
13659355Sobrien	@echo '#endif /* _h_sh_err */' >> ${.TARGET}
1371556Srgrimes
13859355Sobrientc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
13927969Ssteve	@rm -f ${.TARGET}
14027969Ssteve	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
14159355Sobrien	@echo '#ifndef _h_tc_const' >> ${.TARGET}
14259355Sobrien	@echo '#define _h_tc_const' >> ${.TARGET}
143297250Sbdrewery	${CC:N${CCACHE_BIN}} -E ${CFLAGS:C/-DHAVE_ICONV//} ${.ALLSRC} -D_h_tc_const | \
144219061Sume	    grep 'Char STR' | \
1451556Srgrimes	    sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
14627969Ssteve	    sort >> ${.TARGET}
14759355Sobrien	@echo '#endif /* _h_tc_const */' >> ${.TARGET}
1481556Srgrimes
1491556Srgrimes.include <bsd.prog.mk>
150