The base/count bounds checking was insufficient, leading to a kernel memory
[dragonfly.git] / contrib / awk / Makefile.in
1 # Makefile for GNU Awk.
2 #
3 # Copyright (C) 1986, 1988-2000 the Free Software Foundation, Inc.
4
5 # This file is part of GAWK, the GNU implementation of the
6 # AWK Programming Language.
7
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 2 of the License, or
11 # (at your option) any later version.
12
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.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
21
22 @SET_MAKE@
23
24 MAKEINFO = makeinfo --no-split
25
26 srcdir = @srcdir@
27 VPATH = @srcdir@
28
29 CC = @CC@
30 YACC = @YACC@
31
32 INSTALL = @INSTALL@
33 INSTALL_PROGRAM = @INSTALL_PROGRAM@
34 INSTALL_DATA = @INSTALL_DATA@
35
36 LDFLAGS = @LDFLAGS@
37 LIBS = @LIBS@
38
39 ALLOCA = @ALLOCA@
40
41 LN = ln
42 LN_S = @LN_S@
43
44 exec_prefix = @exec_prefix@
45 prefix = @prefix@
46 binprefix =
47 manprefix =
48
49 bindir = @bindir@
50 libdir = @libdir@
51 manexta = 1
52 mandir = @mandir@/man$(manexta)
53 manext = .$(manexta)
54 infodir = @infodir@
55 datadir = @datadir@/awk
56 libexecdir = @libexecdir@/awk
57
58 DEFPATH = ".:$(datadir)"
59
60 SHELL = /bin/sh
61 CPPFLAGS = @CPPFLAGS@
62 CFLAGS = @CFLAGS@
63 COMPFLAGS = -DGAWK -I. -I$(srcdir) $(CPPFLAGS) @DEFS@ $(CFLAGS)
64
65 # object files
66 AWKOBJS = array.o builtin.o eval.o field.o gawkmisc.o io.o main.o \
67         missing.o msg.o node.o re.o version.o
68
69 ALLOBJS = $(AWKOBJS) awktab.o
70
71 # LIBOBJS
72 #       GNU and other stuff that gawk uses as library routines.
73 LIBOBJS= getopt.o getopt1.o regex.o dfa.o random.o $(ALLOCA)
74
75 # source and documentation files
76 SRC = array.c builtin.c eval.c field.c gawkmisc.c io.c main.c \
77         missing.c msg.c node.c re.c version.c
78
79 ALLSRC= $(SRC) awktab.c
80
81 AWKSRC= awk.h awk.y custom.h $(ALLSRC) patchlevel.h protos.h random.h
82
83 LIBSRC = alloca.c dfa.c dfa.h regex.c regex.h getopt.h getopt.c getopt1.c random.c
84
85 COPIES = missing/system.c missing/tzset.c \
86         missing/memcmp.c missing/memcpy.c missing/memset.c \
87         missing/strncasecmp.c missing/strchr.c \
88         missing/strerror.c missing/strtod.c \
89         missing/strftime.c missing/strftime.3 
90
91 DOCS= doc/gawk.1 doc/gawk.texi doc/texinfo.tex
92
93 TEXFILES= doc/gawk.aux doc/gawk.cp doc/gawk.cps doc/gawk.fn doc/gawk.fns \
94           doc/gawk.ky doc/gawk.kys doc/gawk.pg doc/gawk.pgs doc/gawk.toc \
95           doc/gawk.tp doc/gawk.tps doc/gawk.vr doc/gawk.vrs
96
97 MISC =  NEWS COPYING FUTURES Makefile.in PROBLEMS README PORTS POSIX.STD \
98         configure configure.in acconfig.h configh.in ACKNOWLEDGMENT \
99         ChangeLog INSTALL LIMITATIONS install-sh mkinstalldirs aclocal.m4 \
100         stamp-h.in
101
102 OTHERS= doc pc atari vms README_d posix awklib
103
104 ALLDOC= doc/gawk.dvi $(TEXFILES) doc/gawk.info*
105
106 MAKEFILEIN = Makefile.in awklib/Makefile.in doc/Makefile.in test/Makefile.in
107
108 # Release of gawk.  There can be no leading or trailing white space here!
109 REL=3.0
110
111 # clear out suffixes list
112 .SUFFIXES:
113 .SUFFIXES: .c .o
114
115 .c.o:
116         $(CC) -c $(COMPFLAGS) $<
117
118 # rules to build gawk
119 all:    gawk awklib/all doc/all
120
121 # stuff to make sure that configure has been run.
122 $(srcdir)/configure:    configure.in aclocal.m4
123         cd $(srcdir) && autoconf
124
125 # autoheader might not change confh.in, so touch a stamp file
126 $(srcdir)/configh.in:   stamp-h.in
127 $(srcdir)/stamp-h.in:   configure.in aclocal.m4 acconfig.h
128         cd $(srcdir) && autoheader
129         date > $(srcdir)/stamp-h.in
130
131 config.h:       stamp-h
132 stamp-h:        configh.in config.status
133         $(SHELL) ./config.status
134
135 Makefile:       $(MAKEFILEIN) config.status
136         $(SHELL) ./config.status
137
138 config.status:  configure
139         $(SHELL) ./config.status --recheck
140
141 # Note: if you need something at both compile time and link time, like -pg,
142 # you will have to edit the Makefile manually to set LDFLAGS.
143 gawk:   $(ALLOBJS) $(LIBOBJS) $(REOBJS)
144         $(CC) -o gawk $(CFLAGS) $(LDFLAGS) $(ALLOBJS) $(LIBOBJS) $(REOBJS) $(LIBS)
145
146 $(ALLOBJS):     awk.h dfa.h regex.h config.h custom.h
147
148 $(LIBOBJS):     config.h custom.h
149
150 # SunOS make's (at least) VPATH doesn't do subdirectories...
151 # Solaris make doesn't allow $< in the actual rule
152 gawkmisc.o:     $(srcdir)/atari/gawkmisc.atr \
153                 $(srcdir)/pc/gawkmisc.pc $(srcdir)/posix/gawkmisc.c \
154                 $(srcdir)/vms/gawkmisc.vms
155         $(CC) -c $(COMPFLAGS) -DDEFPATH='$(DEFPATH)' $(srcdir)/gawkmisc.c
156
157 getopt.o:       getopt.h
158
159 getopt1.o:      getopt.h
160
161 builtin.o: random.h
162
163 main.o: patchlevel.h
164
165 awktab.c:       awk.y
166         $(YACC) -v $(srcdir)/awk.y && \
167         if test -f y.tab.c ; then mv y.tab.c ytab.c ; else true ; fi && \
168         sed '/^extern char .malloc(), .realloc();$$/d' ytab.c >awktab.c && \
169         rm ytab.c
170
171 # VMS POSIX make won't apply the default .c.o rule to awktab.o for some reason
172 awktab.o:       awktab.c awk.h
173         $(CC) -c $(COMPFLAGS) $(srcdir)/awktab.c
174
175 alloca.o:       alloca.c
176
177 install:        gawk info installdirs
178         -rm -f $(bindir)/gawk
179         fullname=gawk-$(REL).`./gawk '{print $$3}' $(srcdir)/patchlevel.h` ; \
180         $(INSTALL_PROGRAM) gawk $(bindir)/$$fullname ; \
181         (cd $(bindir); $(LN) $$fullname gawk)
182         (cd $(bindir); \
183         if [ ! -f awk ]; \
184         then    $(LN_S) gawk awk; \
185         fi; exit 0)
186         cd doc && $(MAKE) install
187         cd awklib && $(MAKE) install
188
189 installdirs: mkinstalldirs
190         $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
191                 $(libdir) $(infodir) $(mandir) $(libexecdir)
192
193 install-strip:
194         $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
195
196 uninstall:
197         (cd $(bindir); \
198         if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi)
199         (fullname=gawk-$(REL).`gawk '{print $$3}' $(srcdir)/patchlevel.h` ; \
200         cd $(bindir); \
201         if cmp gawk $$fullname; then rm -f gawk; fi ; \
202         rm -f $(bindir)/$$fullname)
203         cd doc && $(MAKE) uninstall
204         cd awklib && $(MAKE) uninstall
205         -rmdir $(datadir) $(libexecdir)
206
207 # auxiliary rules for release maintenance
208 lint:   $(ALLSRC)
209         lint -hcbax $(COMPFLAGS) $(ALLSRC)
210
211 xref:
212         cxref -c $(COMPFLAGS) $(ALLSRC) | grep -v '     /' >xref
213
214 mostlyclean:
215         : mostly clean does nothing for gawk
216         : use "make clean" to really clean things out
217
218 clean:
219         rm -rf gawk *.o core */core y.output
220         cd doc && $(MAKE) clean
221         cd test && $(MAKE) clean
222         cd awklib && $(MAKE) clean
223
224 local-distclean:
225         rm -f Makefile *.orig *.rej */*.orig */*.rej awk.output \
226                 gmon.out make.out config.h config.status config.cache \
227                 config.log stamp-h tags TAGS *~
228
229 distclean: clean local-distclean
230         cd doc && $(MAKE) distclean
231         cd awklib && $(MAKE) distclean
232         cd test && $(MAKE) distclean
233
234 maintainer-clean: clean local-distclean
235         @echo "This command is intended for maintainers to use; it"
236         @echo "deletes files that may require special tools to rebuild."
237         rm -f awktab.c
238         cd doc && $(MAKE) maintainer-clean
239         cd test && $(MAKE) maintainer-clean
240         cd awklib && $(MAKE) maintainer-clean
241
242 clobber:        maintainer-clean
243
244 TAGS:
245         etags $(AWKSRC)
246
247 tags:
248         ctags $(AWKSRC)
249
250 dvi:    $(srcdir)/doc/gawk.texi
251         cd doc && $(MAKE) dvi
252
253 info:   $(srcdir)/doc/gawk.texi
254         cd doc && $(MAKE) info
255
256 doc/all:
257         cd doc && $(MAKE) all
258
259 awklib/all: gawk
260         cd awklib && $(MAKE) CFLAGS="$(CFLAGS)" all
261
262 dist:   $(AWKSRC) $(LIBSRC) $(DOCS) $(MISC) $(COPIES) awklib/stamp-eg info distclean
263         -rm -rf gawk-$(REL)*
264         dir=gawk-$(REL).`gawk '{print $$3}' patchlevel.h` && \
265         mkdir $$dir && \
266         cp -pr $(AWKSRC) $(LIBSRC) $(MISC) $$dir && \
267         mkdir $$dir/missing && \
268         cp -p $(COPIES) $$dir/missing && \
269         for i in $(OTHERS); \
270         do \
271                 cp -pr $$i $$dir ; \
272         done && \
273         cp -pr test $$dir && \
274         find $$dir -type d -exec chmod 777 {} ';' && \
275         find $$dir -print | doschk && \
276         tar -cf - $$dir | gzip > $$dir.tar.gz && \
277         rm -fr $$dir
278
279 awklib/stamp-eg:
280         cd awklib ; $(MAKE) stamp-eg
281
282 check:  gawk
283         cd test; $(MAKE) -k
284
285 test:   check
286