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