xref: /freebsd/bin/csh/Makefile (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1# $FreeBSD$
2#	@(#)Makefile	8.1 (Berkeley) 5/31/93
3#
4# C Shell with process control; VM/UNIX VAX Makefile
5# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
6#
7# To profile, put -DPROF in DEFS and -pg in CFLAGS, and recompile.
8
9.include <src.opts.mk>
10
11PACKAGE=	csh
12
13CONFGROUPS=	ETC ROOT
14ETCPACKAGE=	csh
15ROOTPACKAGE=	csh
16ETC=	csh.cshrc csh.login csh.logout
17ROOT=	dot.cshrc dot.login
18ROOTDIR=	/root
19ROOTNAME_dot.cshrc=	.cshrc
20ROOTNAME_dot.login=	.login
21TCSHDIR= ${SRCTOP}/contrib/tcsh
22.PATH: ${TCSHDIR}
23
24PROG=	csh
25.if defined(RESCUE)
26DFLAGS= -D_PATH_TCSHELL='"/rescue/${PROG}"'
27.else
28DFLAGS= -D_PATH_TCSHELL='"/bin/${PROG}"'
29.endif
30CFLAGS+= -I. -I${.CURDIR} -I${TCSHDIR} ${DFLAGS}
31WARNS?=	1
32SRCS=	sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
33	sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
34	sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
35	sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h
36SRCS+=	sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h
37SRCS+=	tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
38	tw.comp.c tw.color.c
39SRCS+=	ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
40	ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
41SRCS+=	tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
42	tc.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
43	tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
44	tc.who.c tc.h
45SRCS+=	dotlock.c dotlock.h
46GENHDRS= ed.defns.h sh.err.h tc.const.h tc.defs.c
47SRCS+=	${GENHDRS}
48
49MLINKS= csh.1 tcsh.1
50# MLINKS for Shell built in commands for which there are no userland
51# utilities of the same name are handled with the associated manpage,
52# builtin.1 in share/man/man1/.
53
54LIBADD=	termcapw crypt
55
56LINKS=	${BINDIR}/csh ${BINDIR}/tcsh
57
58CLEANFILES= ${GENHDRS} gethost csh.1
59
60.if ${MK_EXAMPLES} != "no"
61FILESDIR= ${SHAREDIR}/examples/tcsh
62FILES= complete.tcsh csh-mode.el
63.endif
64
65CATALOGS=	et:et_EE.UTF-8 \
66		finnish:fi_FI.UTF-8 \
67		french:fr_FR.UTF-8 \
68		german:de_DE.UTF-8 \
69		greek:el_GR.UTF-8 \
70		italian:it_IT.UTF-8 \
71		ja:ja_JP.UTF-8 \
72		russian:ru_RU.UTF-8 \
73		spanish:es_ES.UTF-8 \
74		ukrainian:uk_UA.UTF-8
75
76NLSLINKS_de_DE.UTF-8 = de_AT.UTF-8 de_CH.UTF-8
77NLSLINKS_fr_FR.UTF-8 = fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8
78NLSLINKS_it_IT.UTF-8 = it_CH.UTF-8
79
80.if ${MK_NLS_CATALOGS} == "no" || defined(RESCUE)
81CFLAGS+= -DNO_NLS_CATALOGS
82.else
83CFLAGS+= -DHAVE_ICONV
84.if ${MK_ICONV} != "no"
85NLSLINKS_de_DE.UTF-8 += de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
86		de_CH.ISO8859-15 de_DE.ISO8859-1 de_DE.ISO8859-15
87NLSLINKS_el_GR.UTF-8 = el_GR.ISO8859-7
88NLSLINKS_es_ES.UTF-8 = es_ES.ISO8859-1 es_ES.ISO8859-15
89NLSLINKS_et_EE.UTF-8 = et_EE.ISO8859-15
90NLSLINKS_fi_FI.UTF-8 = fi_FI.ISO8859-1 fi_FI.ISO8859-15
91NLSLINKS_fr_FR.UTF-8 += fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
92		fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 \
93		fr_CH.ISO8859-15 fr_FR.ISO8859-1 fr_FR.ISO8859-15
94NLSLINKS_it_IT.UTF-8 += it_CH.ISO8859-1 it_CH.ISO8859-15 it_IT.ISO8859-1 \
95		it_IT.ISO8859-15
96NLSLINKS_ja_JP.UTF-8 = ja_JP.SJIS ja_JP.eucJP
97NLSLINKS_ru_RU.UTF-8 = ru_RU.CP1251 ru_RU.CP866 ru_RU.ISO8859-5 ru_RU.KOI8-R
98NLSLINKS_uk_UA.UTF-8 = uk_UA.ISO8859-5 uk_UA.KOI8-U
99.else
100# Above links can be installed from ports/shells/tcsh_nls
101
102GENHDRS+= iconv.h
103SRCS+=	iconv_stub.c
104
105iconv.h: ${.CURDIR}/iconv_stub.h
106	${CP} ${.CURDIR}/iconv_stub.h ${.TARGET}
107.endif
108.endif
109
110NLSNAME= tcsh
111
112.for catalog in ${CATALOGS}
113NLS+=		${catalog:C/.*://}
114NLSSRCDIR_${catalog:C/.*://}= ${TCSHDIR}/nls/${catalog:C/:.*//}
115NLSSRCFILES_${catalog:C/.*://}!= cd ${NLSSRCDIR_${catalog:C/.*://}}; echo charset set[0-9]*
116.endfor
117
118csh.1: tcsh.man
119	cat ${.ALLSRC} > ${.TARGET}
120
121.if ${MACHINE} == "host" || ${MK_DIRDEPS_BUILD} == "no"
122build-tools: gethost
123tc.defs.c: gethost
124
125DEPENDOBJS+= gethost
126gethost: gethost.c sh.err.h tc.const.h sh.h ${BUILD_TOOLS_META}
127	@rm -f ${.TARGET}
128	${CC:N${CCACHE_BIN}} -o gethost ${LDFLAGS} ${CFLAGS:C/-DHAVE_ICONV//} \
129	    ${TCSHDIR}/gethost.c
130.endif
131
132tc.defs.c: ${TCSHDIR}/host.defs
133	@rm -f ${.TARGET}
134	@echo "/* Do not edit this file, make creates it */" > ${.TARGET}
135	${BTOOLSPATH:U.}/gethost ${TCSHDIR}/host.defs >> ${.TARGET}
136
137ed.defns.h: ed.defns.c
138	@rm -f ${.TARGET}
139	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
140	@echo '#ifndef _h_ed_defns' >> ${.TARGET}
141	@echo '#define _h_ed_defns' >> ${.TARGET}
142	grep '[FV]_' ${TCSHDIR}/ed.defns.c | grep '^#define' >> ${.TARGET}
143	@echo '#endif /* _h_ed_defns */' >> ${.TARGET}
144
145sh.err.h: sh.err.c
146	@rm -f ${.TARGET}
147	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
148	@echo '#ifndef _h_sh_err' >> ${.TARGET}
149	@echo '#define _h_sh_err' >> ${.TARGET}
150	grep 'ERR_' ${.ALLSRC} | grep '^#define' >> ${.TARGET}
151	@echo '#endif /* _h_sh_err */' >> ${.TARGET}
152
153tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h ${BUILD_TOOLS_META}
154	@rm -f ${.TARGET}
155	@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
156	@echo '#ifndef _h_tc_const' >> ${.TARGET}
157	@echo '#define _h_tc_const' >> ${.TARGET}
158	${CC:N${CCACHE_BIN}} -E ${CFLAGS:C/-DHAVE_ICONV//} ${.ALLSRC} -D_h_tc_const | \
159	    grep 'Char STR' | \
160	    sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
161	    sort >> ${.TARGET}
162	@echo '#endif /* _h_tc_const */' >> ${.TARGET}
163
164beforeinstallconfig:
165	rm -f ${DESTDIR}/.cshrc
166
167afterinstallconfig:
168	# XXX Set link mode explicitly via -m.  We cannot use LINKMODE for this
169	# link, as it would also apply to the tcsh link above.
170	${INSTALL_LINK} ${TAG_ARGS} -m ${CONFMODE} ${DESTDIR}/root/.cshrc \
171	    ${DESTDIR}/.cshrc
172
173.include <bsd.prog.mk>
174