2
2
# Makefile.am --- automake input file for gawk
4
# Copyright (C) 2000-2023 the Free Software Foundation, Inc.
4
# Copyright (C) 2000-2014 the Free Software Foundation, Inc.
6
6
# This file is part of GAWK, the GNU implementation of the
7
7
# AWK Programming Language.
27
27
# correctly after changing configure.ac
28
28
ACLOCAL_AMFLAGS = -I m4
31
AM_LDFLAGS = @LDFLAGS@
30
# This insures that make flags get passed down to child makes.
31
AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)'
33
33
# Stuff to include in the dist that doesn't need it's own
34
34
# Makefile.am files
52
61
# The order to do things in.
54
# Build in support first, since we need the support library.
56
62
# Build explicitly in "." in order to build gawk first, so
57
63
# that `make check' without a prior `make' works.
60
# Build in extension before test so that
61
# ./configure && make check
67
# Build in awklib after in doc, since we want to extract
68
# sample files if doc/gawk.texi changed.
69
SUBDIRS += extras doc awklib po test
71
72
# what to make and install
72
73
bin_PROGRAMS = gawk
74
74
include_HEADERS = gawkapi.h
75
BUILT_SOURCES = $(srcdir)/pc/Makefile.tst
76
# sources for both gawk and dgawk
114
124
gawk_SOURCES = $(base_sources)
116
126
# Get extra libs as needed, Automake will supply LIBINTL and SOCKET_LIBS.
117
LDADD = support/libsupport.a \
118
$(LIBSIGSEGV) $(LIBINTL) $(SOCKET_LIBS) $(LIBREADLINE) $(LIBMPFR) \
127
LDADD = $(LIBSIGSEGV) $(LIBINTL) $(SOCKET_LIBS) $(LIBREADLINE) $(LIBMPFR)
121
129
# Directory for gawk's data files. Automake supplies datadir.
122
130
pkgdatadir = $(datadir)/awk
128
136
SHLIBEXT = "\"$(GAWKLIBEXT)"\"
129
137
DEFLIBPATH="\"$(pkgextensiondir)\""
131
DEFS= -DDEFPATH=$(DEFPATH) -DDEFLIBPATH=$(DEFLIBPATH) -DSHLIBEXT=$(SHLIBEXT) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"$(datadir)/locale"' -I"$(srcdir)/support"
139
DEFS= -DDEFPATH=$(DEFPATH) -DDEFLIBPATH=$(DEFLIBPATH) -DSHLIBEXT=$(SHLIBEXT) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"$(datadir)/locale"'
133
141
# Get rid of core files when cleaning
134
CLEANFILES = core core.* $(bin_SCRIPTS)
142
CLEANFILES = core core.*
136
144
# We want hard links for install-exec-hook, below
142
# For some make's, e.g. OpenBSD, that don't define this
146
DEBUG = -gdwarf-4 -g3
148
147
# First, add a link from gawk to gawk-X.Y.Z.
150
149
# For GNU systems where gawk is awk, add a link to awk.
151
150
# (This is done universally, which may not always be right, but
152
151
# there's no easy way to distinguish GNU from non-GNU systems.)
154
# Use the transform, in case --program-prefix=XXX
155
152
install-exec-hook:
156
153
(cd $(DESTDIR)$(bindir); \
157
name=`echo gawk | sed '$(transform)'` ; \
158
if [ ! -f gawk-$(VERSION)$(EXEEXT) ]; \
159
then $(LN) $${name}$(EXEEXT) gawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \
161
if [ ! -f awk$(EXEEXT) ]; \
162
then $(LN_S) $${name}$(EXEEXT) awk$(EXEEXT); \
154
$(LN) gawk$(EXEEXT) gawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \
156
then $(LN_S) gawk$(EXEEXT) awk; \
165
159
# Undo the above when uninstalling
167
161
(cd $(DESTDIR)$(bindir); \
168
name=`echo gawk | sed '$(transform)'` ; \
169
if [ -f awk$(EXEEXT) ] && cmp awk$(EXEEXT) $${name}$(EXEEXT) > /dev/null; then rm -f awk$(EXEEXT); fi ; \
162
if [ -f awk ] && cmp awk gawk$(EXEEXT) > /dev/null; then rm -f awk; fi ; \
170
163
rm -f gawk-$(VERSION)$(EXEEXT); exit 0)
172
165
uninstall-recursive: uninstall-links
175
168
check-local: gawk$(EXEEXT)
177
170
# A little extra clean up when making distributions.
171
# And additional set up for the pc directory.
179
cd "$(distdir)"/extension ; rm -f *.o *.so
180
cd "$(srcdir)"/pc ; \
173
cd $(distdir)/extension ; rm -f *.o *.so
181
175
chmod u+w config.h ; \
182
176
sed -n -f configpk.sed < ../configure.ac > /tmp/tmp.sed ; \
183
177
sed -f config.sed < ../configh.in > /tmp/config.tmp ; \
184
178
sed -f /tmp/tmp.sed < /tmp/config.tmp > config.h ; \
185
179
$(RM) /tmp/tmp.sed /tmp/config.tmp
187
chmod u+w "$(distdir)"/pc/config.h
188
cp "$(srcdir)"/pc/config.h "$(distdir)"/pc/config.h
181
chmod u+w $(distdir)/pc/config.h
182
cp $(srcdir)/pc/config.h $(distdir)/pc/config.h
190
184
# Special rules for individual files
192
$(srcdir)/awkgram.c: awkgram.y
193
$(YACC) -o $@ $(AM_YFLAGS) $(YFLAGS) $<
194
sed 's/parse error/syntax error/g' < $@ > $@.tmp && mv $@.tmp $@
196
$(srcdir)/command.c: command.y
197
$(YACC) -o $@ -p zz $<
198
sed 's/parse error/syntax error/g' < $@ > $@.tmp && mv $@.tmp $@
200
$(srcdir)/pc/Makefile.tst: test/Makefile.in pc/Makefile.tst.prologue pc/GenMakefileTst.awk
201
$(AM_V_GEN)$(MKDIR_P) "$(srcdir)"/pc && \
202
cat "$(srcdir)"/pc/Makefile.tst.prologue > "$(srcdir)"/pc/Makefile.tst && \
203
$(AWK) -f "$(srcdir)"/pc/GenMakefileTst.awk "$(srcdir)"/test/Makefile.in >> "$(srcdir)"/pc/Makefile.tst
185
# Use of awk instead of $(AWK) is deliberate, in case gawk doesn't build
189
$(YACC) $(AM_YFLAGS) $(YFLAGS) $<
190
sed 's/parse error/syntax error/g' < y.tab.c | awk -f $(srcdir)/bisonfix.awk awkgram > $*.c && rm y.tab.c
191
if test -f y.tab.h; then \
192
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
197
sed 's/parse error/syntax error/g' < y.tab.c | awk -f $(srcdir)/bisonfix.awk command > $*.c && rm y.tab.c
205
199
# This is for my development & testing.
207
$(CC) $(AM_LDFLAGS) -o gawk $$(ls *.o | grep -v '_p.o$$') $(LDADD) $(LIBS) -lefence
201
$(CC) $(LDFLAGS) -o gawk $$(ls *.o | grep -v '_p.o$$') $(LIBS) -lefence
209
diffout valgrind-scan zos-diffout:
203
diffout valgrind-scan:
210
204
@cd test && $(MAKE) $(AM_MAKEFLAGS) $@