xref: /freebsd/usr.bin/vi/Makefile (revision ff5fcc93d41b91987f974b2afeb857e5bb7400c6)
1#
2# $Id: Makefile,v 1.22 1998/06/09 04:07:20 imp 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_BUILD_FIXIT)
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	#needs the perl5 v5.003 port
20
21APISTUFF=	ex_tcl.c ex_perl.c
22
23# Any better ideas?
24#PERL=		/usr/local/bin/perl5.003
25#CFLAGS+=	-DHAVE_PERL_5_003_01	# If perl >= 5.03.01
26
27.endif
28
29CFLAGS+=	-DGTAGS
30
31#if using ncurses:
32#CFLAGS+=	-DSYSV_CURSES
33
34VI=	nvi
35EX=	nex
36VIEW=	nview
37
38PROG=	nvi
39
40LINKS=	${BINDIR}/${VI} ${BINDIR}/${EX} ${BINDIR}/${VI} ${BINDIR}/${VIEW}
41LINKS+= ${BINDIR}/${VI} ${BINDIR}/vi ${BINDIR}/${EX} ${BINDIR}/ex
42LINKS+= ${BINDIR}/${VI} ${BINDIR}/view
43
44MAN1=	${SRCDIR}/docs/USD.doc/vi.man/vi.1
45MLINKS+=vi.1 ex.1 vi.1 view.1
46MLINKS+=vi.1 nex.1 vi.1 nview.1 vi.1 nvi.1
47
48CATALOGS= dutch english french german polish ru_SU.KOI8-R spanish swedish
49NLLINKS= nl_NL
50ENLINKS= en_AU en_CA en_GB en_US
51FRLINKS= fr_BE fr_CA fr_CH fr_FR
52DELINKS= de_AT de_CH de_DE
53ESLINKS= es_ES
54SVLINKS= sv_SE
55PLLINKS= pl_PL
56
57.PATH:	${SRCDIR}/common
58.PATH:	${SRCDIR}/ex
59.PATH:	${SRCDIR}/cl
60.PATH:	${SRCDIR}/vi
61
62CFLAGS+=-I${.CURDIR} -I${SRCDIR} -I${SRCDIR}/include
63
64.if !defined(TKNVI)
65DPADD+=		${LIBCURSES} ${LIBTERMCAP}
66LDADD+=		-lcurses -ltermcap
67.endif
68
69.if defined(TKNVI)
70.PATH:		${SRCDIR}/tk
71LDADD+=		-L/usr/local/lib -L/usr/X11R6/lib -ltk41 -lX11
72CFLAGS+=	-I/usr/local/include -I/usr/X11R6/include
73.endif
74
75.if defined(TCLINTERP)
76.PATH:		${SRCDIR}/tcl_api
77DPADD+=		${LIBTCL} ${LIBM}
78LDADD+=		-ltcl -lm
79CFLAGS+=	-DHAVE_TCL_INTERP -I${DESTDIR}/usr/include/tcl
80.endif
81
82.if defined(PERLINTERP)
83.PATH:		${SRCDIR}/perl_api
84
85# Perl "knows" how to compile it's components. Ask it for details...
86PERLLIB!=	${PERL} -MConfig -e 'print $$Config{privlib}'
87PERLCPPFLAGS!=	cd ${SRCDIR}/build; ${PERL} -MExtUtils::Embed -e 'ccflags;perl_inc'
88PERLLIBS!=	cd ${SRCDIR}/build; ${PERL} -MExtUtils::Embed -e 'ldopts'
89PERLLDFLAGS!=	cd ${SRCDIR}/build; ${PERL} -MExtUtils::Embed -e 'ccdlflags'
90
91LDADD+=	 ${PERLLDFLAGS} ${PERLLIBS}
92CFLAGS+= -DHAVE_PERL_INTERP ${PERLCPPFLAGS}
93
94.endif
95
96CLEANFILES+=${EX}
97
98# Vi curses sources
99.if !defined(TKNVI)
100SRCS+=	cl_bsd.c cl_funcs.c cl_main.c cl_read.c cl_screen.c cl_term.c
101.endif
102
103# Vi Tk sources
104.if defined(TKNVI)
105SRCS+=	tk_funcs.c tk_main.c tk_read.c tk_screen.c tk_term.c tk_util.c
106.endif
107
108# Vi Tcl/Perl interpreter sources
109.if defined(TCLINTERP) || defined(PERLINTERP)
110SRCS+=	api.c
111.endif
112.if defined(TCLINTERP)
113SRCS+=	tcl.c
114.endif
115.if defined(PERLINTERP)
116# perl.c is generated
117SRCS+=	perl.c perlsfio.c
118.endif
119
120# General sources.
121SRCS+=	cut.c delete.c exf.c key.c line.c log.c main.c mark.c msg.c options.c \
122	options_f.c put.c screen.c search.c seq.c recover.c util.c
123
124# Ex source.
125SRCS+=	ex.c ex_abbrev.c ex_append.c ex_args.c ex_argv.c ex_at.c ex_bang.c \
126	ex_cd.c ex_cmd.c ex_cscope.c ex_delete.c ex_display.c \
127	ex_edit.c ex_equal.c ex_file.c ex_filter.c ex_global.c \
128	ex_init.c ex_join.c ex_map.c ex_mark.c ex_mkexrc.c ex_move.c \
129	ex_open.c ex_preserve.c ex_print.c ex_put.c ex_quit.c \
130	ex_read.c ex_screen.c ex_script.c ex_set.c ex_shell.c \
131	ex_shift.c ex_source.c ex_stop.c ex_subst.c ex_tag.c \
132	ex_txt.c ex_undo.c ex_usage.c ex_util.c ex_version.c ex_visual.c \
133	ex_write.c ex_yank.c ex_z.c ${APISTUFF}
134
135# Vi source.
136SRCS+=	getc.c v_at.c v_ch.c v_cmd.c v_delete.c v_ex.c v_increment.c v_init.c \
137	v_itxt.c v_left.c v_mark.c v_match.c v_paragraph.c v_put.c v_redraw.c \
138	v_replace.c v_right.c v_screen.c v_scroll.c v_search.c v_section.c \
139	v_sentence.c v_status.c v_txt.c v_ulcase.c v_undo.c \
140	v_util.c v_word.c v_xchar.c v_yank.c v_z.c v_zexit.c vi.c
141
142# Vi screen source.
143SRCS+=	vs_line.c vs_msg.c vs_refresh.c vs_relative.c vs_smap.c vs_split.c
144
145# Generate perl.c
146.if defined(PERLINTERP)
147perl.c:	perl.xs typemap
148	echo "#define _PATH_PERLSCRIPTS \"/usr/share/vi/perl\"" > ${.TARGET}
149	$(PERL) $(PERLLIB)/ExtUtils/xsubpp -typemap \
150	    $(PERLLIB)/ExtUtils/typemap $(SRCDIR)/perl_api/perl.xs >> ${.TARGET}
151	($(PERL) -ne 'print "sub $$1 {\$$curscr->$$1(\@_)}\n" \
152	    if /newXS\("VI::([^":]*)"/;' $@ ; echo "1;") > VI.pm
153
154CLEANFILES+=	VI.pm perl.c
155.endif
156
157# unifdef has some *weird* exit codes, sigh!  RTFM unifdef(1)...
158ex_notcl.c: ex_tcl.c
159	-unifdef -UHAVE_TCL_INTERP ${SRCDIR}/ex/ex_tcl.c > ${.TARGET}
160
161ex_noperl.c: ex_perl.c
162	-unifdef -UHAVE_PERL_INTERP ${SRCDIR}/ex/ex_perl.c > ${.TARGET}
163
164CLEANFILES+=	ex_notcl.c ex_noperl.c
165
166afterinstall:
167	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
168		${CATALOGS:S;^;${SRCDIR}/catalog/;} \
169		${DESTDIR}/usr/share/vi/catalog
170	for l in ${NLLINKS}; do \
171		ln -fs dutch ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
172	done
173	for l in ${ENLINKS}; do \
174		ln -fs english ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
175	done
176	ln -fs english ${DESTDIR}/usr/share/vi/catalog/us-ascii
177	for l in ${FRLINKS}; do \
178		ln -fs french ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
179	done
180	for l in ${DELINKS}; do \
181		ln -fs german ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
182	done
183	for l in ${ESLINKS}; do \
184		ln -fs spanish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
185	done
186	for l in ${SVLINKS}; do \
187		ln -fs swedish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \
188	done
189	for l in ${PLLINKS}; do \
190		ln -fs polish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-2; \
191	done
192	ln -fs ru_SU.KOI8-R ${DESTDIR}/usr/share/vi/catalog/ru_RU.KOI8-R
193	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
194		${SRCDIR}/tcl_scripts/*.tcl \
195		${DESTDIR}/usr/share/vi/tcl
196	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
197		${SRCDIR}/perl_scripts/*.pl \
198		${DESTDIR}/usr/share/vi/perl
199.if defined(PERLINTERP)
200	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 444 VI.pm \
201		${DESTDIR}/usr/share/vi/perl
202.endif
203
204.include <bsd.prog.mk>
205