changed INDEX operator to handle multiple subscript arrays correctly
[unix-history] / usr / src / usr.bin / ex / Makefile
CommitLineData
299f2784 1VERSION=3.7
fe10330d 2#
299f2784 3# Ex skeletal makefile for VAX VM/Unix 4.1BSD
fe10330d
MH
4#
5# NB: This makefile doesn't indicate any dependencies on header files.
6#
7c4625ef
MH
7# Ex is very large - this version will not fit on PDP-11's without overlay
8# software. Things that can be turned off to save
44232d5b
MH
9# space include LISPCODE (-l flag, showmatch and lisp options), UCVISUAL
10# (visual \ nonsense on upper case only terminals), CHDIR (the undocumented
b41bbcb5
MH
11# chdir command.) CRYPT includes the code to edit encrypted files (the -x
12# option, like ed.) VMUNIX makes ex considerably larger, raising many limits
7c4625ef
MH
13# and improving speed and simplicity of maintenance. It is suitable only
14# for a VAX or other large machine, and then probably only in a paged system.
44232d5b
MH
15#
16# Don't define VFORK unless your system has the VFORK system call,
17# which is like fork but the two processes have only one data space until the
18# child execs. This speeds up ex by saving the memory copy.
fe10330d
MH
19#
20# If your system expands tabs to 4 spaces you should -DTABS=4 below
21#
44232d5b
MH
22BINDIR= /usr/ucb
23NBINDIR=/usr/new
fe10330d 24LIBDIR= /usr/lib
44232d5b
MH
25FOLD= ${BINDIR}/fold
26CTAGS= ${BINDIR}/ctags
27XSTR= ${BINDIR}/xstr
f0f2d980 28DEBUGFLAGS= -DTRACE -g
7cc1f963 29NONDEBUGFLAGS= -O
7c4625ef 30DEB= ${NONDEBUGFLAGS} # or ${DEBUGFLAGS} to to debug
6fd7f32b
MH
31OPTIONS= -DCRYPT -DLISPCODE -DCHDIR -DUCVISUAL -DVFORK -DVMUNIX -DSTDIO
32CFLAGS= -DTABS=8 ${OPTIONS} ${DEB}
7c4625ef 33LDFLAGS= -z # or -i or -n
04379bab 34TERMLIB= -ltermcap
44232d5b
MH
35MKSTR= ${BINDIR}/mkstr
36CXREF= ${BINDIR}/cxref
fe10330d
MH
37INCLUDE=/usr/include
38PR= pr
7c4625ef 39OBJS= ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o \
299f2784 40 ex_data.o ex_extern.o ex_get.o ex_io.o ex_put.o ex_re.o \
7c4625ef 41 ex_set.o ex_subr.o ex_temp.o ex_tty.o ex_unix.o \
04379bab 42 ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voper.o \
fe10330d 43 ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
7cc1f963 44 printf.o bcopy.o strings.o
7c4625ef
MH
45HDRS= ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
46SRC1= ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c
47SRC2= ex_data.c ex_get.c ex_io.c ex_put.c ex_re.c
48SRC3= ex_set.c ex_subr.c ex_temp.c ex_tty.c ex_unix.c
04379bab 49SRC4= ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voper.c
7c4625ef 50SRC5= ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c
7cc1f963 51SRC6= printf.c bcopy.c expreserve.c exrecover.c
299f2784 52MISC= makefile READ_ME rofix
7c4625ef
MH
53VGRIND= csh /usr/ucb/vgrind
54VHDR= "Ex Version ${VERSION}"
44232d5b
MH
55
56.c.o:
04379bab 57# ifdef VMUNIX
44232d5b 58 ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
04379bab
MH
59# else
60# ${MKSTR} - ex${VERSION}strings x $*.c
61# ${CC} -E ${CFLAGS} x$*.c | ${XSTR} -c -
44232d5b 62# rm -f x$*.c
04379bab 63# endif
44232d5b
MH
64 ${CC} ${CFLAGS} -c x.c
65 mv x.o $*.o
fe10330d 66
44232d5b 67a.out: ${OBJS}
8bcf1431 68 ${CC} ${LDFLAGS} ${OBJS} ${TERMLIB}
fe10330d 69
7c4625ef
MH
70all: a.out exrecover expreserve tags
71
72tags: /tmp
73 ${CTAGS} -w ex.[hc] ex_*.[hc]
44232d5b
MH
74
75${OBJS}: ex_vars.h
76
c641812b
MH
77# ex_vars.h:
78# csh makeoptions ${CFLAGS}
fe10330d 79
7c4625ef 80bcopy.o: bcopy.c
8bcf1431 81 ${CC} -c ${CFLAGS} bcopy.c
7c4625ef
MH
82
83# xstr: hands off!
fe10330d
MH
84strings.o: strings
85 ${XSTR}
44232d5b 86 ${CC} -c -S xs.c
299f2784 87 ed - <rofix xs.s
8bcf1431 88 ${AS} -o strings.o xs.s
44232d5b 89 rm xs.s
fe10330d
MH
90
91exrecover: exrecover.o
93e88407 92 ${CC} ${CFLAGS} exrecover.o ex_extern.o -o exrecover
fe10330d 93
44232d5b 94exrecover.o: exrecover.c
fe10330d
MH
95 ${CC} ${CFLAGS} -c -O exrecover.c
96
44232d5b 97expreserve: expreserve.o
cb3ac212 98 ${CC} expreserve.o -o expreserve
fe10330d
MH
99
100expreserve.o:
44232d5b 101 ${CC} ${CFLAGS} -c -O expreserve.c
fe10330d 102
8bcf1431 103clean:
44232d5b 104# If we dont have ex we cant make it so dont rm ex_vars.h
7c4625ef 105 -rm -f a.out exrecover expreserve strings core errs trace
44232d5b 106 -rm -f *.o x*.[cs]
fe10330d 107
7c4625ef 108# install a new version for testing in /usr/new
44232d5b 109ninstall: a.out
7c4625ef
MH
110 -rm -f ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi ${DESTDIR}${NBINDIR}/view
111 cp a.out ${DESTDIR}${NBINDIR}/ex
44232d5b 112# -cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
7c4625ef 113 ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi
d266c416 114 ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/view
7c4625ef 115 chmod 1755 ${DESTDIR}${NBINDIR}/ex
fe10330d 116
7c4625ef 117# install in standard place (/usr/ucb)
44232d5b 118install: a.out exrecover expreserve
04379bab 119 strip a.out
44232d5b
MH
120 -rm -f ${DESTDIR}${BINDIR}/ex
121 -rm -f ${DESTDIR}${BINDIR}/vi
d266c416 122 -rm -f ${DESTDIR}${BINDIR}/view
44232d5b
MH
123 -rm -f ${DESTDIR}${BINDIR}/edit
124 -rm -f ${DESTDIR}${BINDIR}/e
125 -rm -f ${DESTDIR}/usr/bin/ex
126 cp a.out ${DESTDIR}${BINDIR}/ex
127# cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
128 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
129 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
130 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
d266c416 131 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/view
44232d5b
MH
132 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
133 chmod 1755 ${DESTDIR}${BINDIR}/ex
134 cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
7c4625ef 135 cp expreserve ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
44232d5b 136 chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
7c4625ef 137# The following line normally fails. This is OK.
04379bab 138 -mkdir ${DESTDIR}/usr/preserve
fe10330d 139
7c4625ef
MH
140# move from /usr/new to /usr/ucb
141newucb: a.out
142 -rm -f ${DESTDIR}${BINDIR}/ex
143 -rm -f ${DESTDIR}${BINDIR}/vi
144 -rm -f ${DESTDIR}${BINDIR}/edit
145 -rm -f ${DESTDIR}${BINDIR}/e
146 -rm -f ${DESTDIR}/usr/bin/ex
147 mv ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/ex
148 -rm -f ${DESTDIR}${NBINDIR}/vi
149 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
150 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
151 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
152 ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
153 chmod 1755 ${DESTDIR}${BINDIR}/ex
154
fe10330d 155lint:
7c4625ef
MH
156 lint ${CFLAGS} ex.c ex_?*.c
157 lint ${CFLAGS} -u exrecover.c
158 lint ${CFLAGS} expreserve.c
fe10330d
MH
159
160print:
fe10330d 161 @${PR} READ* BUGS
44232d5b
MH
162 @${PR} makefile*
163 @${PR} /etc/termcap
fe10330d 164 @(size -l a.out ; size *.o) | ${PR} -h sizes
fe10330d 165 @${PR} -h errno.h ${INCLUDE}/errno.h
fe10330d
MH
166 @${PR} -h setjmp.h ${INCLUDE}/setjmp.h
167 @${PR} -h sgtty.h ${INCLUDE}/sgtty.h
168 @${PR} -h signal.h ${INCLUDE}/signal.h
fe10330d
MH
169 @${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
170 @${PR} -h sys/types.h ${INCLUDE}/sys/types.h
171 @ls -ls | ${PR}
172 @${CXREF} *.c | ${PR} -h XREF
173 @${PR} *.h *.c
7c4625ef
MH
174vgrind:
175 tee index < /dev/null
5838215a
MH
176 ${VGRIND} -h ${VHDR} ${HDRS}
177 ${VGRIND} -h ${VHDR} ${SRC1}
178 ${VGRIND} -h ${VHDR} ${SRC2}
7c4625ef
MH
179 ${VGRIND} -h ${VHDR} ${SRC3}
180 ${VGRIND} -h ${VHDR} ${SRC4}
181 ${VGRIND} -h ${VHDR} ${SRC5}
182 ${VGRIND} -h ${VHDR} ${SRC6}
5838215a 183 ${VGRIND} -n -h ${VHDR} ${MISC}
7c4625ef 184 ${VGRIND} -i -h ${VHDR} index