xref: /original-bsd/usr.bin/ex/Makefile (revision 2e5c0888)
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.26 (Berkeley) 04/05/90
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/bin
39LIBDIR=		/usr/libexec
40OPTIONS=	-DCRYPT -DLISPCODE -DCHDIR -DUCVISUAL -DVFORK -DVMUNIX \
41		-DFASTTAG -DUNIX_SBRK
42CFLAGS=		-DTABS=8 -O ${OPTIONS}
43LDFLAGS=	-z				# or -i or -n
44LIBC=		/lib/libc.a
45
46OBJS=	ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_extern.o \
47	ex_get.o ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o ex_tagio.o \
48	ex_temp.o ex_tty.o ex_unix.o ex_v.o ex_vadj.o ex_vget.o ex_vmain.o \
49	ex_voper.o ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
50	printf.o strings.o
51HDRS=	ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
52SRCS=	ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c ex_data.c ex_get.c \
53	ex_io.c ex_put.c ex_re.c ex_set.c ex_subr.c ex_tagio.c ex_temp.c \
54	ex_tty.c ex_unix.c ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voper.c \
55	ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c printf.c
56MAN=	ex.0 vi.0
57
58.c.o:
59# ifdef VMUNIX
60	${CC} -E ${CFLAGS} $*.c | xstr -c -
61# else
62#	mkstr - ex${VERSION}strings x $*.c
63#	${CC} -E ${CFLAGS} x$*.c | xstr -c -
64#	rm -f x$*.c
65# endif
66	@${CC} ${CFLAGS} -c x.c
67	@mv x.o $*.o
68
69all: ex exrecover expreserve
70
71ex: ${OBJS} ${LIBC}
72	${CC} ${LDFLAGS} -o $@ ${OBJS} -ltermcap
73
74ex_vars.h: ex_data.c
75	csh makeoptions ${CFLAGS}
76
77# xstr: hands off!
78strings.o: strings
79	xstr
80	${CC} -c -S xs.c
81	ed - <rofix xs.s
82	${AS} -o strings.o xs.s
83	rm xs.s
84
85exrecover: exrecover.o ex_extern.o
86	${CC} ${CFLAGS} exrecover.o ex_extern.o -o $@
87
88exrecover.o: exrecover.c
89	${CC} ${CFLAGS} -c -O exrecover.c
90
91expreserve: expreserve.c
92	${CC} ${CFLAGS} expreserve.c -o $@
93
94expreserve.o: expreserve.c
95	${CC} ${CFLAGS} -c -O expreserve.c
96
97clean:
98#	If we dont have ex we cant make it so don't rm ex_vars.h
99	rm -f ex exrecover expreserve strings core errs trace
100	rm -f *.o x*.[cs]
101
102cleandir: clean
103	rm -f ${MAN} tags .depend
104
105depend: ${SRCS}
106	mkdep ${CFLAGS} ${SRCS}
107
108# install in standard place (/usr/ucb)
109install: ${MAN}
110	rm -f ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/vi \
111		${DESTDIR}/${BINDIR}/view ${DESTDIR}/${BINDIR}/edit
112	install -s -o bin -g bin -m 1755 ex ${DESTDIR}/${BINDIR}/ex
113	install -s -o root -m 4755 exrecover ${DESTDIR}/${LIBDIR}/ex${VERSION}recover
114	install -s -o root -m 4755 expreserve ${DESTDIR}/${LIBDIR}/ex${VERSION}preserve
115#	cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
116	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/edit
117	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/view
118	ln ${DESTDIR}/${BINDIR}/ex ${DESTDIR}/${BINDIR}/vi
119	install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
120
121lint: ${SRCS}
122	lint ${CFLAGS} ${SRCS}
123	lint ${CFLAGS} exrecover.c ex_extern.c
124	lint ${CFLAGS} expreserve.c
125
126tags: ${SRCS}
127	ctags ${SRCS}
128	ctags -a exrecover.c
129	ctags -a expreserve.c
130	sort -o tags tags
131