xref: /original-bsd/usr.bin/ex/Makefile (revision 982436bd)
1#
2# Copyright (c) 1987 The Regents of the University of California.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms are permitted
6# provided that the above copyright notice and this paragraph are
7# duplicated in all such forms and that any documentation,
8# advertising materials, and other materials related to such
9# distribution and use acknowledge that the software was developed
10# by the University of California, Berkeley.  The name of the
11# University may not be used to endorse or promote products derived
12# from this software without specific prior written permission.
13# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16#
17#	@(#)Makefile	7.25 (Berkeley) 03/06/89
18#
19VERSION=3.7
20#
21# Ex skeletal makefile for VAX VM/Unix 4.2BSD
22#
23# Ex is very large - this version will not fit on PDP-11's without overlay
24# software.  Things that can be turned off to save
25# space include LISPCODE (-l flag, showmatch and lisp options), UCVISUAL
26# (visual \ nonsense on upper case only terminals), CHDIR (the undocumented
27# chdir command.)  CRYPT includes the code to edit encrypted files (the -x
28# option, like ed.)  VMUNIX makes ex considerably larger, raising many limits
29# and improving speed and simplicity of maintenance.  It is suitable only
30# for a VAX or other large machine, and then probably only in a paged system.
31#
32# Don't define VFORK unless your system has the VFORK system call,
33# which is like fork but the two processes have only one data space until the
34# child execs. This speeds up ex by saving the memory copy.
35#
36# If your system expands tabs to 4 spaces you should -DTABS=4 below
37#
38BINDIR=		/usr/ucb
39NBINDIR=	/usr/new
40LIBDIR=		/usr/lib
41OPTIONS=	-DCRYPT -DLISPCODE -DCHDIR -DUCVISUAL -DVFORK -DVMUNIX \
42		-DFASTTAG -DUNIX_SBRK
43CFLAGS=		-DTABS=8 -O ${OPTIONS}
44LDFLAGS=	-z				# or -i or -n
45LIBC=		/lib/libc.a
46
47OBJS=	ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_extern.o \
48	ex_get.o ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o ex_tagio.o \
49	ex_temp.o ex_tty.o ex_unix.o ex_v.o ex_vadj.o ex_vget.o ex_vmain.o \
50	ex_voper.o ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
51	printf.o strings.o
52HDRS=	ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
53SRCS=	ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c ex_data.c ex_get.c \
54	ex_io.c ex_put.c ex_re.c ex_set.c ex_subr.c ex_tagio.c ex_temp.c \
55	ex_tty.c ex_unix.c ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voper.c \
56	ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c printf.c
57MAN=	ex.0 vi.0
58
59.c.o:
60# ifdef VMUNIX
61	${CC} -E ${CFLAGS} $*.c | xstr -c -
62# else
63#	mkstr - ex${VERSION}strings x $*.c
64#	${CC} -E ${CFLAGS} x$*.c | xstr -c -
65#	rm -f x$*.c
66# endif
67	@${CC} ${CFLAGS} -c x.c
68	@mv x.o $*.o
69
70all: ex exrecover expreserve
71
72ex: ${OBJS} ${LIBC}
73	${CC} ${LDFLAGS} -o $@ ${OBJS} -ltermcap
74
75ex_vars.h: ex_data.c
76	csh makeoptions ${CFLAGS}
77
78# xstr: hands off!
79strings.o: strings
80	xstr
81	${CC} -c -S xs.c
82	ed - <rofix xs.s
83	${AS} -o strings.o xs.s
84	rm xs.s
85
86exrecover: exrecover.o ex_extern.o
87	${CC} ${CFLAGS} exrecover.o ex_extern.o -o $@
88
89exrecover.o: exrecover.c
90	${CC} ${CFLAGS} -c -O exrecover.c
91
92expreserve: expreserve.c
93	${CC} ${CFLAGS} expreserve.c -o $@
94
95expreserve.o: expreserve.c
96	${CC} ${CFLAGS} -c -O expreserve.c
97
98clean:
99#	If we dont have ex we cant make it so don't rm ex_vars.h
100	rm -f ex exrecover expreserve strings core errs trace
101	rm -f *.o x*.[cs]
102
103cleandir: clean
104	rm -f ${MAN} tags .depend
105
106depend: ${SRCS}
107	mkdep ${CFLAGS} ${SRCS}
108
109# install in standard place (/usr/ucb)
110install: ${MAN}
111	rm -f ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/vi \
112		${DESTDIR}/${BINDIR}/view ${DESTDIR}/${BINDIR}/edit \
113		${DESTDIR}/${BINDIR}/e ${DESTDIR}/usr/bin/ex
114	install -s -o bin -g bin -m 1755 ex ${DESTDIR}/${BINDIR}/ex
115	install -s -o root -m 4755 exrecover ${DESTDIR}/${LIBDIR}/ex${VERSION}recover
116	install -s -o root -m 4755 expreserve ${DESTDIR}/${LIBDIR}/ex${VERSION}preserve
117#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
118	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/edit
119	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/e
120	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/vi
121	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/view
122	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/usr/bin/ex
123	-[ -d ${DESTDIR}/usr/preserve ] || mkdir ${DESTDIR}/usr/preserve
124	install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
125
126lint: ${SRCS}
127	lint ${CFLAGS} ${SRCS}
128	lint ${CFLAGS} exrecover.c ex_extern.c
129	lint ${CFLAGS} expreserve.c
130
131tags: ${SRCS}
132	ctags ${SRCS}
133	ctags -a exrecover.c
134	ctags -a expreserve.c
135	sort -o tags tags
136