1#
2# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5# CDDL HEADER START
6#
7# The contents of this file are subject to the terms of the
8# Common Development and Distribution License, Version 1.0 only
9# (the "License").  You may not use this file except in compliance
10# with the License.
11#
12# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13# or http://www.opensolaris.org/os/licensing.
14# See the License for the specific language governing permissions
15# and limitations under the License.
16#
17# When distributing Covered Code, include this CDDL HEADER in each
18# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19# If applicable, add the following below this CDDL HEADER, with the
20# fields enclosed by brackets "[]" replaced with your own identifying
21# information: Portions Copyright [yyyy] [name of copyright owner]
22#
23# CDDL HEADER END
24#
25
26#ident	"%Z%%M%	%I%	%E% SMI"
27
28#	Makefile for vi
29
30ROOT =
31
32DIR = $(ROOT)/usr/bin
33DIRS = $(ROOT)/var/preserve
34
35LIBDIR	= $(ROOT)/usr/lib
36EX	= ex
37
38INC = $(ROOT)/usr/include
39
40LDFLAGS = -s -lcurses -lcrypt_i -lgen -lw $(PERFLIBS)
41
42OPTIONS = -DUSG -DSTDIO 
43
44DEBUGFLAGS = -DTRACE -g
45NONDEBUGFLAGS = -O
46DEB = $(NONDEBUGFLAGS)
47
48CFLAGS = $(DEB) -I$(INC) $(OPTIONS) -DTABS=8 -DSINGLE
49
50INS = install
51
52STRIP = strip
53
54SIZE = size
55
56FOLD = ../misc/fold
57CTAGS = ../misc/ctags
58CXREF = ../misc/cxref
59
60
61MAKEFILE = makefile.usg
62
63
64MAINS = ex expreserve exrecover 
65
66OBJECTS =  bcopy.o ex.o ex_addr.o ex_cmds.o ex_cmds2.o \
67	ex_cmdsub.o ex_data.o ex_extern.o ex_get.o \
68	ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o \
69	ex_temp.o ex_tty.o ex_unix.o ex_v.o ex_vadj.o \
70	ex_vget.o ex_vmain.o ex_voper.o ex_vops.o \
71	ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
72	printf.o expreserve.o exrecover.o
73
74SOURCES =  bcopy.c ex.c ex_addr.c ex_cmds.c ex_cmds2.c \
75	ex_cmdsub.c ex_data.c ex_extern.c ex_get.c \
76	ex_io.c ex_put.c ex_re.c ex_set.c ex_subr.c \
77	ex_temp.c ex_tty.c ex_unix.c ex_v.c ex_vadj.c \
78	ex_vget.c ex_vmain.c ex_voper.c ex_vops.c \
79	ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c \
80	printf.c exrecover.c expreserve.c
81
82MISC = READ_ME makeoptions asfix.c70 ex.news makefile.370 makefile.c70 \
83	makefile.70 ovdoprnt.s ovprintf.c rofix
84
85ALL:		$(MAINS)
86
87ex:		bcopy.o ex.o ex_addr.o ex_cmds.o ex_cmds2.o \
88		ex_cmdsub.o ex_data.o ex_extern.o ex_get.o \
89		ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o \
90		ex_temp.o ex_tty.o ex_unix.o ex_v.o ex_vadj.o \
91		ex_vget.o ex_vmain.o ex_voper.o ex_vops.o \
92		ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
93		printf.o 
94	$(CC) $(CFLAGS)  -o ex  bcopy.o ex.o ex_addr.o ex_cmds.o ex_cmds2.o \
95	ex_cmdsub.o ex_data.o ex_extern.o ex_get.o \
96	ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o \
97	ex_temp.o ex_tty.o ex_unix.o ex_v.o ex_vadj.o \
98	ex_vget.o ex_vmain.o ex_voper.o ex_vops.o \
99	ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
100	printf.o $(LDFLAGS)
101
102expreserve:	expreserve.o 
103	$(CC) -s expreserve.o  -o expreserve 
104
105exrecover:	exrecover.o 
106	$(CC) $(CFLAGS) -s  -o exrecover  exrecover.o ex_extern.o $(LDFLAGS)
107
108
109ex.o:		 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
110		 $(INC)/errno.h $(INC)/signal.h $(INC)/setjmp.h \
111		 $(INC)/sys/stat.h $(INC)/termio.h $(INC)/sys/termio.h \
112		 $(INC)/term.h ex_tune.h ex_vars.h \
113		 ex_argv.h ex_temp.h ex_tty.h 
114
115ex_addr.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
116		 $(INC)/errno.h $(INC)/signal.h \
117		 $(INC)/setjmp.h $(INC)/sys/stat.h \
118		 $(INC)/termio.h $(INC)/sys/termio.h \
119		 $(INC)/term.h ex_tune.h ex_vars.h \
120		 ex_re.h 
121
122ex_cmds.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
123		 $(INC)/errno.h $(INC)/signal.h \
124		 $(INC)/setjmp.h $(INC)/sys/stat.h \
125		 $(INC)/termio.h $(INC)/sys/termio.h \
126		 $(INC)/term.h ex_tune.h ex_vars.h \
127		 ex_argv.h ex_temp.h ex_tty.h ex_vis.h 
128
129ex_cmds2.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
130		 $(INC)/errno.h $(INC)/signal.h \
131		 $(INC)/setjmp.h $(INC)/sys/stat.h \
132		 $(INC)/termio.h $(INC)/sys/termio.h \
133		 $(INC)/term.h ex_tune.h ex_vars.h \
134		 ex_argv.h ex_temp.h ex_tty.h ex_vis.h 
135
136ex_cmdsub.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
137		 $(INC)/errno.h $(INC)/signal.h \
138		 $(INC)/setjmp.h $(INC)/sys/stat.h \
139		 $(INC)/termio.h $(INC)/sys/termio.h \
140		 $(INC)/term.h ex_tune.h ex_vars.h \
141		 ex_argv.h ex_temp.h ex_tty.h ex_vis.h $(INC)/stdio.h 
142
143ex_data.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
144		 $(INC)/errno.h $(INC)/signal.h \
145		 $(INC)/setjmp.h $(INC)/sys/stat.h \
146		 $(INC)/termio.h $(INC)/sys/termio.h \
147		 $(INC)/term.h ex_tune.h \
148		 ex_vars.h ex_tty.h 
149
150ex_extern.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
151		 $(INC)/errno.h $(INC)/signal.h \
152		 $(INC)/setjmp.h $(INC)/sys/stat.h \
153		 $(INC)/termio.h $(INC)/sys/termio.h \
154		 $(INC)/term.h ex_tune.h ex_vars.h \
155		 ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_vis.h 
156
157ex_get.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
158		 $(INC)/errno.h $(INC)/signal.h \
159		 $(INC)/setjmp.h $(INC)/sys/stat.h \
160		 $(INC)/termio.h $(INC)/sys/termio.h \
161		 $(INC)/term.h ex_tune.h \
162	 	 ex_vars.h ex_tty.h 
163
164ex_io.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
165		 $(INC)/errno.h $(INC)/signal.h \
166		 $(INC)/setjmp.h $(INC)/sys/stat.h \
167		 $(INC)/termio.h $(INC)/sys/termio.h \
168		 $(INC)/term.h ex_tune.h ex_vars.h \
169		 ex_argv.h ex_temp.h ex_tty.h ex_vis.h 
170
171ex_put.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
172		 $(INC)/errno.h $(INC)/signal.h \
173		 $(INC)/setjmp.h $(INC)/sys/stat.h \
174		 $(INC)/termio.h $(INC)/sys/termio.h \
175		 $(INC)/term.h ex_tune.h \
176		 ex_vars.h ex_tty.h ex_vis.h 
177
178ex_re.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
179		 $(INC)/errno.h $(INC)/signal.h \
180		 $(INC)/setjmp.h $(INC)/sys/stat.h \
181		 $(INC)/termio.h $(INC)/sys/termio.h \
182		 $(INC)/term.h ex_tune.h \
183		 ex_vars.h ex_re.h 
184
185ex_set.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
186		 $(INC)/errno.h $(INC)/signal.h \
187		 $(INC)/setjmp.h $(INC)/sys/stat.h \
188		 $(INC)/termio.h $(INC)/sys/termio.h \
189		 $(INC)/term.h ex_tune.h \
190		 ex_vars.h ex_temp.h ex_tty.h 
191
192ex_subr.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
193		 $(INC)/errno.h $(INC)/signal.h \
194		 $(INC)/setjmp.h $(INC)/sys/stat.h \
195		 $(INC)/termio.h $(INC)/sys/termio.h \
196		 $(INC)/term.h ex_tune.h \
197		 ex_vars.h ex_re.h ex_tty.h ex_vis.h 
198
199ex_temp.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
200		 $(INC)/errno.h $(INC)/signal.h \
201		 $(INC)/setjmp.h $(INC)/sys/stat.h \
202		 $(INC)/termio.h $(INC)/sys/termio.h \
203		 $(INC)/term.h ex_tune.h \
204		 ex_vars.h ex_temp.h ex_vis.h ex_tty.h 
205
206ex_tty.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
207		 $(INC)/errno.h $(INC)/signal.h \
208		 $(INC)/setjmp.h $(INC)/sys/stat.h \
209		 $(INC)/termio.h $(INC)/sys/termio.h \
210		 $(INC)/term.h ex_tune.h \
211		 ex_vars.h ex_tty.h 
212
213ex_unix.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
214		 $(INC)/errno.h $(INC)/signal.h \
215		 $(INC)/setjmp.h $(INC)/sys/stat.h \
216		 $(INC)/termio.h $(INC)/sys/termio.h \
217		 $(INC)/term.h ex_tune.h \
218		 ex_vars.h ex_temp.h ex_tty.h ex_vis.h 
219
220ex_v.o:		 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
221		 $(INC)/errno.h $(INC)/signal.h \
222		 $(INC)/setjmp.h $(INC)/sys/stat.h \
223		 $(INC)/termio.h $(INC)/sys/termio.h \
224		 $(INC)/term.h ex_tune.h \
225		 ex_vars.h ex_re.h ex_tty.h ex_vis.h 
226
227ex_vadj.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
228		 $(INC)/errno.h $(INC)/signal.h \
229		 $(INC)/setjmp.h $(INC)/sys/stat.h \
230		 $(INC)/termio.h $(INC)/sys/termio.h \
231		 $(INC)/term.h ex_tune.h \
232		 ex_vars.h ex_tty.h ex_vis.h 
233
234ex_vget.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
235		 $(INC)/errno.h $(INC)/signal.h \
236		 $(INC)/setjmp.h $(INC)/sys/stat.h \
237		 $(INC)/termio.h $(INC)/sys/termio.h \
238		 $(INC)/term.h ex_tune.h \
239		 ex_vars.h ex_tty.h ex_vis.h 
240
241ex_vmain.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
242		 $(INC)/errno.h $(INC)/signal.h \
243		 $(INC)/setjmp.h $(INC)/sys/stat.h \
244		 $(INC)/termio.h $(INC)/sys/termio.h \
245		 $(INC)/term.h ex_tune.h \
246		 ex_vars.h ex_tty.h ex_vis.h 
247
248ex_voper.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
249		 $(INC)/errno.h $(INC)/signal.h \
250		 $(INC)/setjmp.h $(INC)/sys/stat.h \
251		 $(INC)/termio.h $(INC)/sys/termio.h \
252		 $(INC)/term.h ex_tune.h \
253		 ex_vars.h ex_tty.h ex_vis.h 
254
255ex_vops.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
256		 $(INC)/errno.h $(INC)/signal.h \
257		 $(INC)/setjmp.h $(INC)/sys/stat.h \
258		 $(INC)/termio.h $(INC)/sys/termio.h \
259		 $(INC)/term.h ex_tune.h \
260		 ex_vars.h ex_tty.h ex_vis.h 
261
262ex_vops2.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
263		 $(INC)/errno.h $(INC)/signal.h \
264		 $(INC)/setjmp.h $(INC)/sys/stat.h \
265		 $(INC)/termio.h $(INC)/sys/termio.h \
266		 $(INC)/term.h ex_tune.h \
267		 ex_vars.h ex_tty.h ex_vis.h 
268
269ex_vops3.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
270		 $(INC)/errno.h $(INC)/signal.h \
271		 $(INC)/setjmp.h $(INC)/sys/stat.h \
272		 $(INC)/termio.h $(INC)/sys/termio.h \
273		 $(INC)/term.h ex_tune.h \
274		 ex_vars.h ex_tty.h ex_vis.h 
275
276ex_vput.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
277		 $(INC)/errno.h $(INC)/signal.h \
278		 $(INC)/setjmp.h $(INC)/sys/stat.h \
279		 $(INC)/termio.h $(INC)/sys/termio.h \
280		 $(INC)/term.h ex_tune.h \
281		 ex_vars.h ex_tty.h ex_vis.h 
282
283ex_vwind.o:	 ex.h $(INC)/sys/types.h $(INC)/ctype.h \
284		 $(INC)/errno.h $(INC)/signal.h \
285		 $(INC)/setjmp.h $(INC)/sys/stat.h \
286		 $(INC)/termio.h $(INC)/sys/termio.h \
287		 $(INC)/term.h ex_tune.h \
288		 ex_vars.h ex_tty.h ex_vis.h 
289
290expreserve.o:	 $(INC)/stdio.h $(INC)/ctype.h \
291		 $(INC)/sys/types.h $(INC)/sys/stat.h \
292		 $(INC)/sys/dir.h $(INC)/pwd.h 
293	$(CC) $(CFLAGS) -c -O expreserve.c
294
295exrecover.o:	 $(INC)/stdio.h ex.h $(INC)/sys/types.h \
296		 $(INC)/ctype.h $(INC)/errno.h \
297		 $(INC)/signal.h $(INC)/setjmp.h \
298		 $(INC)/sys/stat.h $(INC)/termio.h \
299		 $(INC)/sys/termio.h $(INC)/term.h ex_tune.h \
300		 ex_vars.h ex_temp.h ex_tty.h \
301		 $(INC)/sys/dir.h 
302	$(CC) $(CFLAGS) -c -O exrecover.c
303
304printf.o:	 $(INC)/varargs.h	
305
306GLOBALINCS = $(INC)/ctype.h $(INC)/errno.h \
307	$(INC)/pwd.h $(INC)/setjmp.h $(INC)/signal.h \
308	$(INC)/stdio.h $(INC)/sys/dir.h $(INC)/sys/stat.h \
309	$(INC)/sys/termio.h $(INC)/sys/types.h \
310	$(INC)/term.h $(INC)/termio.h $(INC)/varargs.h 
311
312LOCALINCS = ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h \
313	ex_vis.h
314
315clean:
316	rm -f $(OBJECTS)
317
318clobber:
319	rm -f $(OBJECTS) $(MAINS)
320
321all : ALL
322
323install: ALL $(DIRS)
324	rm -f $(DIR)/vi ; \
325	rm -f $(DIR)/view ; \
326	rm -f $(DIR)/edit ; \
327	rm -f $(DIR)/vedit ; \
328	$(INS) -f $(DIR) -m 555 -u bin -g bin -o $(EX);
329	ln -f $(DIR)/$(EX) $(DIR)/vi
330	ln -f $(DIR)/$(EX) $(DIR)/view
331	ln -f $(DIR)/$(EX) $(DIR)/edit
332	ln -f $(DIR)/$(EX) $(DIR)/vedit
333	$(INS) -f $(LIBDIR) -m 555 -u bin -g bin exrecover
334	$(INS) -f $(LIBDIR) -m 555 -u bin -g bin expreserve
335
336$(DIRS):
337	mkdir $@
338
339size: ALL
340	$(SIZE) $(MAINS)
341
342strip: ALL
343	$(STRIP) $(MAINS)
344
345#	These targets are useful but optional
346
347partslist:
348	@echo $(MAKEFILE) $(SOURCES) $(LOCALINCS)  |  tr ' ' '\012'  |  sort
349
350productdir:
351	@echo $(DIR) | tr ' ' '\012' | sort
352
353product:
354	@echo $(MAINS)  |  tr ' ' '\012'  | \
355	sed 's;^;$(DIR)/;'
356
357srcaudit:
358	@fileaudit $(MAKEFILE) $(LOCALINCS) $(SOURCES) $(MISC) -o $(OBJECTS) $(MAINS)
359