Makefile revision 298107
150471Speter# $FreeBSD: head/bin/csh/Makefile 298107 2016-04-16 07:45:30Z gjb $
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
11298107SgjbPACKAGE=runtime
1259576SobrienTCSHDIR= ${.CURDIR}/../../contrib/tcsh
1359355Sobrien.PATH: ${TCSHDIR}
1459355Sobrien
151556SrgrimesPROG=	csh
16117036Sgordon.if defined(RESCUE)
17117036SgordonDFLAGS= -D_PATH_TCSHELL='"/rescue/${PROG}"'
18117036Sgordon.else
1969551SacheDFLAGS= -D_PATH_TCSHELL='"/bin/${PROG}"'
20117036Sgordon.endif
2169640SobrienCFLAGS+= -I. -I${.CURDIR} -I${TCSHDIR} ${DFLAGS}
22231990SmpWARNS?=	1
2359355SobrienSRCS=	sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
2459355Sobrien	sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
2559355Sobrien	sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
2669415Sache	sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h
2759355SobrienSRCS+=	sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h
2859355SobrienSRCS+=	tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
2959355Sobrien	tw.comp.c tw.color.c
3059355SobrienSRCS+=	ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
3159355Sobrien	ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
3259355SobrienSRCS+=	tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
33145481Smp	tc.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
3459355Sobrien	tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
3559355Sobrien	tc.who.c tc.h
3669415SacheGENHDRS= ed.defns.h sh.err.h tc.const.h tc.defs.c
3760599SbdeSRCS+=	${GENHDRS}
381556Srgrimes
3960029SjkoshyMLINKS= csh.1 tcsh.1
4051090Ssheldonh# MLINKS for Shell built in commands for which there are no userland
4151090Ssheldonh# utilities of the same name are handled with the associated manpage,
4251090Ssheldonh# builtin.1 in share/man/man1/.
4351090Ssheldonh
44275028SbaptLIBADD=	termcapw crypt
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
55295204SumeCATALOGS=	et:et_EE.UTF-8 \
56295204Sume		finnish:fi_FI.UTF-8 \
57295204Sume		french:fr_FR.UTF-8 \
58295204Sume		german:de_DE.UTF-8 \
59295204Sume		greek:el_GR.UTF-8 \
60295204Sume		italian:it_IT.UTF-8 \
61295204Sume		ja:ja_JP.UTF-8 \
62295204Sume		russian:ru_RU.UTF-8 \
63295204Sume		spanish:es_ES.UTF-8 \
64295204Sume		ukrainian:uk_UA.UTF-8
6599257Sru
66295224SbdreweryNLSLINKS_de_DE.UTF-8 = de_AT.UTF-8 de_CH.UTF-8
67295204SumeNLSLINKS_fr_FR.UTF-8 = fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8
68295204SumeNLSLINKS_it_IT.UTF-8 = it_CH.UTF-8
6999257Sru
70156813Sru.if ${MK_NLS_CATALOGS} == "no" || defined(RESCUE)
71155835SumeCFLAGS+= -DNO_NLS_CATALOGS
72155835Sume.else
73155835SumeCFLAGS+= -DHAVE_ICONV
74219061Sume.if ${MK_ICONV} != "no"
75295204SumeNLSLINKS_de_DE.UTF-8 += de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
76295204Sume		de_CH.ISO8859-15 de_DE.ISO8859-1 de_DE.ISO8859-15
77295204SumeNLSLINKS_el_GR.UTF-8 = el_GR.ISO8859-7
78295204SumeNLSLINKS_es_ES.UTF-8 = es_ES.ISO8859-1 es_ES.ISO8859-15
79295204SumeNLSLINKS_et_EE.UTF-8 = et_EE.ISO8859-15
80295204SumeNLSLINKS_fi_FI.UTF-8 = fi_FI.ISO8859-1 fi_FI.ISO8859-15
81295204SumeNLSLINKS_fr_FR.UTF-8 += fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
82295204Sume		fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 \
83295204Sume		fr_CH.ISO8859-15 fr_FR.ISO8859-1 fr_FR.ISO8859-15
84295204SumeNLSLINKS_it_IT.UTF-8 += it_CH.ISO8859-1 it_CH.ISO8859-15 it_IT.ISO8859-1 \
85295204Sume		it_IT.ISO8859-15
86295204SumeNLSLINKS_ja_JP.UTF-8 = ja_JP.SJIS ja_JP.eucJP
87295204SumeNLSLINKS_ru_RU.UTF-8 = ru_RU.CP1251 ru_RU.CP866 ru_RU.ISO8859-5 ru_RU.KOI8-R
88295204SumeNLSLINKS_uk_UA.UTF-8 = uk_UA.ISO8859-5 uk_UA.KOI8-U
89219061Sume.else
90219061Sume# Above links can be installed from ports/shells/tcsh_nls
91219061Sume
92219061SumeGENHDRS+= iconv.h
93155835SumeSRCS+=	iconv_stub.c
94219061Sume
95219061Sumeiconv.h: ${.CURDIR}/iconv_stub.h
96277273Swill	${CP} ${.CURDIR}/iconv_stub.h ${.TARGET}
97155835Sume.endif
98219061Sume.endif
99155835Sume
10099257SruNLSNAME= tcsh
10199257Sru
10299257Sru.for catalog in ${CATALOGS}
10399257SruNLS+=		${catalog:C/.*://}
10499257SruNLSSRCDIR_${catalog:C/.*://}= ${TCSHDIR}/nls/${catalog:C/:.*//}
105155835SumeNLSSRCFILES_${catalog:C/.*://}!= cd ${NLSSRCDIR_${catalog:C/.*://}}; echo charset set[0-9]*
10699257Sru.endfor
10799257Sru
10859355Sobriencsh.1: tcsh.man
109115898Skuriyama	cat ${.ALLSRC} > ${.TARGET}
1101556Srgrimes
11169551Sachebuild-tools: gethost
11269551Sache
113297997Sbdrewerygethost: gethost.c sh.err.h tc.const.h sh.h ${BUILD_TOOLS_META}
11469415Sache	@rm -f ${.TARGET}
115219061Sume	${CC} -o gethost ${LDFLAGS} ${CFLAGS:C/-DHAVE_ICONV//} \
116219061Sume	    ${TCSHDIR}/gethost.c
11769415Sache
118231990Smptc.defs.c: gethost ${TCSHDIR}/host.defs
11969415Sache	@rm -f ${.TARGET}
12069415Sache	@echo "/* Do not edit this file, make creates it */" > ${.TARGET}
121231990Smp	./gethost ${TCSHDIR}/host.defs >> ${.TARGET}
12269415Sache
12359355Sobriened.defns.h: ed.defns.c
12427965Ssteve	@rm -f ${.TARGET}
12527965Ssteve	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
12659355Sobrien	@echo '#ifndef _h_ed_defns' >> ${.TARGET}
12759355Sobrien	@echo '#define _h_ed_defns' >> ${.TARGET}
12859355Sobrien	grep '[FV]_' ${TCSHDIR}/ed.defns.c | grep '^#define' >> ${.TARGET}
12959355Sobrien	@echo '#endif /* _h_ed_defns */' >> ${.TARGET}
13059355Sobrien
13159355Sobriensh.err.h: sh.err.c
13259355Sobrien	@rm -f ${.TARGET}
13359355Sobrien	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
13459355Sobrien	@echo '#ifndef _h_sh_err' >> ${.TARGET}
13559355Sobrien	@echo '#define _h_sh_err' >> ${.TARGET}
13669415Sache	grep 'ERR_' ${.ALLSRC} | grep '^#define' >> ${.TARGET}
13759355Sobrien	@echo '#endif /* _h_sh_err */' >> ${.TARGET}
1381556Srgrimes
13959355Sobrientc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
14027969Ssteve	@rm -f ${.TARGET}
14127969Ssteve	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
14259355Sobrien	@echo '#ifndef _h_tc_const' >> ${.TARGET}
14359355Sobrien	@echo '#define _h_tc_const' >> ${.TARGET}
144297250Sbdrewery	${CC:N${CCACHE_BIN}} -E ${CFLAGS:C/-DHAVE_ICONV//} ${.ALLSRC} -D_h_tc_const | \
145219061Sume	    grep 'Char STR' | \
1461556Srgrimes	    sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
14727969Ssteve	    sort >> ${.TARGET}
14859355Sobrien	@echo '#endif /* _h_tc_const */' >> ${.TARGET}
1491556Srgrimes
1501556Srgrimes.include <bsd.prog.mk>
151