1*485SmarkVERSION=3.2
2464Smark#
3*485Smark# Ex skeletal makefile for version 7
4464Smark#
5464Smark# NB: This makefile doesn't indicate any dependencies on header files.
6464Smark#
7*485Smark# Ex is very large - it may not fit on PDP-11's depending on the operating
8*485Smark# system and the cflags you turn on. Things that can be turned off to save
9*485Smark# space include LISPCODE (-l flag, showmatch and lisp options), UCVISUAL
10*485Smark# (visual \ nonsense on upper case only terminals), CHDIR (the undocumented
11*485Smark# chdir command.)
12464Smark#
13*485Smark# Don't define VFORK unless your system has the VFORK system call,
14*485Smark# which is like fork but the two processes have only one data space until the
15*485Smark# child execs. This speeds up ex by saving the memory copy.
16*485Smark# -DVMUNIX makes an ex which can edit very large files (eg the w2a dictionary)
17*485Smark# this allows 200000 lines and about 16M byte temp files.
18*485Smark#
19464Smark# If your system expands tabs to 4 spaces you should -DTABS=4 below
20464Smark#
21*485Smark# Ex is likely to overflow the symbol table in your C compiler.
22*485Smark# It can use -t0 which is (purportedly) a C compiler with a larger
23*485Smark# symbol table.  The -t1 flag to the C compiler is for a C compiler
24*485Smark# which puts switch code in I space, increasing the text space size
25*485Smark# to the benefit of per-user data space.  If you don't have this it
26*485Smark# doesn't matter much. Another method, which works on v7 pdp-11's,
27*485Smark# is to use pcc for ex_io.c instead of cc.
28464Smark#
29*485SmarkBINDIR=	/usr/ucb
30*485SmarkNBINDIR=/usr/new
31464SmarkLIBDIR=	/usr/lib
32*485SmarkFOLD=	${BINDIR}/fold
33*485SmarkCTAGS=	${BINDIR}/ctags
34*485SmarkXSTR=	${BINDIR}/xstr
35*485SmarkDEBUGFLAGS=	-DTRACE
36*485SmarkNONDEBUGFLAGS=	-O
37*485SmarkCFLAGS=	-DTABS=8 -DLISPCODE -DCHDIR -DUCVISUAL -DMACROS -DVFORK -DVMUNIX ${NONDEBUGFLAGS}
38*485SmarkTERMLIB=	-ltermlib
39*485SmarkMKSTR=	${BINDIR}/mkstr
40*485SmarkCXREF=	${BINDIR}/cxref
41464SmarkINCLUDE=/usr/include
42464SmarkPR=	pr
43464SmarkOBJS=	ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_get.o \
44464Smark	ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o ex_temp.o ex_tty.o \
45464Smark	ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voperate.o \
46464Smark	ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
47464Smark	printf.o strings.o
48464Smark
49*485Smarkall:	a.out exrecover expreserve tags
50464Smark
51*485Smark.c.o:
52*485Smark#	${MKSTR} - ex${VERSION}strings x $*.c
53*485Smark	${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
54*485Smark#	rm -f x$*.c
55*485Smark	${CC} ${CFLAGS} -c x.c
56*485Smark	mv x.o $*.o
57464Smark
58*485Smarka.out: ${OBJS}
59*485Smark	cc -i ${OBJS} ${TERMLIB}
60*485Smark
61464Smarktags:
62*485Smark	${CTAGS} -w *.h *.c
63464Smark
64*485Smark${OBJS}: ex_vars.h
65*485Smark
66*485Smarkex_vars.h:
67*485Smark	csh makeoptions ${CFLAGS}
68*485Smark
69464Smarkstrings.o: strings
70464Smark	${XSTR}
71*485Smark	${CC} -c -S xs.c
72*485Smark	ed - <:rofix xs.s
73*485Smark	as -o strings.o xs.s
74*485Smark	rm xs.s
75464Smark
76464Smarkexrecover: exrecover.o
77*485Smark	${CC} ${CFLAGS} exrecover.o -o exrecover
78464Smark
79*485Smarkexrecover.o: exrecover.c
80464Smark	${CC} ${CFLAGS} -c -O exrecover.c
81464Smark
82*485Smarkexpreserve: expreserve.o
83*485Smark	${CC} expreserve.o -o expreserve
84464Smark
85464Smarkexpreserve.o:
86*485Smark	${CC} ${CFLAGS} -c -O expreserve.c
87464Smark
88464Smarkclean:
89*485Smark#	If we dont have ex we cant make it so dont rm ex_vars.h
90*485Smark	-rm -f a.out exrecover expreserve ex${VERSION}strings strings core trace tags
91*485Smark	-rm -f *.o x*.[cs]
92464Smark
93*485Smarkninstall: a.out
94*485Smark	-rm -f ${NBINDIR}/ex ${NBINDIR}/vi
95*485Smark	cp a.out ${NBINDIR}/ex
96*485Smark#	-cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
97*485Smark	ln ${NBINDIR}/ex ${NBINDIR}/vi
98*485Smark	chmod 1755 ${NBINDIR}/ex
99464Smark
100*485Smarkinstall: a.out exrecover expreserve
101*485Smark	-rm -f ${DESTDIR}${BINDIR}/ex
102*485Smark	-rm -f ${DESTDIR}${BINDIR}/vi
103*485Smark	-rm -f ${DESTDIR}${BINDIR}/edit
104*485Smark	-rm -f ${DESTDIR}${BINDIR}/e
105*485Smark	-rm -f ${DESTDIR}/usr/bin/ex
106*485Smark	cp a.out ${DESTDIR}${BINDIR}/ex
107*485Smark#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
108*485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
109*485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
110*485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
111*485Smark	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
112*485Smark	chmod 1755 ${DESTDIR}${BINDIR}/ex
113*485Smark	cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
114*485Smark	cp expreserve ${DESTDIR}/${LIBDIR}/ex${VERSION}preserve
115*485Smark	chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
116*485Smark	mkdir ${DESTDIR}/usr/preserve
117464Smark
118464Smarklint:
119464Smark	lint ex.c ex_?*.c
120464Smark	lint -u exrecover.c
121464Smark	lint expreserve.c
122464Smark
123464Smarkprint:
124464Smark	@${PR} READ* BUGS
125*485Smark	@${PR} makefile*
126*485Smark	@${PR} /etc/termcap
127464Smark	@(size -l a.out ; size *.o) | ${PR} -h sizes
128464Smark	@${PR} -h errno.h ${INCLUDE}/errno.h
129464Smark	@${PR} -h setjmp.h ${INCLUDE}/setjmp.h
130464Smark	@${PR} -h sgtty.h ${INCLUDE}/sgtty.h
131464Smark	@${PR} -h signal.h ${INCLUDE}/signal.h
132464Smark	@${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
133464Smark	@${PR} -h sys/types.h ${INCLUDE}/sys/types.h
134464Smark	@ls -ls | ${PR}
135464Smark	@${CXREF} *.c | ${PR} -h XREF
136464Smark	@${PR} *.h *.c
137