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