1
# Makefile for GNU Awk.
3
# Copyright (C) 1986, 1988, 1989 the Free Software Foundation, Inc.
5
# This file is part of GAWK, the GNU implementation of the
6
# AWK Progamming Language.
8
# GAWK is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 1, or (at your option)
13
# GAWK is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with GAWK; see the file COPYING. If not, write to
20
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
# CFLAGS: options to the C compiler
27
# -g include dbx/sdb info
28
# -gg include gdb debugging info; only for GCC (deprecated)
29
# -pg include new (gmon) profiling info
30
# -p include old style profiling info (System V)
32
# To port GAWK, examine and adjust the following flags carefully.
33
# In addition, you will have to look at alloca below.
34
# The intent (eventual) is to not penalize the most-standard-conforming
35
# systems with a lot of #define's.
37
# -DBCOPY_MISSING - bcopy() et al. are missing; will replace
38
# with a #define'd memcpy() et al. -- use at
39
# your own risk (should really use a memmove())
40
# -DSPRINTF_INT - sprintf() returns int (most USG systems)
41
# -DBLKSIZE_MISSING - st_blksize missing from stat() structure
43
# -DBSDSTDIO - has a BSD internally-compatible stdio
44
# -DDOPRNT_MISSING - lacks doprnt() routine
45
# -DDUP2_MISSING - lacks dup2() system call (S5Rn, n < 4)
46
# -DGCVT_MISSING - lacks gcvt() routine
47
# -DGETOPT_MISSING - lacks getopt() routine
48
# -DMEMCMP_MISSING - lacks memcmp() routine
49
# -DMEMCPY_MISSING - lacks memcpy() routine
50
# -DMEMSET_MISSING - lacks memset() routine
51
# -DRANDOM_MISSING - lacks random() routine
52
# -DSTRCASE_MISSING - lacks strcasecmp() routine
53
# -DSTRCHR_MISSING - lacks strchr() and strrchr() routines
54
# -DSTRERROR_MISSING - lacks (ANSI C) strerror() routine
55
# -DSTRTOD_MISSING - lacks strtod() routine
56
# -DTMPNAM_MISSING - lacks or deficient tmpnam() routine
57
# -DVPRINTF_MISSING - lacks vprintf and associated routines
58
# -DSIGTYPE=int - signal routines return int (default void)
60
# Sun running SunOS 4.x
61
# MISSING = -DSTRERROR_MISSING -DSTRCASE_MISSING
63
# SGI Personal Iris (Sys V derived)
64
# MISSING = -DSPRINTF_INT -DBLKSIZE_MISSING -DSTRERROR_MISSING -DRANDOM_MISSING
66
# VAX running Ultrix 3.x
67
# MISSING = -DSTRERROR_MISSING
69
# A generic 4.2 BSD machine
70
# (eliminate GETOPT_MISSING for 4.3 release)
71
# (eliminate STRCASE_MISSING and TMPNAM_MISSING for Tahoe release)
72
# MISSING = -DBSDSTDIO -DMEMCMP_MISSING -DMEMCPY_MISSING -DMEMSET_MISSING \
73
# -DSTRERROR_MISSING -DSTRTOD_MISSING -DVPRINTF_MISSING \
74
# -DSTRCASE_MISSING -DTMPNAM_MISSING \
75
# -DGETOPT_MISSING -DSTRCHR_MISSING -DSIGTYPE=int
77
# On Amdahl UTS, a SysVr2-derived system
78
# MISSING = -DBCOPY_MISSING -DSPRINTF_INT -DRANDOM_MISSING -DSTRERROR_MISSING \
79
# -DSTRCASE_MISSING -DDUP2_MISSING # -DBLKSIZE_MISSING ??????
81
# Comment out the next line if you don't have gcc.
82
# Also choose just one of -g and -O.
88
# for DOS, most of the missing symbols are defined in MISSING.C in order to
89
# get around the command line length limitations
90
MISSING = -DSPRINTF_INT -DBLKSIZE_MISSING -DBCOPY_MISSING
91
LINKFLAGS= /MAP /CO /FAR /PACKC /NOE /NOIG /st:0x1800
93
# also give suffixes and explicit rule for DOS
96
$(CC) -c $(CFLAGS) -Ipc.d -W2 -AL -Fo$*.o $<
100
DEBUG= #-DDEBUG #-DMEMDEBUG #-DFUNC_TRACE #-DMPROF
101
DEBUGGER= #-g -Bstatic
102
WARN= #-W -Wunused -Wimplicit -Wreturn-type -Wcomment # for gcc only
104
# Parser to use on grammar -- if you don't have bison use the first one
109
# Set equal to alloca.o if your system is S5 and you don't have
110
# alloca. Uncomment one of the rules below to make alloca.o from
111
# either alloca.s or alloca.c.
115
# With the exception of the alloca rule referred to above, you shouldn't
116
# need to customize this file below this point.
119
FLAGS= $(MISSING) $(DEBUG)
120
CFLAGS= $(FLAGS) $(DEBUGGER) $(PROFILE) $(OPTIMIZE) $(WARN)
123
O1 = main.o eval.o builtin.o msg.o debug.o io.o field.o array.o node.o
124
O2 = version.o missing.o $(POPEN)
126
AWKOBJS = $(O1) $(O2)
136
ALLOBJS = $(AWKOBJS) $(AWKTAB)
139
# GNU stuff that gawk uses as library routines.
140
GNUOBJS= regex.o $(ALLOCA)
142
# source and documentation files
143
SRC = main.c eval.c builtin.c msg.c \
144
debug.c io.c field.c array.c node.c missing.c
146
ALLSRC= $(SRC) awk.tab.c
148
AWKSRC= awk.h awk.y $(ALLSRC) version.sh patchlevel.h
150
GNUSRC = alloca.c alloca.s regex.c regex.h
152
COPIES = missing.d/dup2.c missing.d/gcvt.c missing.d/getopt.c \
153
missing.d/memcmp.c missing.d/memcpy.c missing.d/memset.c \
154
missing.d/random.c missing.d/strcase.c missing.d/strchr.c \
155
missing.d/strerror.c missing.d/strtod.c missing.d/tmpnam.c \
158
SUPPORT = support/texindex.c support/texinfo.tex
160
DOCS= gawk.1 gawk.texinfo
162
INFOFILES= gawk-info gawk-info-1 gawk-info-2 gawk-info-3 gawk-info-4 \
163
gawk-info-5 gawk-info-6 gawk.aux gawk.cp gawk.cps gawk.fn \
164
gawk.fns gawk.ky gawk.kys gawk.pg gawk.pgs gawk.toc \
165
gawk.tp gawk.tps gawk.vr gawk.vrs
167
MISC = CHANGES COPYING FUTURES Makefile PROBLEMS README
169
PCSTUFF= pc.d/Makefile.pc pc.d/popen.c pc.d/popen.h
171
ALLDOC= gawk.dvi $(INFOFILES)
173
ALLFILES= $(AWKSRC) $(GNUSRC) $(COPIES) $(MISC) $(DOCS) $(ALLDOC) $(PCSTUFF) $(SUPPORT)
175
# Release of gawk. There can be no leading or trailing white space here!
181
$(GAWK) : $(ALLOBJS) $(GNUOBJS) names.lnk
184
#GNULIB = ..\lib\lgnu.lib
189
echo $(AWKTAB) + >> $@
190
echo $(GNUOBJS) >> $@
193
echo $(GNULIB) $(LINKFLAGS) >> $@
195
popen.o : pc.d\popen.c
196
$(CC) -c $(CFLAGS) -Ipc.d -W2 -AL -Fo$*.o pc.d\popen.c
198
# rules to build gawk
199
#$(GAWK) : $(ALLOBJS) $(GNUOBJS)
200
# $(CC) -o gawk $(CFLAGS) $(ALLOBJS) $(GNUOBJS) -lm
206
#awk.tab.o: awk.h awk.tab.c
210
# -mv -f y.tab.c awk.tab.c
213
awk_tab.o : awk.y awk.h
215
$(CC) -c $(CFLAGS) -Ipc.d -W2 -AL -Fo$@ y_tab.c
218
version.c: version.sh
219
sh version.sh $(REL) > version.c
221
# Alloca: uncomment this if your system (notably System V boxen)
222
# does not have alloca in /lib/libc.a
225
# /lib/cpp < alloca.s | sed '/^#/d' > t.s
229
# If your machine is not supported by the assembly version of alloca.s,
230
# use the C version instead. This uses the default rules to make alloca.o.
234
# auxiliary rules for release maintenance
236
lint -hcbax $(FLAGS) $(ALLSRC)
239
cxref -c $(FLAGS) $(ALLSRC) | grep -v ' /' >xref
242
rm -f gawk *.o core awk.output awk.tab.c gmon.out make.out version.c
245
rm -f $(ALLDOC) gawk.log
247
gawk.dvi: gawk.texinfo
248
tex gawk.texinfo ; texindex gawk.??
249
tex gawk.texinfo ; texindex gawk.??
252
$(INFOFILES): gawk.texinfo
253
makeinfo gawk.texinfo
255
srcrelease: $(AWKSRC) $(GNUSRC) $(DOCS) $(MISC) $(COPIES) $(PCSTUFF) $(SUPPORT)
257
cp -p $(AWKSRC) $(GNUSRC) $(DOCS) $(MISC) gawk-$(REL)
258
-mkdir gawk-$(REL)/missing.d
259
cp -p $(COPIES) gawk-$(REL)/missing.d
260
-mkdir gawk-$(REL)/pc.d
261
cp -p $(PCSTUFF) gawk-$(REL)/pc.d
262
-mkdir gawk-$(REL)/support
263
cp -p $(SUPPORT) gawk-$(REL)/support
264
tar -cf - gawk-$(REL) | compress > gawk-$(REL).tar.Z
266
docrelease: $(ALLDOC)
267
-mkdir gawk-$(REL)-doc
268
cp -p $(INFOFILES) gawk.dvi gawk-$(REL)-doc
269
nroff -man gawk.1 > gawk-$(REL)-doc/gawk.1.pr
270
tar -cf - gawk-$(REL)-doc | compress > gawk-doc-$(REL).tar.Z
272
psrelease: docrelease
273
-mkdir gawk-postscript
274
dvi2ps gawk.dvi > gawk-postscript/gawk.postscript
275
psroff -t -man gawk.1 > gawk-postscript/gawk.1.ps
276
tar -cf - gawk-postscript | compress > gawk.postscript.tar.Z
278
release: srcrelease docrelease psrelease
279
rm -fr gawk-postscript gawk-$(REL) gawk-$(REL)-doc
282
for i in RCS/*; do rcsdiff -c -b $$i > `basename $$i ,v`.diff; done