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