1534SmarkVERSION=3.4
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
11558Smark# chdir command.)  VMUNIX makes ex considerably larger, raising many limits
12558Smark# and improving speed and simplicity of maintenance.  It is suitable only
13558Smark# for a VAX or other large machine, and then probably only in a paged system.
14464Smark#
15485Smark# Don't define VFORK unless your system has the VFORK system call,
16485Smark# which is like fork but the two processes have only one data space until the
17485Smark# child execs. This speeds up ex by saving the memory copy.
18485Smark#
19464Smark# If your system expands tabs to 4 spaces you should -DTABS=4 below
20464Smark#
21485SmarkBINDIR=	/usr/ucb
22485SmarkNBINDIR=/usr/new
23464SmarkLIBDIR=	/usr/lib
24485SmarkFOLD=	${BINDIR}/fold
25485SmarkCTAGS=	${BINDIR}/ctags
26485SmarkXSTR=	${BINDIR}/xstr
27558SmarkDEBUGFLAGS=	-DTRACE -g
28558Smark#
29558Smark# D O   N O T   D I S T R I B U T E   E X    W I T H   H O R S E   I N   I T!!!
30558SmarkNONDEBUGFLAGS=	-O -DHORSE
31558SmarkDEB=	${NONDEBUGFLAGS}	# or ${DEBUGFLAGS} to to debug
32558SmarkCFLAGS=	-DTABS=8 -DLISPCODE -DCHDIR -DUCVISUAL -DVFORK -DVMUNIX ${DEB}
33558SmarkLDFLAGS=	-z		# or -i or -n
34485SmarkTERMLIB=	-ltermlib
35485SmarkMKSTR=	${BINDIR}/mkstr
36485SmarkCXREF=	${BINDIR}/cxref
37464SmarkINCLUDE=/usr/include
38464SmarkPR=	pr
39558SmarkOBJS=	ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o \
40558Smark	ex_data.o ex_get.o ex_io.o ex_put.o ex_re.o \
41558Smark	ex_set.o ex_subr.o ex_temp.o ex_tty.o ex_unix.o \
42464Smark	ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voperate.o \
43464Smark	ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
44558Smark	printf.o bcopy.o horse.o strings.o
45558SmarkHDRS=	ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
46558SmarkSRC1=	ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c
47558SmarkSRC2=	ex_data.c ex_get.c ex_io.c ex_put.c ex_re.c
48558SmarkSRC3=	ex_set.c ex_subr.c ex_temp.c ex_tty.c ex_unix.c
49558SmarkSRC4=	ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voperate.c
50558SmarkSRC5=	ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c
51558SmarkSRC6=	printf.c bcopy.c expreserve.c exrecover.c
52558SmarkMISC=	makefile READ_ME :rofix
53558SmarkVGRIND=	csh /usr/ucb/vgrind
54558SmarkVHDR=	"Ex Version ${VERSION}"
55464Smark
56485Smark.c.o:
57485Smark#	${MKSTR} - ex${VERSION}strings x $*.c
58485Smark	${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
59485Smark#	rm -f x$*.c
60485Smark	${CC} ${CFLAGS} -c x.c
61485Smark	mv x.o $*.o
62464Smark
63485Smarka.out: ${OBJS}
64558Smark	cc ${LDFLAGS} ${OBJS} ${TERMLIB}
65485Smark
66558Smarkall:	a.out exrecover expreserve tags
67464Smark
68558Smarktags:	/tmp
69558Smark	${CTAGS} -w ex.[hc] ex_*.[hc]
70558Smark
71485Smark${OBJS}: ex_vars.h
72485Smark
73485Smarkex_vars.h:
74485Smark	csh makeoptions ${CFLAGS}
75485Smark
76558Smarkbcopy.o:	bcopy.c
77558Smark	cc -c ${CFLAGS} bcopy.c
78558Smark
79558Smark# xstr: hands off!
80464Smarkstrings.o: strings
81464Smark	${XSTR}
82485Smark	${CC} -c -S xs.c
83485Smark	ed - <:rofix xs.s
84485Smark	as -o strings.o xs.s
85485Smark	rm xs.s
86464Smark
87464Smarkexrecover: exrecover.o
88485Smark	${CC} ${CFLAGS} exrecover.o -o exrecover
89464Smark
90485Smarkexrecover.o: exrecover.c
91464Smark	${CC} ${CFLAGS} -c -O exrecover.c
92464Smark
93485Smarkexpreserve: expreserve.o
94485Smark	${CC} expreserve.o -o expreserve
95464Smark
96464Smarkexpreserve.o:
97485Smark	${CC} ${CFLAGS} -c -O expreserve.c
98464Smark
99464Smarkclean:
100485Smark#	If we dont have ex we cant make it so dont rm ex_vars.h
101558Smark	-rm -f a.out exrecover expreserve strings core errs trace
102485Smark	-rm -f *.o x*.[cs]
103464Smark
104558Smark# install a new version for testing in /usr/new
105485Smarkninstall: a.out
106558Smark	-rm -f ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi ${DESTDIR}${NBINDIR}/view
107558Smark	cp a.out ${DESTDIR}${NBINDIR}/ex
108485Smark#	-cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
109558Smark	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi
110534Smark	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/view
111558Smark	chmod 1755 ${DESTDIR}${NBINDIR}/ex
112464Smark
113558Smark# install in standard place (/usr/ucb)
114485Smarkinstall: a.out exrecover expreserve
115485Smark	-rm -f ${DESTDIR}${BINDIR}/ex
116485Smark	-rm -f ${DESTDIR}${BINDIR}/vi
117534Smark	-rm -f ${DESTDIR}${BINDIR}/view
118485Smark	-rm -f ${DESTDIR}${BINDIR}/edit
119485Smark	-rm -f ${DESTDIR}${BINDIR}/e
120485Smark	-rm -f ${DESTDIR}/usr/bin/ex
121485Smark	cp a.out ${DESTDIR}${BINDIR}/ex
122485Smark#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
123485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
124485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
125485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
126534Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/view
127485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
128485Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
129485Smark	cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
130558Smark	cp expreserve ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
131485Smark	chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
132558Smark# The following line normally fails.  This is OK.
133485Smark	mkdir ${DESTDIR}/usr/preserve
134464Smark
135558Smark# move from /usr/new to /usr/ucb
136558Smarknewucb: a.out
137558Smark	-rm -f ${DESTDIR}${BINDIR}/ex
138558Smark	-rm -f ${DESTDIR}${BINDIR}/vi
139558Smark	-rm -f ${DESTDIR}${BINDIR}/edit
140558Smark	-rm -f ${DESTDIR}${BINDIR}/e
141558Smark	-rm -f ${DESTDIR}/usr/bin/ex
142558Smark	mv ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/ex
143558Smark	-rm -f ${DESTDIR}${NBINDIR}/vi
144558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
145558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
146558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
147558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
148558Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
149558Smark
150464Smarklint:
151558Smark	lint ${CFLAGS} ex.c ex_?*.c
152558Smark	lint ${CFLAGS} -u exrecover.c
153558Smark	lint ${CFLAGS} expreserve.c
154464Smark
155464Smarkprint:
156464Smark	@${PR} READ* BUGS
157485Smark	@${PR} makefile*
158485Smark	@${PR} /etc/termcap
159464Smark	@(size -l a.out ; size *.o) | ${PR} -h sizes
160464Smark	@${PR} -h errno.h ${INCLUDE}/errno.h
161464Smark	@${PR} -h setjmp.h ${INCLUDE}/setjmp.h
162464Smark	@${PR} -h sgtty.h ${INCLUDE}/sgtty.h
163464Smark	@${PR} -h signal.h ${INCLUDE}/signal.h
164464Smark	@${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
165464Smark	@${PR} -h sys/types.h ${INCLUDE}/sys/types.h
166464Smark	@ls -ls | ${PR}
167464Smark	@${CXREF} *.c | ${PR} -h XREF
168464Smark	@${PR} *.h *.c
169558Smarkvgrind:
170558Smark	tee index < /dev/null
171558Smark#	${VGRIND} -h ${VHDR} ${HDRS}
172558Smark#	${VGRIND} -h ${VHDR} ${SRC1}
173558Smark#	${VGRIND} -h ${VHDR} ${SRC2}
174558Smark	${VGRIND} -h ${VHDR} ${SRC3}
175558Smark	${VGRIND} -h ${VHDR} ${SRC4}
176558Smark	${VGRIND} -h ${VHDR} ${SRC5}
177558Smark	${VGRIND} -h ${VHDR} ${SRC6}
178558Smark#	${VGRIND} -n -h ${VHDR} ${MISC}
179558Smark	${VGRIND} -i -h ${VHDR} index
180564Smark
181*565Smarkex.c: SCCS/s.ex.c ${HDRS}; rm -f ex.c; sccs get ex.c
182*565Smarkex.h: SCCS/s.ex.h; rm -f ex.h; sccs get ex.h
183*565Smarkex_addr.c: SCCS/s.ex_addr.c; rm -f ex_addr.c; sccs get ex_addr.c
184*565Smarkex_argv.h: SCCS/s.ex_argv.h; rm -f ex_argv.h; sccs get ex_argv.h
185*565Smarkex_cmds.c: SCCS/s.ex_cmds.c; rm -f ex_cmds.c; sccs get ex_cmds.c
186*565Smarkex_cmds2.c: SCCS/s.ex_cmds2.c; rm -f ex_cmds2.c; sccs get ex_cmds2.c
187*565Smarkex_cmdsub.c: SCCS/s.ex_cmdsub.c; rm -f ex_cmdsub.c; sccs get ex_cmdsub.c
188*565Smarkex_data.c: SCCS/s.ex_data.c; rm -f ex_data.c; sccs get ex_data.c
189*565Smarkex_get.c: SCCS/s.ex_get.c; rm -f ex_get.c; sccs get ex_get.c
190*565Smarkex_io.c: SCCS/s.ex_io.c; rm -f ex_io.c; sccs get ex_io.c
191*565Smarkex_put.c: SCCS/s.ex_put.c; rm -f ex_put.c; sccs get ex_put.c
192*565Smarkex_re.c: SCCS/s.ex_re.c; rm -f ex_re.c; sccs get ex_re.c
193*565Smarkex_re.h: SCCS/s.ex_re.h; rm -f ex_re.h; sccs get ex_re.h
194*565Smarkex_set.c: SCCS/s.ex_set.c; rm -f ex_set.c; sccs get ex_set.c
195*565Smarkex_subr.c: SCCS/s.ex_subr.c; rm -f ex_subr.c; sccs get ex_subr.c
196*565Smarkex_temp.c: SCCS/s.ex_temp.c; rm -f ex_temp.c; sccs get ex_temp.c
197*565Smarkex_temp.h: SCCS/s.ex_temp.h; rm -f ex_temp.h; sccs get ex_temp.h
198*565Smarkex_tty.c: SCCS/s.ex_tty.c; rm -f ex_tty.c; sccs get ex_tty.c
199*565Smarkex_tty.h: SCCS/s.ex_tty.h; rm -f ex_tty.h; sccs get ex_tty.h
200*565Smarkex_tune.h: SCCS/s.ex_tune.h; rm -f ex_tune.h; sccs get ex_tune.h
201564Smarkex_unix.c: SCCS/s.ex_unix.c; rm -f ex_unix.c; sccs get ex_unix.c
202*565Smarkex_v.c: SCCS/s.ex_v.c; rm -f ex_v.c; sccs get ex_v.c
203*565Smarkex_vadj.c: SCCS/s.ex_vadj.c; rm -f ex_vadj.c; sccs get ex_vadj.c
204*565Smarkex_vars.h: SCCS/s.ex_vars.h; rm -f ex_vars.h; sccs get ex_vars.h
205*565Smarkex_vget.c: SCCS/s.ex_vget.c; rm -f ex_vget.c; sccs get ex_vget.c
206*565Smarkex_vis.h: SCCS/s.ex_vis.h; rm -f ex_vis.h; sccs get ex_vis.h
207*565Smarkex_vmain.c: SCCS/s.ex_vmain.c; rm -f ex_vmain.c; sccs get ex_vmain.c
208564Smarkex_voperate.c: SCCS/s.ex_voperate.c; rm -f ex_voperate.c; sccs get ex_voperate.c
209*565Smarkex_vops.c: SCCS/s.ex_vops.c; rm -f ex_vops.c; sccs get ex_vops.c
210*565Smarkex_vops2.c: SCCS/s.ex_vops2.c; rm -f ex_vops2.c; sccs get ex_vops2.c
211*565Smarkex_vops3.c: SCCS/s.ex_vops3.c; rm -f ex_vops3.c; sccs get ex_vops3.c
212*565Smarkex_vput.c: SCCS/s.ex_vput.c; rm -f ex_vput.c; sccs get ex_vput.c
213*565Smarkex_vwind.c: SCCS/s.ex_vwind.c; rm -f ex_vwind.c; sccs get ex_vwind.c
214*565Smarkexpreserve.c: SCCS/s.expreserve.c; rm -f expreserve.c; sccs get expreserve.c
215*565Smarkexrecover.c: SCCS/s.exrecover.c; rm -f exrecover.c; sccs get exrecover.c
216*565Smarkmakeoptions: SCCS/s.makeoptions; rm -f makeoptions; sccs get makeoptions
217564Smarkbcopy.c: SCCS/s.bcopy.c; rm -f bcopy.c; sccs get bcopy.c
218*565Smarkhorse.c: SCCS/s.horse.c; rm -f horse.c; sccs get horse.c
219*565Smarkprintf.c: SCCS/s.printf.c; rm -f printf.c; sccs get printf.c
220