1710SmarkVERSION=3.5
2464Smark#
3*723Sroot# Ex skeletal makefile for version 7, USGS Overlay 11/70 system
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*723Sroot# chdir command.)  CRYPT includes code to handle the -x option to allow
12*723Sroot# encrypted files.  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#
22*723SrootBINDIR=	/usr/ucb/bin
23*723SrootNBINDIR=/usr/new/bin
24464SmarkLIBDIR=	/usr/lib
25485SmarkFOLD=	${BINDIR}/fold
26485SmarkCTAGS=	${BINDIR}/ctags
27485SmarkXSTR=	${BINDIR}/xstr
28*723SrootCC=	ovcc
29*723SrootLD=	ovld
30*723SrootDEBUGFLAGS=	-DTRACE
31681SmarkNONDEBUGFLAGS=	-O
32558SmarkDEB=	${NONDEBUGFLAGS}	# or ${DEBUGFLAGS} to to debug
33*723SrootCFLAGS=	-DTABS=8 -DLISPCODE -DCHDIR -DUCVISUAL ${DEB}
34*723SrootTERMLIB=	-lovtermlib
35485SmarkMKSTR=	${BINDIR}/mkstr
36485SmarkCXREF=	${BINDIR}/cxref
37*723Sroot# PRINTF=	printf.o
38*723SrootPRINTF=	ovprintf.o ovdoprnt.o
39*723SrootFMT=	-i	# 11/45, 70
40*723Sroot# FMT=	-n	# 11/23, 34, 40
41464SmarkINCLUDE=/usr/include
42464SmarkPR=	pr
43558SmarkOBJS=	ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o \
44558Smark	ex_data.o ex_get.o ex_io.o ex_put.o ex_re.o \
45558Smark	ex_set.o ex_subr.o ex_temp.o ex_tty.o ex_unix.o \
46464Smark	ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voperate.o \
47464Smark	ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
48*723Sroot	${PRINTF} bcopy.o strings.o
49464Smark
50485Smark.c.o:
51*723Sroot	${MKSTR} - ex${VERSION}strings x $*.c
52*723Sroot	${CC} -E ${CFLAGS} x$*.c | ${XSTR} -c -
53*723Sroot	rm -f x$*.c
54485Smark	${CC} ${CFLAGS} -c x.c
55485Smark	mv x.o $*.o
56464Smark
57*723Sroot# 11/23, 34, 40 and other non split I/D machines
58*723Sroot# each of the 5 overlays must stay less than 16K.
59*723Sroot# a.out: ${OBJS}
60*723Sroot# 	${LD} -X /lib/crt0.o ${FMT}\
61*723Sroot# 	    -Z ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_re.o \
62*723Sroot# 	    -Z ex_vadj.o ex_vmain.o ex_voperate.o ex_vwind.o ex_vops3.o\
63*723Sroot# 	    -Z ex_v.o ex_vget.o ex_vops.o ex_vops2.o ex_vput.o\
64*723Sroot# 	    -Z ex_get.o ex_io.o ex_temp.o ex_tty.o ex_unix.o ex_addr.o ex.o ex_set.o \
65*723Sroot# 	    -L ex_put.o ex_subr.o ${PRINTF} strings.o \
66*723Sroot# 	       ex_data.o ${TERMLIB} -lovc
67*723Sroot
68485Smarka.out: ${OBJS}
69*723Sroot	${LD} -X /lib/crt0.o ${FMT}\
70*723Sroot	    -Z ex_voperate.o ex_vget.o ex_vops.o ex_vops2.o ex_vops3.o \
71*723Sroot	    -Z ex_set.o ex_re.o ex_v.o ex_io.o ex_tty.o ex_unix.o ex.o\
72*723Sroot	    -L ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_get.o ex_temp.o\
73*723Sroot	       ex_vadj.o ex_vmain.o ex_vwind.o\
74*723Sroot	       ex_vput.o ex_put.o ex_subr.o ${PRINTF} strings.o \
75*723Sroot	       ex_data.o ${TERMLIB} -lovc
76485Smark
77558Smarkall:	a.out exrecover expreserve tags
78464Smark
79558Smarktags:	/tmp
80558Smark	${CTAGS} -w ex.[hc] ex_*.[hc]
81558Smark
82485Smark${OBJS}: ex_vars.h
83485Smark
84*723Srootex_vars.h:
85*723Sroot	csh makeoptions ${CFLAGS}
86485Smark
87464Smarkstrings.o: strings
88464Smark	${XSTR}
89485Smark	${CC} -c -S xs.c
90*723Sroot#	ed - <:rofix xs.s
91*723Sroot	as -o strings.o xs.s
92485Smark	rm xs.s
93464Smark
94464Smarkexrecover: exrecover.o
95485Smark	${CC} ${CFLAGS} exrecover.o -o exrecover
96464Smark
97485Smarkexrecover.o: exrecover.c
98464Smark	${CC} ${CFLAGS} -c -O exrecover.c
99464Smark
100485Smarkexpreserve: expreserve.o
101485Smark	${CC} expreserve.o -o expreserve
102464Smark
103464Smarkexpreserve.o:
104485Smark	${CC} ${CFLAGS} -c -O expreserve.c
105464Smark
106576Sbillclean:
107485Smark#	If we dont have ex we cant make it so dont rm ex_vars.h
108558Smark	-rm -f a.out exrecover expreserve strings core errs trace
109485Smark	-rm -f *.o x*.[cs]
110464Smark
111558Smark# install a new version for testing in /usr/new
112485Smarkninstall: a.out
113558Smark	-rm -f ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi ${DESTDIR}${NBINDIR}/view
114558Smark	cp a.out ${DESTDIR}${NBINDIR}/ex
115485Smark#	-cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
116558Smark	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi
117534Smark	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/view
118558Smark	chmod 1755 ${DESTDIR}${NBINDIR}/ex
119464Smark
120558Smark# install in standard place (/usr/ucb)
121485Smarkinstall: a.out exrecover expreserve
122485Smark	-rm -f ${DESTDIR}${BINDIR}/ex
123485Smark	-rm -f ${DESTDIR}${BINDIR}/vi
124534Smark	-rm -f ${DESTDIR}${BINDIR}/view
125485Smark	-rm -f ${DESTDIR}${BINDIR}/edit
126485Smark	-rm -f ${DESTDIR}${BINDIR}/e
127485Smark	-rm -f ${DESTDIR}/usr/bin/ex
128485Smark	cp a.out ${DESTDIR}${BINDIR}/ex
129485Smark#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
130485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
131485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
132485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
133534Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/view
134485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
135485Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
136485Smark	cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
137558Smark	cp expreserve ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
138485Smark	chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
139558Smark# The following line normally fails.  This is OK.
140485Smark	mkdir ${DESTDIR}/usr/preserve
141464Smark
142558Smark# move from /usr/new to /usr/ucb
143558Smarknewucb: a.out
144558Smark	-rm -f ${DESTDIR}${BINDIR}/ex
145558Smark	-rm -f ${DESTDIR}${BINDIR}/vi
146558Smark	-rm -f ${DESTDIR}${BINDIR}/edit
147558Smark	-rm -f ${DESTDIR}${BINDIR}/e
148558Smark	-rm -f ${DESTDIR}/usr/bin/ex
149558Smark	mv ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/ex
150558Smark	-rm -f ${DESTDIR}${NBINDIR}/vi
151558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
152558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
153558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
154558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
155558Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
156558Smark
157464Smarklint:
158558Smark	lint ${CFLAGS} ex.c ex_?*.c
159558Smark	lint ${CFLAGS} -u exrecover.c
160558Smark	lint ${CFLAGS} expreserve.c
161464Smark
162464Smarkprint:
163464Smark	@${PR} READ* BUGS
164485Smark	@${PR} makefile*
165485Smark	@${PR} /etc/termcap
166464Smark	@(size -l a.out ; size *.o) | ${PR} -h sizes
167464Smark	@${PR} -h errno.h ${INCLUDE}/errno.h
168464Smark	@${PR} -h setjmp.h ${INCLUDE}/setjmp.h
169464Smark	@${PR} -h sgtty.h ${INCLUDE}/sgtty.h
170464Smark	@${PR} -h signal.h ${INCLUDE}/signal.h
171464Smark	@${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
172464Smark	@${PR} -h sys/types.h ${INCLUDE}/sys/types.h
173464Smark	@ls -ls | ${PR}
174464Smark	@${CXREF} *.c | ${PR} -h XREF
175464Smark	@${PR} *.h *.c
176