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