Initial import from FreeBSD RELENG_4:
[dragonfly.git] / usr.bin / vi / Makefile
CommitLineData
984263bc
MD
1#
2# $FreeBSD: src/usr.bin/vi/Makefile,v 1.27.2.7 2002/08/07 16:32:01 ru Exp $
3#
4# This has most of the glue needed to compile tknvi and the perl hooks,
5# but not all.
6#
7
8SRCDIR= ${.CURDIR}/../../contrib/nvi
9
10.if defined(RELEASE_CRUNCH)
11# When building `vi' for the fixit floppy, don't include any of the
12# API stuff.
13APISTUFF= ex_notcl.c ex_noperl.c
14
15.else
16
17#TCLINTERP= yes #we don't have it in the base tree
18#TKNVI= yes #not ready, needs X11, tk, doesn't quite work yet
19#PERLINTERP= yes #works if perl has no thread support built in
20
21APISTUFF= ex_tcl.c ex_perl.c
22
23.if defined(PERLINTERP)
24PERL?= /usr/bin/perl5
25CFLAGS+= -DHAVE_PERL_5_003_01 # If perl >= 5.03.01
26.endif
27
28.endif
29
30CFLAGS+= -DGTAGS
31
32#if using ncurses:
33CFLAGS+= -DSYSV_CURSES
34
35VI= nvi
36EX= nex
37VIEW= nview
38
39PROG= nvi
40
41LINKS= ${BINDIR}/${VI} ${BINDIR}/${EX} ${BINDIR}/${VI} ${BINDIR}/${VIEW}
42LINKS+= ${BINDIR}/${VI} ${BINDIR}/vi ${BINDIR}/${EX} ${BINDIR}/ex
43LINKS+= ${BINDIR}/${VI} ${BINDIR}/view
44
45MAN= ${SRCDIR}/docs/USD.doc/vi.man/vi.1
46MLINKS+=vi.1 ex.1 vi.1 view.1
47MLINKS+=vi.1 nex.1 vi.1 nview.1 vi.1 nvi.1
48
49CATALOGS= dutch english french german polish ru_SU.KOI8-R spanish swedish \
50 uk_UA.KOI8-U
51NLLINKS= nl_NL
52ENLINKS= en_AU en_CA en_GB en_US
53FRLINKS= fr_BE fr_CA fr_CH fr_FR
54DELINKS= de_AT de_CH de_DE
55ESLINKS= es_ES
56SVLINKS= sv_SE
57PLLINKS= pl_PL
58
59.PATH: ${SRCDIR}/common
60.PATH: ${SRCDIR}/ex
61.PATH: ${SRCDIR}/cl
62.PATH: ${SRCDIR}/vi
63
64CFLAGS+=-I${.CURDIR} -I${SRCDIR} -I${SRCDIR}/include
65
66.if !defined(TKNVI)
67DPADD+= ${LIBNCURSES}
68LDADD+= -lncurses
69
70.else
71
72.PATH: ${SRCDIR}/tk
73LDADD+= -L/usr/local/lib -L/usr/X11R6/lib -ltk41 -lX11
74CFLAGS+= -I/usr/local/include -I/usr/X11R6/include
75.endif
76
77.if defined(TCLINTERP)
78.PATH: ${SRCDIR}/tcl_api
79DPADD+= ${LIBTCL} ${LIBM}
80LDADD+= -ltcl -lm
81CFLAGS+= -DHAVE_TCL_INTERP -I${DESTDIR}/usr/include/tcl
82.endif
83
84.if defined(PERLINTERP)
85.PATH: ${SRCDIR}/perl_api
86
87# Perl "knows" how to compile its components. Ask it for details...
88PERLLIB!= ${PERL} -MConfig -e 'print $$Config{privlib}'
89PERLCPPFLAGS!= cd ${SRCDIR}/build; ${PERL} -MExtUtils::Embed -e 'ccflags;perl_inc'
90PERLLIBS!= cd ${SRCDIR}/build; ${PERL} -MExtUtils::Embed -e 'ldopts'
91PERLLDFLAGS!= cd ${SRCDIR}/build; ${PERL} -MExtUtils::Embed -e 'ccdlflags'
92
93LDADD+= ${PERLLDFLAGS} ${PERLLIBS}
94CFLAGS+= -DHAVE_PERL_INTERP ${PERLCPPFLAGS}
95
96.endif
97
98CLEANFILES+=${EX}
99
100# Vi curses sources
101.if !defined(TKNVI)
102SRCS+= cl_bsd.c cl_funcs.c cl_main.c cl_read.c cl_screen.c cl_term.c
103.endif
104
105# Vi Tk sources
106.if defined(TKNVI)
107SRCS+= tk_funcs.c tk_main.c tk_read.c tk_screen.c tk_term.c tk_util.c
108.endif
109
110# Vi Tcl/Perl interpreter sources
111.if defined(TCLINTERP) || defined(PERLINTERP)
112SRCS+= api.c
113.endif
114.if defined(TCLINTERP)
115SRCS+= tcl.c
116.endif
117.if defined(PERLINTERP)
118# perl.c is generated
119SRCS+= perl.c perlsfio.c
120.endif
121
122# General sources.
123SRCS+= cut.c delete.c exf.c key.c line.c log.c main.c mark.c msg.c options.c \
124 options_f.c put.c screen.c search.c seq.c recover.c util.c
125
126# Ex source.
127SRCS+= ex.c ex_abbrev.c ex_append.c ex_args.c ex_argv.c ex_at.c ex_bang.c \
128 ex_cd.c ex_cmd.c ex_cscope.c ex_delete.c ex_display.c \
129 ex_edit.c ex_equal.c ex_file.c ex_filter.c ex_global.c \
130 ex_init.c ex_join.c ex_map.c ex_mark.c ex_mkexrc.c ex_move.c \
131 ex_open.c ex_preserve.c ex_print.c ex_put.c ex_quit.c \
132 ex_read.c ex_screen.c ex_script.c ex_set.c ex_shell.c \
133 ex_shift.c ex_source.c ex_stop.c ex_subst.c ex_tag.c \
134 ex_txt.c ex_undo.c ex_usage.c ex_util.c ex_version.c ex_visual.c \
135 ex_write.c ex_yank.c ex_z.c ${APISTUFF}
136
137# Vi source.
138SRCS+= getc.c v_at.c v_ch.c v_cmd.c v_delete.c v_ex.c v_increment.c v_init.c \
139 v_itxt.c v_left.c v_mark.c v_match.c v_paragraph.c v_put.c v_redraw.c \
140 v_replace.c v_right.c v_screen.c v_scroll.c v_search.c v_section.c \
141 v_sentence.c v_status.c v_txt.c v_ulcase.c v_undo.c \
142 v_util.c v_word.c v_xchar.c v_yank.c v_z.c v_zexit.c vi.c
143
144# Vi screen source.
145SRCS+= vs_line.c vs_msg.c vs_refresh.c vs_relative.c vs_smap.c vs_split.c
146
147# Generate perl.c
148.if defined(PERLINTERP)
149perl.c: perl.xs typemap
150 echo "#define _PATH_PERLSCRIPTS \"/usr/share/vi/perl\"" > ${.TARGET}
151 $(PERL) $(PERLLIB)/ExtUtils/xsubpp -typemap \
152 $(PERLLIB)/ExtUtils/typemap $(SRCDIR)/perl_api/perl.xs >> ${.TARGET}
153 ($(PERL) -ne 'print "sub $$1 {\$$curscr->$$1(\@_)}\n" \
154 if /newXS\("VI::([^":]*)"/;' $@ ; echo "1;") > VI.pm
155
156CLEANFILES+= VI.pm perl.c
157.endif
158
159# unifdef has some *weird* exit codes, sigh! RTFM unifdef(1)...
160ex_notcl.c: ex_tcl.c
161 -unifdef -UHAVE_TCL_INTERP ${SRCDIR}/ex/ex_tcl.c > ${.TARGET}
162
163ex_noperl.c: ex_perl.c
164 -unifdef -UHAVE_PERL_INTERP ${SRCDIR}/ex/ex_perl.c > ${.TARGET}
165
166CLEANFILES+= ex_notcl.c ex_noperl.c
167
168afterinstall:
169 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
170 ${CATALOGS:S;^;${SRCDIR}/catalog/;} \
171 ${DESTDIR}/usr/share/vi/catalog
172 for l in ${NLLINKS}; do \
173 ln -fs dutch ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-1; \
174 ln -fs dutch ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
175 ln -fs dutch ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-15; \
176 ln -fs dutch ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-15; \
177 done
178 for l in ${ENLINKS}; do \
179 ln -fs english ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-1; \
180 ln -fs english ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
181 ln -fs english ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-15; \
182 ln -fs english ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-15; \
183 ln -fs english ${DESTDIR}/usr/share/vi/catalog/$$l.US-ASCII; \
184 done
185 ln -fs english ${DESTDIR}/usr/share/vi/catalog/en_US.US-ASCII
186 ln -fs english ${DESTDIR}/usr/share/vi/catalog/US-ASCII
187 ln -fs english ${DESTDIR}/usr/share/vi/catalog/ASCII
188 ln -fs english ${DESTDIR}/usr/share/vi/catalog/POSIX
189 ln -fs english ${DESTDIR}/usr/share/vi/catalog/C
190 for l in ${FRLINKS}; do \
191 ln -fs french ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-1; \
192 ln -fs french ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
193 ln -fs french ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-15; \
194 ln -fs french ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-15; \
195 done
196 for l in ${DELINKS}; do \
197 ln -fs german ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-1; \
198 ln -fs german ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
199 ln -fs german ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-15; \
200 ln -fs german ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-15; \
201 done
202 for l in ${ESLINKS}; do \
203 ln -fs spanish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-1; \
204 ln -fs spanish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
205 ln -fs spanish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-15; \
206 ln -fs spanish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-15; \
207 done
208 for l in ${SVLINKS}; do \
209 ln -fs swedish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-1; \
210 ln -fs swedish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
211 ln -fs swedish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-15; \
212 ln -fs swedish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-15; \
213 done
214 for l in ${PLLINKS}; do \
215 ln -fs polish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO8859-2; \
216 ln -fs polish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-2; \
217 done
218 ln -fs ru_SU.KOI8-R ${DESTDIR}/usr/share/vi/catalog/ru_RU.KOI8-R
219 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
220 ${SRCDIR}/tcl_scripts/*.tcl \
221 ${DESTDIR}/usr/share/vi/tcl
222 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
223 ${SRCDIR}/perl_scripts/*.pl \
224 ${DESTDIR}/usr/share/vi/perl
225.if defined(PERLINTERP)
226 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 VI.pm \
227 ${DESTDIR}/usr/share/vi/perl
228.endif
229
230.include <bsd.prog.mk>