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