1*710SmarkVERSION=3.5
2464Smark#
3558Smark# Ex skeletal makefile for VAX VM/Unix version 7
4464Smark#
5464Smark# NB: This makefile doesn't indicate any dependencies on header files.
6464Smark#
7558Smark# Ex is very large - this version will not fit on PDP-11's without overlay
8558Smark# software.  Things that can be turned off to save
9485Smark# space include LISPCODE (-l flag, showmatch and lisp options), UCVISUAL
10485Smark# (visual \ nonsense on upper case only terminals), CHDIR (the undocumented
11*710Smark# chdir command.)  CRYPT includes the code to edit encrypted files (the -x
12*710Smark# option, like ed.)  VMUNIX makes ex considerably larger, raising many limits
13558Smark# and improving speed and simplicity of maintenance.  It is suitable only
14558Smark# for a VAX or other large machine, and then probably only in a paged system.
15464Smark#
16485Smark# Don't define VFORK unless your system has the VFORK system call,
17485Smark# which is like fork but the two processes have only one data space until the
18485Smark# child execs. This speeds up ex by saving the memory copy.
19485Smark#
20464Smark# If your system expands tabs to 4 spaces you should -DTABS=4 below
21464Smark#
22485SmarkBINDIR=	/usr/ucb
23485SmarkNBINDIR=/usr/new
24464SmarkLIBDIR=	/usr/lib
25485SmarkFOLD=	${BINDIR}/fold
26485SmarkCTAGS=	${BINDIR}/ctags
27485SmarkXSTR=	${BINDIR}/xstr
28558SmarkDEBUGFLAGS=	-DTRACE -g
29681SmarkNONDEBUGFLAGS=	-O
30558SmarkDEB=	${NONDEBUGFLAGS}	# or ${DEBUGFLAGS} to to debug
31681SmarkCFLAGS=	-DTABS=8 -DCRYPT -DLISPCODE -DCHDIR -DUCVISUAL -DVFORK -DVMUNIX ${DEB}
32558SmarkLDFLAGS=	-z		# or -i or -n
33485SmarkTERMLIB=	-ltermlib
34485SmarkMKSTR=	${BINDIR}/mkstr
35485SmarkCXREF=	${BINDIR}/cxref
36464SmarkINCLUDE=/usr/include
37464SmarkPR=	pr
38558SmarkOBJS=	ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o \
39558Smark	ex_data.o ex_get.o ex_io.o ex_put.o ex_re.o \
40558Smark	ex_set.o ex_subr.o ex_temp.o ex_tty.o ex_unix.o \
41464Smark	ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voperate.o \
42464Smark	ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
43681Smark	printf.o bcopy.o strings.o
44558SmarkHDRS=	ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
45558SmarkSRC1=	ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c
46558SmarkSRC2=	ex_data.c ex_get.c ex_io.c ex_put.c ex_re.c
47558SmarkSRC3=	ex_set.c ex_subr.c ex_temp.c ex_tty.c ex_unix.c
48558SmarkSRC4=	ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voperate.c
49558SmarkSRC5=	ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c
50681SmarkSRC6=	printf.c bcopy.c expreserve.c exrecover.c
51558SmarkMISC=	makefile READ_ME :rofix
52558SmarkVGRIND=	csh /usr/ucb/vgrind
53558SmarkVHDR=	"Ex Version ${VERSION}"
54464Smark
55485Smark.c.o:
56485Smark#	${MKSTR} - ex${VERSION}strings x $*.c
57485Smark	${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
58485Smark#	rm -f x$*.c
59485Smark	${CC} ${CFLAGS} -c x.c
60485Smark	mv x.o $*.o
61464Smark
62485Smarka.out: ${OBJS}
63576Sbill	${CC} ${LDFLAGS} ${OBJS} ${TERMLIB}
64485Smark
65558Smarkall:	a.out exrecover expreserve tags
66464Smark
67558Smarktags:	/tmp
68558Smark	${CTAGS} -w ex.[hc] ex_*.[hc]
69558Smark
70485Smark${OBJS}: ex_vars.h
71485Smark
72566Smark# ex_vars.h:
73566Smark# 	csh makeoptions ${CFLAGS}
74485Smark
75558Smarkbcopy.o:	bcopy.c
76576Sbill	${CC} -c ${CFLAGS} bcopy.c
77558Smark
78558Smark# xstr: hands off!
79464Smarkstrings.o: strings
80464Smark	${XSTR}
81485Smark	${CC} -c -S xs.c
82485Smark	ed - <:rofix xs.s
83576Sbill	${AS} -o strings.o xs.s
84485Smark	rm xs.s
85464Smark
86464Smarkexrecover: exrecover.o
87485Smark	${CC} ${CFLAGS} exrecover.o -o exrecover
88464Smark
89485Smarkexrecover.o: exrecover.c
90464Smark	${CC} ${CFLAGS} -c -O exrecover.c
91464Smark
92485Smarkexpreserve: expreserve.o
93485Smark	${CC} expreserve.o -o expreserve
94464Smark
95464Smarkexpreserve.o:
96485Smark	${CC} ${CFLAGS} -c -O expreserve.c
97464Smark
98576Sbillclean:
99485Smark#	If we dont have ex we cant make it so dont rm ex_vars.h
100558Smark	-rm -f a.out exrecover expreserve strings core errs trace
101485Smark	-rm -f *.o x*.[cs]
102464Smark
103558Smark# install a new version for testing in /usr/new
104485Smarkninstall: a.out
105558Smark	-rm -f ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi ${DESTDIR}${NBINDIR}/view
106558Smark	cp a.out ${DESTDIR}${NBINDIR}/ex
107485Smark#	-cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
108558Smark	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi
109534Smark	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/view
110558Smark	chmod 1755 ${DESTDIR}${NBINDIR}/ex
111464Smark
112558Smark# install in standard place (/usr/ucb)
113485Smarkinstall: a.out exrecover expreserve
114485Smark	-rm -f ${DESTDIR}${BINDIR}/ex
115485Smark	-rm -f ${DESTDIR}${BINDIR}/vi
116534Smark	-rm -f ${DESTDIR}${BINDIR}/view
117485Smark	-rm -f ${DESTDIR}${BINDIR}/edit
118485Smark	-rm -f ${DESTDIR}${BINDIR}/e
119485Smark	-rm -f ${DESTDIR}/usr/bin/ex
120485Smark	cp a.out ${DESTDIR}${BINDIR}/ex
121485Smark#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
122485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
123485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
124485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
125534Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/view
126485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
127485Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
128485Smark	cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
129558Smark	cp expreserve ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
130485Smark	chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
131558Smark# The following line normally fails.  This is OK.
132485Smark	mkdir ${DESTDIR}/usr/preserve
133464Smark
134558Smark# move from /usr/new to /usr/ucb
135558Smarknewucb: a.out
136558Smark	-rm -f ${DESTDIR}${BINDIR}/ex
137558Smark	-rm -f ${DESTDIR}${BINDIR}/vi
138558Smark	-rm -f ${DESTDIR}${BINDIR}/edit
139558Smark	-rm -f ${DESTDIR}${BINDIR}/e
140558Smark	-rm -f ${DESTDIR}/usr/bin/ex
141558Smark	mv ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/ex
142558Smark	-rm -f ${DESTDIR}${NBINDIR}/vi
143558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
144558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
145558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
146558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
147558Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
148558Smark
149464Smarklint:
150558Smark	lint ${CFLAGS} ex.c ex_?*.c
151558Smark	lint ${CFLAGS} -u exrecover.c
152558Smark	lint ${CFLAGS} expreserve.c
153464Smark
154464Smarkprint:
155464Smark	@${PR} READ* BUGS
156485Smark	@${PR} makefile*
157485Smark	@${PR} /etc/termcap
158464Smark	@(size -l a.out ; size *.o) | ${PR} -h sizes
159464Smark	@${PR} -h errno.h ${INCLUDE}/errno.h
160464Smark	@${PR} -h setjmp.h ${INCLUDE}/setjmp.h
161464Smark	@${PR} -h sgtty.h ${INCLUDE}/sgtty.h
162464Smark	@${PR} -h signal.h ${INCLUDE}/signal.h
163464Smark	@${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
164464Smark	@${PR} -h sys/types.h ${INCLUDE}/sys/types.h
165464Smark	@ls -ls | ${PR}
166464Smark	@${CXREF} *.c | ${PR} -h XREF
167464Smark	@${PR} *.h *.c
168558Smarkvgrind:
169558Smark	tee index < /dev/null
170558Smark#	${VGRIND} -h ${VHDR} ${HDRS}
171558Smark#	${VGRIND} -h ${VHDR} ${SRC1}
172558Smark#	${VGRIND} -h ${VHDR} ${SRC2}
173558Smark	${VGRIND} -h ${VHDR} ${SRC3}
174558Smark	${VGRIND} -h ${VHDR} ${SRC4}
175558Smark	${VGRIND} -h ${VHDR} ${SRC5}
176558Smark	${VGRIND} -h ${VHDR} ${SRC6}
177558Smark#	${VGRIND} -n -h ${VHDR} ${MISC}
178558Smark	${VGRIND} -i -h ${VHDR} index
179564Smark
180565Smarkex.c: SCCS/s.ex.c ${HDRS}; rm -f ex.c; sccs get ex.c
181565Smarkex.h: SCCS/s.ex.h; rm -f ex.h; sccs get ex.h
182565Smarkex_addr.c: SCCS/s.ex_addr.c; rm -f ex_addr.c; sccs get ex_addr.c
183565Smarkex_argv.h: SCCS/s.ex_argv.h; rm -f ex_argv.h; sccs get ex_argv.h
184565Smarkex_cmds.c: SCCS/s.ex_cmds.c; rm -f ex_cmds.c; sccs get ex_cmds.c
185565Smarkex_cmds2.c: SCCS/s.ex_cmds2.c; rm -f ex_cmds2.c; sccs get ex_cmds2.c
186565Smarkex_cmdsub.c: SCCS/s.ex_cmdsub.c; rm -f ex_cmdsub.c; sccs get ex_cmdsub.c
187565Smarkex_data.c: SCCS/s.ex_data.c; rm -f ex_data.c; sccs get ex_data.c
188565Smarkex_get.c: SCCS/s.ex_get.c; rm -f ex_get.c; sccs get ex_get.c
189565Smarkex_io.c: SCCS/s.ex_io.c; rm -f ex_io.c; sccs get ex_io.c
190565Smarkex_put.c: SCCS/s.ex_put.c; rm -f ex_put.c; sccs get ex_put.c
191565Smarkex_re.c: SCCS/s.ex_re.c; rm -f ex_re.c; sccs get ex_re.c
192565Smarkex_re.h: SCCS/s.ex_re.h; rm -f ex_re.h; sccs get ex_re.h
193565Smarkex_set.c: SCCS/s.ex_set.c; rm -f ex_set.c; sccs get ex_set.c
194565Smarkex_subr.c: SCCS/s.ex_subr.c; rm -f ex_subr.c; sccs get ex_subr.c
195565Smarkex_temp.c: SCCS/s.ex_temp.c; rm -f ex_temp.c; sccs get ex_temp.c
196565Smarkex_temp.h: SCCS/s.ex_temp.h; rm -f ex_temp.h; sccs get ex_temp.h
197565Smarkex_tty.c: SCCS/s.ex_tty.c; rm -f ex_tty.c; sccs get ex_tty.c
198565Smarkex_tty.h: SCCS/s.ex_tty.h; rm -f ex_tty.h; sccs get ex_tty.h
199565Smarkex_tune.h: SCCS/s.ex_tune.h; rm -f ex_tune.h; sccs get ex_tune.h
200564Smarkex_unix.c: SCCS/s.ex_unix.c; rm -f ex_unix.c; sccs get ex_unix.c
201565Smarkex_v.c: SCCS/s.ex_v.c; rm -f ex_v.c; sccs get ex_v.c
202565Smarkex_vadj.c: SCCS/s.ex_vadj.c; rm -f ex_vadj.c; sccs get ex_vadj.c
203565Smarkex_vars.h: SCCS/s.ex_vars.h; rm -f ex_vars.h; sccs get ex_vars.h
204565Smarkex_vget.c: SCCS/s.ex_vget.c; rm -f ex_vget.c; sccs get ex_vget.c
205565Smarkex_vis.h: SCCS/s.ex_vis.h; rm -f ex_vis.h; sccs get ex_vis.h
206565Smarkex_vmain.c: SCCS/s.ex_vmain.c; rm -f ex_vmain.c; sccs get ex_vmain.c
207564Smarkex_voperate.c: SCCS/s.ex_voperate.c; rm -f ex_voperate.c; sccs get ex_voperate.c
208565Smarkex_vops.c: SCCS/s.ex_vops.c; rm -f ex_vops.c; sccs get ex_vops.c
209565Smarkex_vops2.c: SCCS/s.ex_vops2.c; rm -f ex_vops2.c; sccs get ex_vops2.c
210565Smarkex_vops3.c: SCCS/s.ex_vops3.c; rm -f ex_vops3.c; sccs get ex_vops3.c
211565Smarkex_vput.c: SCCS/s.ex_vput.c; rm -f ex_vput.c; sccs get ex_vput.c
212565Smarkex_vwind.c: SCCS/s.ex_vwind.c; rm -f ex_vwind.c; sccs get ex_vwind.c
213565Smarkexpreserve.c: SCCS/s.expreserve.c; rm -f expreserve.c; sccs get expreserve.c
214565Smarkexrecover.c: SCCS/s.exrecover.c; rm -f exrecover.c; sccs get exrecover.c
215565Smarkmakeoptions: SCCS/s.makeoptions; rm -f makeoptions; sccs get makeoptions
216564Smarkbcopy.c: SCCS/s.bcopy.c; rm -f bcopy.c; sccs get bcopy.c
217565Smarkprintf.c: SCCS/s.printf.c; rm -f printf.c; sccs get printf.c
218