1710SmarkVERSION=3.5
2464Smark#
3723Sroot# 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
11723Sroot# chdir command.)  CRYPT includes code to handle the -x option to allow
12723Sroot# 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#
22723SrootBINDIR=	/usr/ucb/bin
23723SrootNBINDIR=/usr/new/bin
24806SrootLIBDIR=	/usr/ucb/lib
25485SmarkFOLD=	${BINDIR}/fold
26485SmarkCTAGS=	${BINDIR}/ctags
27485SmarkXSTR=	${BINDIR}/xstr
28*812SrootCC=	cc -V -B/usr/new/lib/ -t012 # kludge for /usr/new
29806SrootAS=	ovas
30723SrootLD=	ovld
31723SrootDEBUGFLAGS=	-DTRACE
32681SmarkNONDEBUGFLAGS=	-O
33558SmarkDEB=	${NONDEBUGFLAGS}	# or ${DEBUGFLAGS} to to debug
34723SrootCFLAGS=	-DTABS=8 -DLISPCODE -DCHDIR -DUCVISUAL ${DEB}
35723SrootTERMLIB=	-lovtermlib
36485SmarkMKSTR=	${BINDIR}/mkstr
37485SmarkCXREF=	${BINDIR}/cxref
38*812Sroot# PRINTF=	printf.o; PRINTFS=printf.c
39723SrootPRINTF=	ovprintf.o ovdoprnt.o
40*812SrootPRINTFS=ovprintf.c ovdoprnt.s
41723SrootFMT=	-i	# 11/45, 70
42723Sroot# FMT=	-n	# 11/23, 34, 40
43464SmarkINCLUDE=/usr/include
44464SmarkPR=	pr
45*812SrootGET=	sccs get
46558SmarkOBJS=	ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o \
47558Smark	ex_data.o ex_get.o ex_io.o ex_put.o ex_re.o \
48558Smark	ex_set.o ex_subr.o ex_temp.o ex_tty.o ex_unix.o \
49*812Sroot	ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voper.o \
50464Smark	ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
51723Sroot	${PRINTF} bcopy.o strings.o
52*812SrootSRCS=	ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h\
53*812Sroot	ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c \
54*812Sroot	ex_data.c ex_get.c ex_io.c ex_put.c ex_re.c \
55*812Sroot	ex_set.c ex_subr.c ex_temp.c ex_tty.c ex_unix.c \
56*812Sroot	ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voper.c \
57*812Sroot	ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c \
58*812Sroot	${PRINTFS} bcopy.c strings.c
59464Smark
60485Smark.c.o:
61723Sroot	${MKSTR} - ex${VERSION}strings x $*.c
62723Sroot	${CC} -E ${CFLAGS} x$*.c | ${XSTR} -c -
63723Sroot	rm -f x$*.c
64485Smark	${CC} ${CFLAGS} -c x.c
65485Smark	mv x.o $*.o
66464Smark
67*812Sroot${OBJS}:	${SRCS}
68*812Sroot
69723Sroot# 11/23, 34, 40 and other non split I/D machines
70723Sroot# each of the 5 overlays must stay less than 16K.
71723Sroot# a.out: ${OBJS}
72723Sroot# 	${LD} -X /lib/crt0.o ${FMT}\
73723Sroot# 	    -Z ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_re.o \
74*812Sroot# 	    -Z ex_vadj.o ex_vmain.o ex_voper.o ex_vwind.o ex_vops3.o\
75723Sroot# 	    -Z ex_v.o ex_vget.o ex_vops.o ex_vops2.o ex_vput.o\
76723Sroot# 	    -Z ex_get.o ex_io.o ex_temp.o ex_tty.o ex_unix.o ex_addr.o ex.o ex_set.o \
77723Sroot# 	    -L ex_put.o ex_subr.o ${PRINTF} strings.o \
78723Sroot# 	       ex_data.o ${TERMLIB} -lovc
79723Sroot
80485Smarka.out: ${OBJS}
81723Sroot	${LD} -X /lib/crt0.o ${FMT}\
82*812Sroot	    -Z ex_voper.o ex_vget.o ex_vops.o ex_vops2.o ex_vops3.o \
83806Sroot	    -Z ex_set.o ex_re.o ex_io.o ex_tty.o ex_unix.o ex.o\
84723Sroot	    -L ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_get.o ex_temp.o\
85806Sroot	       ex_v.o ex_vadj.o ex_vmain.o ex_vwind.o\
86723Sroot	       ex_vput.o ex_put.o ex_subr.o ${PRINTF} strings.o \
87723Sroot	       ex_data.o ${TERMLIB} -lovc
88485Smark
89558Smarkall:	a.out exrecover expreserve tags
90464Smark
91558Smarktags:	/tmp
92558Smark	${CTAGS} -w ex.[hc] ex_*.[hc]
93558Smark
94*812Sroot${SRCS}:
95*812Sroot	${GET}$@
96485Smark
97*812Sroot# ex_vars.h:
98*812Sroot# 	csh makeoptions ${CFLAGS}
99485Smark
100464Smarkstrings.o: strings
101464Smark	${XSTR}
102485Smark	${CC} -c -S xs.c
103723Sroot#	ed - <:rofix xs.s
104806Sroot	${AS} -o strings.o xs.s
105485Smark	rm xs.s
106464Smark
107464Smarkexrecover: exrecover.o
108485Smark	${CC} ${CFLAGS} exrecover.o -o exrecover
109464Smark
110485Smarkexrecover.o: exrecover.c
111464Smark	${CC} ${CFLAGS} -c -O exrecover.c
112464Smark
113485Smarkexpreserve: expreserve.o
114485Smark	${CC} expreserve.o -o expreserve
115464Smark
116464Smarkexpreserve.o:
117485Smark	${CC} ${CFLAGS} -c -O expreserve.c
118464Smark
119576Sbillclean:
120485Smark#	If we dont have ex we cant make it so dont rm ex_vars.h
121558Smark	-rm -f a.out exrecover expreserve strings core errs trace
122485Smark	-rm -f *.o x*.[cs]
123464Smark
124558Smark# install a new version for testing in /usr/new
125485Smarkninstall: a.out
126558Smark	-rm -f ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi ${DESTDIR}${NBINDIR}/view
127558Smark	cp a.out ${DESTDIR}${NBINDIR}/ex
128485Smark#	-cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
129558Smark	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi
130534Smark	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/view
131558Smark	chmod 1755 ${DESTDIR}${NBINDIR}/ex
132464Smark
133558Smark# install in standard place (/usr/ucb)
134485Smarkinstall: a.out exrecover expreserve
135485Smark	-rm -f ${DESTDIR}${BINDIR}/ex
136485Smark	-rm -f ${DESTDIR}${BINDIR}/vi
137534Smark	-rm -f ${DESTDIR}${BINDIR}/view
138485Smark	-rm -f ${DESTDIR}${BINDIR}/edit
139485Smark	-rm -f ${DESTDIR}${BINDIR}/e
140485Smark	-rm -f ${DESTDIR}/usr/bin/ex
141485Smark	cp a.out ${DESTDIR}${BINDIR}/ex
142485Smark#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
143485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
144485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
145485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
146534Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/view
147485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
148485Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
149485Smark	cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
150558Smark	cp expreserve ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
151485Smark	chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
152558Smark# The following line normally fails.  This is OK.
153485Smark	mkdir ${DESTDIR}/usr/preserve
154464Smark
155558Smark# move from /usr/new to /usr/ucb
156558Smarknewucb: a.out
157558Smark	-rm -f ${DESTDIR}${BINDIR}/ex
158558Smark	-rm -f ${DESTDIR}${BINDIR}/vi
159558Smark	-rm -f ${DESTDIR}${BINDIR}/edit
160558Smark	-rm -f ${DESTDIR}${BINDIR}/e
161558Smark	-rm -f ${DESTDIR}/usr/bin/ex
162558Smark	mv ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/ex
163558Smark	-rm -f ${DESTDIR}${NBINDIR}/vi
164558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
165558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
166558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
167558Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
168558Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
169558Smark
170464Smarklint:
171558Smark	lint ${CFLAGS} ex.c ex_?*.c
172558Smark	lint ${CFLAGS} -u exrecover.c
173558Smark	lint ${CFLAGS} expreserve.c
174464Smark
175464Smarkprint:
176464Smark	@${PR} READ* BUGS
177485Smark	@${PR} makefile*
178485Smark	@${PR} /etc/termcap
179464Smark	@(size -l a.out ; size *.o) | ${PR} -h sizes
180464Smark	@${PR} -h errno.h ${INCLUDE}/errno.h
181464Smark	@${PR} -h setjmp.h ${INCLUDE}/setjmp.h
182464Smark	@${PR} -h sgtty.h ${INCLUDE}/sgtty.h
183464Smark	@${PR} -h signal.h ${INCLUDE}/signal.h
184464Smark	@${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
185464Smark	@${PR} -h sys/types.h ${INCLUDE}/sys/types.h
186464Smark	@ls -ls | ${PR}
187464Smark	@${CXREF} *.c | ${PR} -h XREF
188464Smark	@${PR} *.h *.c
189