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