xref: /original-bsd/usr.bin/ex/Makefile (revision fbed46ce)
1VERSION=3.7
2#
3# Ex skeletal makefile for VAX VM/Unix 4.1BSD
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
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 -DVFORK -DVMUNIX -DSTDIO
32CFLAGS=	-DTABS=8 ${OPTIONS} ${DEB}
33LDFLAGS=	-z		# or -i or -n
34TERMLIB=	-ltermcap
35MKSTR=	${BINDIR}/mkstr
36CXREF=	${BINDIR}/cxref
37INCLUDE=/usr/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
45HDRS=	ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
46SRC1=	ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c
47SRC2=	ex_data.c ex_get.c ex_io.c ex_put.c ex_re.c
48SRC3=	ex_set.c ex_subr.c ex_temp.c ex_tty.c ex_unix.c
49SRC4=	ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voper.c
50SRC5=	ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c
51SRC6=	printf.c bcopy.c expreserve.c exrecover.c
52MISC=	makefile READ_ME rofix
53VGRIND=	csh /usr/ucb/vgrind
54VHDR=	"Ex Version ${VERSION}"
55
56.c.o:
57# ifdef VMUNIX
58	${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
59# else
60#	${MKSTR} - ex${VERSION}strings x $*.c
61#	${CC} -E ${CFLAGS} x$*.c | ${XSTR} -c -
62#	rm -f x$*.c
63# endif
64	${CC} ${CFLAGS} -c x.c
65	mv x.o $*.o
66
67a.out: ${OBJS}
68	${CC} ${LDFLAGS} ${OBJS} ${TERMLIB}
69
70all:	a.out exrecover expreserve tags
71
72tags:	/tmp
73	${CTAGS} -w ex.[hc] ex_*.[hc]
74
75${OBJS}: ex_vars.h
76
77# ex_vars.h:
78# 	csh makeoptions ${CFLAGS}
79
80bcopy.o:	bcopy.c
81	${CC} -c ${CFLAGS} bcopy.c
82
83# xstr: hands off!
84strings.o: strings
85	${XSTR}
86	${CC} -c -S xs.c
87	ed - <rofix xs.s
88	${AS} -o strings.o xs.s
89	rm xs.s
90
91exrecover: exrecover.o
92	${CC} ${CFLAGS} exrecover.o ex_extern.o -o exrecover
93
94exrecover.o: exrecover.c
95	${CC} ${CFLAGS} -c -O exrecover.c
96
97expreserve: expreserve.o
98	${CC} expreserve.o -o expreserve
99
100expreserve.o:
101	${CC} ${CFLAGS} -c -O expreserve.c
102
103clean:
104#	If we dont have ex we cant make it so dont rm ex_vars.h
105	-rm -f a.out exrecover expreserve strings core errs trace
106	-rm -f *.o x*.[cs]
107
108# install a new version for testing in /usr/new
109ninstall: a.out
110	-rm -f ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi ${DESTDIR}${NBINDIR}/view
111	cp a.out ${DESTDIR}${NBINDIR}/ex
112#	-cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
113	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/vi
114	ln ${DESTDIR}${NBINDIR}/ex ${DESTDIR}${NBINDIR}/view
115	chmod 1755 ${DESTDIR}${NBINDIR}/ex
116
117# install in standard place (/usr/ucb)
118install: a.out exrecover expreserve
119	strip a.out
120	-rm -f ${DESTDIR}${BINDIR}/ex
121	-rm -f ${DESTDIR}${BINDIR}/vi
122	-rm -f ${DESTDIR}${BINDIR}/view
123	-rm -f ${DESTDIR}${BINDIR}/edit
124	-rm -f ${DESTDIR}${BINDIR}/e
125	-rm -f ${DESTDIR}/usr/bin/ex
126	cp a.out ${DESTDIR}${BINDIR}/ex
127#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
128	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
129	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
130	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
131	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/view
132	ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
133	chmod 1755 ${DESTDIR}${BINDIR}/ex
134	cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
135	cp expreserve ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
136	chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${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