xref: /original-bsd/usr.bin/ex/Makefile (revision d6a1a276)
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	7.15 (Berkeley) 05/31/87
7#
8VERSION=3.7
9#
10# Ex skeletal makefile for VAX VM/Unix 4.2BSD
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
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 -DVFORK -DVMUNIX -DFASTTAG\
39	-DUNIX_SBRK
40CFLAGS=	-DTABS=8 ${OPTIONS} ${DEB}
41LDFLAGS=	-z		# or -i or -n
42TERMLIB=	-ltermcap
43MKSTR=	${BINDIR}/mkstr
44CXREF=	${BINDIR}/cxref
45INCLUDE=/usr/include
46PR=	pr
47OBJS=	ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o \
48	ex_data.o ex_extern.o ex_get.o ex_io.o ex_put.o ex_re.o \
49	ex_set.o ex_subr.o ex_tagio.o ex_temp.o ex_tty.o ex_unix.o \
50	ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voper.o \
51	ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
52	printf.o bcopy.o strings.o
53HDRS=	ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
54SRC1=	ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c
55SRC2=	ex_data.c ex_get.c ex_io.c ex_put.c ex_re.c
56SRC3=	ex_set.c ex_subr.c ex_tagio.c ex_temp.c ex_tty.c ex_unix.c
57SRC4=	ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voper.c
58SRC5=	ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c
59SRC6=	printf.c bcopy.c expreserve.c exrecover.c
60MISC=	makefile READ_ME rofix
61VGRIND=	csh /usr/ucb/vgrind
62VHDR=	"Ex Version ${VERSION}"
63
64.c.o:
65# ifdef VMUNIX
66	${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
67# else
68#	${MKSTR} - ex${VERSION}strings x $*.c
69#	${CC} -E ${CFLAGS} x$*.c | ${XSTR} -c -
70#	rm -f x$*.c
71# endif
72	${CC} ${CFLAGS} -c x.c
73	mv x.o $*.o
74
75all:	a.out exrecover expreserve
76
77a.out: ${OBJS}
78	@echo loading a.out
79	@${CC} ${LDFLAGS} ${OBJS} ${TERMLIB}
80
81tags:	/tmp
82	${CTAGS} -w ex.[hc] ex_*.[hc]
83
84${OBJS}: ${HDRS}
85
86ex_vars.h:	ex_data.c
87	csh makeoptions ${CFLAGS}
88
89bcopy.o:	bcopy.c
90	${CC} -c ${CFLAGS} bcopy.c
91
92# xstr: hands off!
93strings.o: strings
94	${XSTR}
95	${CC} -c -S xs.c
96	ed - <rofix xs.s
97	${AS} -o strings.o xs.s
98	rm xs.s
99
100exrecover: exrecover.o
101	${CC} ${CFLAGS} exrecover.o ex_extern.o -o exrecover
102
103exrecover.o: exrecover.c
104	${CC} ${CFLAGS} -c -O exrecover.c
105
106expreserve: expreserve.o
107	${CC} expreserve.o -o expreserve
108
109expreserve.o:
110	${CC} ${CFLAGS} -c -O expreserve.c
111
112clean:
113#	If we dont have ex we cant make it so don't rm ex_vars.h
114	-rm -f a.out exrecover expreserve strings core errs trace
115	-rm -f *.o x*.[cs]
116
117depend:
118
119# install a new version for testing in /usr/new
120ninstall: a.out
121	-rm -f ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi ${DESTDIR}${NBINDIR}/view
122	cp a.out ${DESTDIR}${NBINDIR}/ex
123#	-cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
124	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi
125	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/view
126	chmod 1755 ${DESTDIR}${NBINDIR}/ex
127
128# install in standard place (/usr/ucb)
129install: a.out exrecover expreserve
130	-rm -f ${DESTDIR}/${BINDIR}/ex
131	-rm -f ${DESTDIR}/${BINDIR}/vi
132	-rm -f ${DESTDIR}/${BINDIR}/view
133	-rm -f ${DESTDIR}/${BINDIR}/edit
134	-rm -f ${DESTDIR}/${BINDIR}/e
135	-rm -f ${DESTDIR}/usr/bin/ex
136	install -s -m 1755 a.out ${DESTDIR}/${BINDIR}/ex
137#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
138	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/edit
139	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/e
140	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/vi
141	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/view
142	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/usr/bin/ex
143	chmod 1755 ${DESTDIR}/${BINDIR}/ex
144	install -s -o root -m 4755 exrecover ${DESTDIR}/${LIBDIR}/ex${VERSION}recover
145	install -s -o root -m 4755 expreserve ${DESTDIR}/${LIBDIR}/ex${VERSION}preserve
146# The following line normally fails.  This is OK.
147	-mkdir ${DESTDIR}/usr/preserve
148
149# move from /usr/new to /usr/ucb
150newucb: a.out
151	-rm -f ${DESTDIR}/${BINDIR}/ex
152	-rm -f ${DESTDIR}/${BINDIR}/vi
153	-rm -f ${DESTDIR}/${BINDIR}/edit
154	-rm -f ${DESTDIR}/${BINDIR}/e
155	-rm -f ${DESTDIR}/usr/bin/ex
156	mv ${DESTDIR}/${NBINDIR}/ex ${DESTDIR}/${NBINDIR}/ex
157	-rm -f ${DESTDIR}/${NBINDIR}/vi
158	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/edit
159	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/e
160	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/vi
161	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/usr/bin/ex
162	chmod 1755 ${DESTDIR}/${BINDIR}/ex
163
164lint:
165	lint ${CFLAGS} ex.c ex_?*.c
166	lint ${CFLAGS} -u exrecover.c
167	lint ${CFLAGS} expreserve.c
168
169print:
170	@${PR} READ* BUGS
171	@${PR} makefile*
172	@${PR} /etc/termcap
173	@(size -l a.out ; size *.o) | ${PR} -h sizes
174	@${PR} -h errno.h ${INCLUDE}/errno.h
175	@${PR} -h setjmp.h ${INCLUDE}/setjmp.h
176	@${PR} -h sgtty.h ${INCLUDE}/sgtty.h
177	@${PR} -h signal.h ${INCLUDE}/signal.h
178	@${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
179	@${PR} -h sys/types.h ${INCLUDE}/sys/types.h
180	@ls -ls | ${PR}
181	@${CXREF} *.c | ${PR} -h XREF
182	@${PR} *.h *.c
183vgrind:
184	tee index < /dev/null
185	${VGRIND} -h ${VHDR} ${HDRS}
186	${VGRIND} -h ${VHDR} ${SRC1}
187	${VGRIND} -h ${VHDR} ${SRC2}
188	${VGRIND} -h ${VHDR} ${SRC3}
189	${VGRIND} -h ${VHDR} ${SRC4}
190	${VGRIND} -h ${VHDR} ${SRC5}
191	${VGRIND} -h ${VHDR} ${SRC6}
192	${VGRIND} -n -h ${VHDR} ${MISC}
193	${VGRIND} -i -h ${VHDR} index
194