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