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