summaryrefslogtreecommitdiff
path: root/Makefile
blob: b18699f97f69305f5328586003b675c6b6c5a224 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
#
# This code contains changes by
#      Gunnar Ritter, Freiburg i. Br., Germany, 2002. All rights reserved.
#
# Conditions 1, 2, and 4 and the no-warranty notice below apply
# to these changes.
#
#
# Copyright (c) 1980, 1993
# 	The Regents of the University of California.  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
# 	This product includes software developed by the University of
# 	California, Berkeley and its contributors.
# 4. Neither the name of the University nor the names of its contributors
#    may be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#   Redistributions of source code and documentation must retain the
#    above copyright notice, this list of conditions and the following
#    disclaimer.
#   Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#   All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#      This product includes software developed or owned by Caldera
#      International, Inc.
#   Neither the name of Caldera International, Inc. nor the names of
#    other contributors may be used to endorse or promote products
#    derived from this software without specific prior written permission.
#
# USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
# INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
# LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#	from Makefile	7.13.1.3 (2.11BSD GTE) 1996/10/23
#
#	@(#)Makefile	1.50 (gritter) 2/20/05
#

#
# Destinations for installation. $(PRESERVEDIR) is used for recovery files.
# It will get mode 1777.
#
PREFIX		= /usr
BINDIR		= $(PREFIX)/bin
LIBEXECDIR	= $(PREFIX)/libexec
MANDIR		= $(PREFIX)/share/man
PRESERVEDIR	= /var/preserve

#
# DESTDIR is prepended to the installation paths. It is mostly useful
# for package building and should be left empty otherwise.
#
DESTDIR		=

#
# A BSD-like install program. GNU install will fit well here, too.
#
INSTALL		= /usr/bin/install

#
# Compiler and linker flags.
#
# On HP-UX, add -D_INCLUDE__STDC_A1_SOURCE to CPPFLAGS.
#
#CFLAGS	=
#CPPFLAGS =
#LDFLAGS	=
#LDADD	=

#
# All of the following settings are quite recommended, so you should only
# change them if it becomes really necessary.
#
# Remove -DMB to build without multibyte character support. This will be
#     necessary if the compiler complains about a missing wchar.h, wctype.h,
#     mbtowc(), mbrtowc(), btowc(), wcwidth() etc. You will likely also have
#     to use the old regular expression code in these cases (see below).
# Remove -DBIT8 to get a 7bit-only ex. This setting is mostly provided for
#     testing the internationalization code against the older version and
#     should not normally be removed.
# Add -DNO_BE_BACKSLASH to make backslash a regular character inside RE
#     bracket expressions. This is required for POSIX conformance but
#     conflicts with historical practice for ex.
#
# Some historic comments:
#
# Ex is very large - this version will not fit on PDP-11's without overlay
# software.  Things that can be turned off to save
# space include LISPCODE (-l flag, showmatch and lisp options), CHDIR (the 
# previously undocumented chdir command.)
#
# If your system expands tabs to 4 spaces you should -DTABS=4 below
#
FEATURES	= -DLISPCODE -DCHDIR -DFASTTAG -DUCVISUAL -DMB -DBIT8

#
# This disables the LC_CTYPE locale settings and assumes all characters
# upwards from octal 0240 are printable ones, like in ISO 8859-1. It
# should only be used if the system's locales are broken. It cannot be
# used in combination with -DMB.
#
#CHARSET	= -DISO8859_1

#
# If you want LC_MESSAGES support using catgets(), define this. To make
# any practical use of it, you also have to create a message catalogue,
# put it in a proper location and change UNKNOWN to its name. See your
# system's documentation on "gencat" or on language support in general
# for further information. This setting is not interesting at the current
# time unless you want to contribute internationalized message catalogues.
#
#LANGMSG		= -DLANGMSG -DCATNAME='"UNKNOWN"'

#
# For POSIX regular expressions, e.g. the star applied to subexpressions
# as in \(ab\)* and localized regular expressions like [:class:], [.c.],
# and [=c=], you need Caldera's 'UNIX(R) Regular Expression Library' or
# the included derivative of it.
#
# Comment out the three following lines if you do not have it or if it
# does not compile; it needs some advanced multibyte character support
# (wchar.h, wctype.h, btowc() etc.) which is not provided by older
# compilation environments.
#
REINC	= -I./libuxre -DUXRE
RELIB	= -L./libuxre -luxre
RETGT	= uxre

#
# VMUNIX should be correct for any modern Unix.
#
# Historic comments:
#
# VMUNIX makes ex considerably larger, raising 
# many limits and improving speed and simplicity of maintenance.  It is 
# suitable only for a VAX or other large machine, and then probably only in 
# a paged system.
#
# Don't define VFORK unless your system has the VFORK system call,
# which is like fork but the two processes have only one data space until the
# child execs. This speeds up ex by saving the memory copy.
#
#      Note by Gunnar Ritter: vfork() is unreliable and one of the worst
#      hacks in Unix history. Do not define VFORK unless you have a
#      special good reason for that.
#
OSTYPE	= -DVMUNIX

#
# On VMUNIX systems, ex can normally edit files up to 32 MB of size. LARGEF
# raises this limit to around 1 GB, but ex will consume much more of core
# and temp file space then.
#
#LARGEF	= -DLARGEF

# 
# The next setting is a crucial one since it determines the way ex
# gets its knowledge about the terminal's capabilities. If you get
# weird results, try using another library here. Uncomment exactly
# one entry.
#
# On System V, the terminfo library may be more accurate than the termcap
# file. To use it, link against the curses library.
#
#TERMLIB	= curses
#
# You may also get terminfo access by using the ncurses library.
#
#TERMLIB	= ncurses
#
# The preferred choice for ex on Linux distributions, other systems that
# provide a good termcap file, or when setting the TERMCAP environment
# variable is deemed sufficient, is the included 2.11BSD termcap library.
#
TERMLIB	= termlib

#
# Since ex uses sbrk() internally, a conflict with the libc's version of
# malloc() must be avoided. There are two ways to work around this problem.
# The first is to allocate a static pool for all malloc purposes. This will
# work on any kind of system.
#
#MALLOC=malloc.o
#
# If mmap() can be used to allocate anonymous memory, this is the preferred
# choice as it allows to grow memory dynamically as it is needed. This will
# usually work unless you are compiling for a vector machine or another
# unusual enviroment.
MALLOC=mapmalloc.o

###############################################################################
#                                                                             #
# That's it. You do not normally need to change anything below here.          #
#                                                                             #
###############################################################################

#WARN	= -Wall -Wno-parentheses -Werror

STRIP =
RECOVER	= -DEXRECOVER=\"$(LIBEXECDIR)/exrecover\" \
			-DEXPRESERVE=\"$(LIBEXECDIR)/expreserve\"
CCFLAGS	= $(CFLAGS) $(WARN) $(CPPFLAGS) $(FEATURES) $(CHARSET) $(OSTYPE) \
		$(LARGEF) $(RECOVER) $(LANGMSG) $(REINC) $(RPMCFLAGS)
TLIB	= libterm/libtermlib.a
INCLUDE	= /usr/include
OBJS	= ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o \
		ex_data.o ex_extern.o ex_get.o ex_io.o ex_put.o ex_re.o \
		ex_set.o ex_subr.o ex_tagio.o ex_temp.o ex_tty.o ex_unix.o \
		ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voper.o \
		ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
		printf.o ex_version.o $(MALLOC)
HDRS	= ex.h ex_argv.h ex_re.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h \
		ex_vis.h libterm/libterm.h
SRC1	= ex.c ex_addr.c ex_cmds.c ex_cmds2.c ex_cmdsub.c
SRC2	= ex_data.c ex_get.c ex_io.c ex_put.c ex_re.c
SRC3	= ex_set.c ex_subr.c ex_tagio.c ex_temp.c ex_tty.c ex_unix.c
SRC4	= ex_v.c ex_vadj.c ex_vget.c ex_vmain.c ex_voper.c
SRC5	= ex_vops.c ex_vops2.c ex_vops3.c ex_vput.c ex_vwind.c
SRC6	= printf.c expreserve.c exrecover.c ex_version.c
SRC7	= mapmalloc.c malloc.c

.SUFFIXES: .o .c
.c.o: ; $(CC) $(CCFLAGS) -c $<

all: $(RETGT) exrecover expreserve ex

ex: $(TLIB) $(OBJS)
	$(CC) -o ex $(LDFLAGS) $(OBJS) $(LDADD) -Llibterm -l$(TERMLIB) $(RELIB)
	size ex

$(TLIB): libterm/termcap.c libterm/tgoto.c libterm/tputs.c libterm/libterm.h
	@cd libterm && $(MAKE) CC="$(CC)" \
		COPT="$(CFLAGS) $(WARN) $(CPPFLAGS) $(OSTYPE)"

exrecover: exrecover.o $(MALLOC)
	$(CC) -o exrecover $(LDFLAGS) exrecover.o $(MALLOC) $(LDADD)

expreserve: expreserve.o
	$(CC) -o expreserve $(LDFLAGS) expreserve.o $(LDADD)

ex_vars.h: ex_data.c
	sh makeoptions $(CCFLAGS)

uxre:
	@cd libuxre && $(MAKE) CC="$(CC)" \
		COPT="$(CFLAGS) $(WARN) $(CPPFLAGS) $(OSTYPE)"

clean:
	@cd libterm && $(MAKE) clean
	@test ! -d libuxre || (cd libuxre && $(MAKE) clean)
#	If we dont have ex we cant make it so don't rm ex_vars.h
	-rm -f ex exrecover expreserve *.o x*.[cs] core errs trace

mrproper: clean
	-rm -f log

# install in standard place

install-man:
	test -d $(DESTDIR)$(PREFIX) || mkdir -p $(DESTDIR)$(PREFIX)
	test -d $(DESTDIR)$(MANDIR) || mkdir -p $(DESTDIR)$(MANDIR)
	test -d $(DESTDIR)$(MANDIR)/man1 || mkdir -p $(DESTDIR)$(MANDIR)/man1
	rm -f $(DESTDIR)$(MANDIR)/man1/ex.1 $(DESTDIR)$(MANDIR)/man1/edit.1 \
		$(DESTDIR)$(MANDIR)/man1/vedit.1 \
		$(DESTDIR)$(MANDIR)/man1/vi.1 \
		$(DESTDIR)$(MANDIR)/man1/view.1
	$(INSTALL) -c -m 644 ex.1 $(DESTDIR)$(MANDIR)/man1/ex.1
	$(INSTALL) -c -m 644 vi.1 $(DESTDIR)$(MANDIR)/man1/vi.1
	ln -s ex.1 $(DESTDIR)$(MANDIR)/man1/edit.1
	ln -s vi.1 $(DESTDIR)$(MANDIR)/man1/vedit.1
	ln -s vi.1 $(DESTDIR)$(MANDIR)/man1/view.1

install: all install-man
	rm -f $(DESTDIR)$(BINDIR)/ex $(DESTDIR)$(BINDIR)/edit \
		$(DESTDIR)$(BINDIR)/vedit $(DESTDIR)$(BINDIR)/vi \
		$(DESTDIR)$(BINDIR)/view
	test -d $(DESTDIR)$(BINDIR) || mkdir -p $(DESTDIR)$(BINDIR)
# special provisions for sticky install
	if test -f $(DESTDIR)$(BINDIR)/ex; \
	then	test -f $(DESTDIR)$(BINDIR)/ex.old.$$$$ && exit 1; \
		chmod 755 $(DESTDIR)$(BINDIR)/ex; \
		echo q | $(DESTDIR)$(BINDIR)/ex; \
		mv $(DESTDIR)$(BINDIR)/ex $(DESTDIR)$(BINDIR)/ex.old.$$$$; \
		rm -f $(DESTDIR)$(BINDIR)/ex.old.$$$$; \
	fi
	$(INSTALL) -c $(STRIP) -m 1755 ex $(DESTDIR)$(BINDIR)/ex
	test -d $(DESTDIR)$(LIBEXECDIR) || mkdir -p $(DESTDIR)$(LIBEXECDIR)
	$(INSTALL) -c $(STRIP) exrecover $(DESTDIR)$(LIBEXECDIR)/exrecover
	$(INSTALL) -c $(STRIP) expreserve $(DESTDIR)$(LIBEXECDIR)/expreserve
	ln -s ex $(DESTDIR)$(BINDIR)/edit
	ln -s ex $(DESTDIR)$(BINDIR)/vedit
	ln -s ex $(DESTDIR)$(BINDIR)/vi
	ln -s ex $(DESTDIR)$(BINDIR)/view
	test -d $(DESTDIR)$(PRESERVEDIR) || mkdir -p $(DESTDIR)$(PRESERVEDIR)
	chmod 1777 $(DESTDIR)$(PRESERVEDIR)

ex.o: config.h ex_argv.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h
ex.o: ex_vars.h libterm/libterm.h
ex_addr.o: config.h ex.h ex_proto.h ex_re.h ex_tune.h ex_vars.h
ex_cmds.o: config.h ex_argv.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h
ex_cmds.o: ex_vars.h ex_vis.h libterm/libterm.h
ex_cmds2.o: config.h ex_argv.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h
ex_cmds2.o: ex_vars.h ex_vis.h libterm/libterm.h
ex_cmdsub.o: config.h ex_argv.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h
ex_cmdsub.o: ex_vars.h ex_vis.h libterm/libterm.h
ex_data.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h
ex_data.o: libterm/libterm.h
ex_extern.o: config.h ex_argv.h ex.h ex_proto.h ex_re.h ex_temp.h ex_tty.h
ex_extern.o: ex_tune.h ex_vars.h ex_vis.h libterm/libterm.h
ex_get.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h
ex_get.o: libterm/libterm.h
ex_io.o: config.h ex_argv.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h
ex_io.o: ex_vars.h ex_vis.h libterm/libterm.h
ex_put.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_put.o: libterm/libterm.h
ex_re.o: config.h ex.h ex_proto.h ex_re.h ex_tune.h ex_vars.h
ex_set.o: config.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h
ex_set.o: libterm/libterm.h
ex_subr.o: config.h ex.h ex_proto.h ex_re.h ex_tty.h ex_tune.h ex_vars.h
ex_subr.o: ex_vis.h libterm/libterm.h
ex_tagio.o: config.h ex.h ex_proto.h ex_tune.h ex_vars.h
ex_temp.o: config.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h
ex_temp.o: ex_vis.h libterm/libterm.h
ex_tty.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h
ex_tty.o: libterm/libterm.h
ex_unix.o: config.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h
ex_unix.o: ex_vis.h libterm/libterm.h
ex_v.o: config.h ex.h ex_proto.h ex_re.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_v.o: libterm/libterm.h
ex_vadj.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_vadj.o: libterm/libterm.h
ex_vget.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_vget.o: libterm/libterm.h
ex_vmain.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_vmain.o: libterm/libterm.h
ex_voper.o: config.h ex.h ex_proto.h ex_re.h ex_tty.h ex_tune.h ex_vars.h
ex_voper.o: ex_vis.h libterm/libterm.h
ex_vops.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_vops.o: libterm/libterm.h
ex_vops2.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_vops2.o: libterm/libterm.h
ex_vops3.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_vops3.o: libterm/libterm.h
ex_vput.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_vput.o: libterm/libterm.h
ex_vwind.o: config.h ex.h ex_proto.h ex_tty.h ex_tune.h ex_vars.h ex_vis.h
ex_vwind.o: libterm/libterm.h
expreserve.o: config.h
exrecover.o: config.h ex.h ex_proto.h ex_temp.h ex_tty.h ex_tune.h ex_vars.h
exrecover.o: libterm/libterm.h
malloc.o: config.h
mapmalloc.o: config.h
printf.o: config.h