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