Makefile revision 275028
150471Speter# $FreeBSD: head/bin/csh/Makefile 275028 2014-11-25 11:15:40Z bapt $
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
5499257SruCATALOGS=	et:et_EE.ISO8859-15 \
5599257Sru		finnish:fi_FI.ISO8859-1 \
5699257Sru		french:fr_FR.ISO8859-1 \
5799257Sru		german:de_DE.ISO8859-1 \
5899257Sru		greek:el_GR.ISO8859-7 \
5999257Sru		italian:it_IT.ISO8859-1 \
6099257Sru		ja:ja_JP.eucJP \
6199257Sru		russian:ru_RU.KOI8-R \
6299257Sru		spanish:es_ES.ISO8859-1 \
6399257Sru		ukrainian:uk_UA.KOI8-U
6499257Sru
6599257SruNLSLINKS_fi_FI.ISO8859-1= fi_FI.ISO8859-15
6699257SruNLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
6799257Sru		fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 \
6899257Sru		fr_CH.ISO8859-15 fr_FR.ISO8859-15
6999257SruNLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
7099257Sru		de_CH.ISO8859-15 de_DE.ISO8859-15
7199257SruNLSLINKS_it_IT.ISO8859-1= it_CH.ISO8859-1 it_CH.ISO8859-15 it_IT.ISO8859-15
7299257SruNLSLINKS_es_ES.ISO8859-1= es_ES.ISO8859-15
7399257Sru
74156813Sru.if ${MK_NLS_CATALOGS} == "no" || defined(RESCUE)
75155835SumeCFLAGS+= -DNO_NLS_CATALOGS
76155835Sume.else
77155835SumeCFLAGS+= -DHAVE_ICONV
78219061Sume.if ${MK_ICONV} != "no"
79219061SumeNLSLINKS_de_DE.ISO8859-1 += de_AT.UTF-8 de_CH.UTF-8 de_DE.UTF-8
80219061SumeNLSLINKS_el_GR.ISO8859-7 = el_GR.UTF-8
81219061SumeNLSLINKS_es_ES.ISO8859-1 += es_ES.UTF-8
82219061SumeNLSLINKS_et_EE.ISO8859-15 = et_EE.UTF-8
83219061SumeNLSLINKS_fi_FI.ISO8859-1 += fi_FI.UTF-8
84219061SumeNLSLINKS_fr_FR.ISO8859-1 += fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8 fr_FR.UTF-8
85219061SumeNLSLINKS_it_IT.ISO8859-1 += it_CH.UTF-8 it_IT.UTF-8
86219061SumeNLSLINKS_ja_JP.eucJP = ja_JP.SJIS ja_JP.UTF-8
87219061SumeNLSLINKS_ru_RU.KOI8-R = ru_RU.CP1251 ru_RU.CP866 ru_RU.ISO8859-5 ru_RU.UTF-8
88219061SumeNLSLINKS_uk_UA.KOI8-U = uk_UA.ISO8859-5 uk_UA.UTF-8
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
96271771Swill	cp -f ${.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
11369415Sachegethost: gethost.c sh.err.h tc.const.h sh.h
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}
144219061Sume	${CC} -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