2 # Makefile.am --- automake input file for gawk
4 # Copyright (C) 2000-2011 the Free Software Foundation, Inc.
6 # This file is part of GAWK, the GNU implementation of the
7 # AWK Programming Language.
9 # GAWK is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # GAWK is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 ## process this file with automake to produce Makefile.in
26 # This variable insures that aclocal runs
27 # correctly after changing configure.ac
28 ACLOCAL_AMFLAGS = -I m4
30 # This insures that make flags get passed down to child makes.
31 AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)'
33 # Stuff to include in the dist that doesn't need it's own
66 # It's OK for the generated file `version.c' not to be removed by
68 distcleancheck_listfiles = \
69 find . -type f -print | grep -v '^\./version\.c$$'
71 # The order to do things in.
72 # Build explicitly in "." in order to build gawk first, so
73 # that `make check' without a prior `make' works.
81 # what to make and install
82 bin_PROGRAMS = gawk pgawk dgawk
84 # sources for both gawk and pgawk
118 gawk_SOURCES = $(base_sources) eval.c profile.c
119 pgawk_SOURCES = $(base_sources) eval_p.c profile_p.c
120 dgawk_SOURCES = $(base_sources) eval_d.c profile.c cmd.h command.y debug.c
122 # Get extra libs as needed, Automake will supply LIBINTL and SOCKET_LIBS.
123 LDADD = $(LIBSIGSEGV) $(LIBINTL) $(SOCKET_LIBS)
124 dgawk_LDADD = $(LDADD) @LIBREADLINE@
126 # Directory for gawk's data files. Automake supplies datadir.
127 pkgdatadir = $(datadir)/awk
129 # stuff for compiling gawk/pgawk
130 DEFPATH='".$(PATH_SEPARATOR)$(pkgdatadir)"'
132 DEFS= -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"$(datadir)/locale"'
134 # Get rid of core files when cleaning
135 CLEANFILES = core core.*
137 MAINTAINERCLEANFILES = version.c
139 # We want hard links for install-exec-hook, below
142 # First, add a link from gawk to gawk-X.Y.Z.
145 # For GNU systems where gawk is awk, add a link to awk.
146 # (This is done universally, which may not always be right, but
147 # there's no easy way to distinguish GNU from non-GNU systems.)
149 (cd $(DESTDIR)$(bindir); \
150 $(LN) gawk$(EXEEXT) gawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \
151 $(LN) pgawk$(EXEEXT) pgawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \
153 then $(LN_S) gawk$(EXEEXT) awk; \
156 # Undo the above when uninstalling
158 (cd $(DESTDIR)$(bindir); \
159 if [ -f awk ] && cmp awk gawk$(EXEEXT) > /dev/null; then rm -f awk; fi ; \
160 rm -f gawk-$(VERSION)$(EXEEXT) pgawk-$(VERSION)$(EXEEXT); exit 0)
162 uninstall-recursive: uninstall-links
164 # force there to be a gawk executable before running tests
165 check-local: gawk$(EXEEXT) pgawk$(EXEEXT)
167 # A little extra clean up when making distributions.
168 # And additional set up for the pc directory.
170 cd $(distdir)/extension ; rm -f *.o *.so
172 sed -n -f configpk.sed < ../configure.ac > tmp.sed ; \
173 sed -f config.sed < ../configh.in > config.tmp ; \
174 sed -f tmp.sed < config.tmp > config.h ; \
175 $(RM) tmp.sed config.tmp
177 # Special rules for individual files
178 # Use of awk instead of $(AWK) is deliberate, in case gawk doesn't build
181 $(YACC) $(AM_YFLAGS) $(YFLAGS) $<
182 sed 's/parse error/syntax error/g' < y.tab.c | awk -f $(srcdir)/bisonfix.awk awkgram > $*.c && rm y.tab.c
183 if test -f y.tab.h; then \
184 if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
187 version.c: config.status version.in
188 $(SHELL) ./config.status --file=version.c:version.in
192 sed 's/parse error/syntax error/g' < y.tab.c | awk -f $(srcdir)/bisonfix.awk command > $*.c && rm y.tab.c
194 # This is for my development & testing.
196 $(CC) $(LDFLAGS) -o gawk $$(ls *.o | grep -v '_p.o$$') $(LIBS) -lefence
198 diffout valgrind-scan:
199 @cd test && $(MAKE) $(AM_MAKEFLAGS) $@
202 cd test; rm -f log.[0-9]*; \
203 make check AWK="valgrind --leak-check=full --log-file=log.%p ../gawk"; \