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