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