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