1# 2# $Id: Makefile,v 1.21 1997/09/22 23:14:37 wosch 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.if !defined(NOTCL) 18#TCLINTERP= yes #we have it in the base tree, little cost to vi 19.endif 20#TKNVI= yes #not ready, needs X11, tk, doesn't quite work yet 21#PERLINTERP= yes #needs the perl5 v5.003 port 22 23APISTUFF= ex_tcl.c ex_perl.c 24 25# Any better ideas? 26#PERL= /usr/local/bin/perl5.003 27#CFLAGS+= -DHAVE_PERL_5_003_01 # If perl >= 5.03.01 28 29.endif 30 31CFLAGS+= -DGTAGS 32 33#if using ncurses: 34#CFLAGS+= -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 46MAN1= ${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 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+= ${LIBCURSES} ${LIBTERMCAP} 68LDADD+= -lcurses -ltermcap 69.endif 70 71.if defined(TKNVI) 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 it's 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} -c -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.ISO_8859-1; \ 174 done 175 for l in ${ENLINKS}; do \ 176 ln -fs english ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \ 177 done 178 ln -fs english ${DESTDIR}/usr/share/vi/catalog/us-ascii 179 for l in ${FRLINKS}; do \ 180 ln -fs french ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \ 181 done 182 for l in ${DELINKS}; do \ 183 ln -fs german ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \ 184 done 185 for l in ${ESLINKS}; do \ 186 ln -fs spanish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \ 187 done 188 for l in ${SVLINKS}; do \ 189 ln -fs swedish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-1; \ 190 done 191 for l in ${PLLINKS}; do \ 192 ln -fs polish ${DESTDIR}/usr/share/vi/catalog/$$l.ISO_8859-2; \ 193 done 194 ln -fs ru_SU.KOI8-R ${DESTDIR}/usr/share/vi/catalog/ru_RU.KOI8-R 195 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ 196 ${SRCDIR}/tcl_scripts/*.tcl \ 197 ${DESTDIR}/usr/share/vi/tcl 198 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ 199 ${SRCDIR}/perl_scripts/*.pl \ 200 ${DESTDIR}/usr/share/vi/perl 201.if defined(PERLINTERP) 202 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 444 VI.pm \ 203 ${DESTDIR}/usr/share/vi/perl 204.endif 205 206.include <bsd.prog.mk> 207