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