-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
223 lines (193 loc) · 5.43 KB
/
Makefile.am
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
#
# Makefile.am --- automake input file for gawk
#
# Copyright (C) 2000-2011 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
#
# GAWK is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GAWK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
## process this file with automake to produce Makefile.in
# This variable insures that aclocal runs
# correctly after changing configure.ac
ACLOCAL_AMFLAGS = -I m4
# This insures that make flags get passed down to child makes.
AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)'
# Stuff to include in the dist that doesn't need it's own
# Makefile.am files
EXTRA_DIST = \
ChangeLog.0 \
COPYING \
FUTURES \
INSTALL \
LIMITATIONS \
NEWS \
NEWS.0 \
POSIX.STD \
PROBLEMS \
README_d \
bisonfix.awk \
config.guess \
config.rpath \
config.sub \
depcomp \
m4 \
missing \
missing_d \
po/README \
pc \
posix \
regcomp.c \
regex_internal.c \
regex_internal.h \
regexec.c \
version.in \
vms \
ylwrap
# It's OK for the generated file `version.c' not to be removed by
# "make distclean".
distcleancheck_listfiles = \
find . -type f -print | grep -v '^\./version\.c$$'
# The order to do things in.
# Build explicitly in "." in order to build gawk first, so
# that `make check' without a prior `make' works.
SUBDIRS = \
. \
awklib \
doc \
po \
extension \
test
# what to make and install
bin_PROGRAMS = gawk
include_HEADERS = gawkapi.h
# sources for both gawk and dgawk
base_sources = \
array.c \
awk.h \
awkgram.y \
builtin.c \
cint_array.c \
cmd.h \
command.y \
custom.h \
debug.c \
dfa.c \
dfa.h \
eval.c \
ext.c \
field.c \
floatcomp.c \
floatmagic.h \
gawkapi.c \
gawkapi.h \
gawkmisc.c \
getopt.c \
getopt.h \
getopt1.c \
getopt_int.h \
gettext.h \
int_array.c \
interpret.h \
io.c \
mbsupport.h \
main.c \
mpfr.c \
msg.c \
node.c \
profile.c \
protos.h \
random.c \
random.h \
re.c \
regex.c \
regex.h \
replace.c \
str_array.c \
symbol.c \
version.c \
xalloc.h
gawk_SOURCES = $(base_sources)
# Get extra libs as needed, Automake will supply LIBINTL and SOCKET_LIBS.
LDADD = $(LIBSIGSEGV) $(LIBINTL) $(SOCKET_LIBS) @LIBREADLINE@ @LIBMPFR@
# Directory for gawk's data files. Automake supplies datadir.
pkgdatadir = $(datadir)/awk
# stuff for compiling gawk/pgawk
DEFPATH='".$(PATH_SEPARATOR)$(pkgdatadir)"'
# shared library support:
SHLIBEXT = "\"$(GAWKLIBEXT)"\"
DEFLIBPATH="\"$(pkgextensiondir)\""
DEFS= -DDEFPATH=$(DEFPATH) -DDEFLIBPATH=$(DEFLIBPATH) -DSHLIBEXT=$(SHLIBEXT) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"$(datadir)/locale"'
# Get rid of core files when cleaning
CLEANFILES = core core.*
MAINTAINERCLEANFILES = version.c
# We want hard links for install-exec-hook, below
LN= ln
# First, add a link from gawk to gawk-X.Y.Z.
#
# For GNU systems where gawk is awk, add a link to awk.
# (This is done universally, which may not always be right, but
# there's no easy way to distinguish GNU from non-GNU systems.)
install-exec-hook:
(cd $(DESTDIR)$(bindir); \
$(LN) gawk$(EXEEXT) gawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \
if [ ! -f awk ]; \
then $(LN_S) gawk$(EXEEXT) awk; \
fi; exit 0)
# Undo the above when uninstalling
uninstall-links:
(cd $(DESTDIR)$(bindir); \
if [ -f awk ] && cmp awk gawk$(EXEEXT) > /dev/null; then rm -f awk; fi ; \
rm -f gawk-$(VERSION)$(EXEEXT); exit 0)
uninstall-recursive: uninstall-links
# force there to be a gawk executable before running tests
check-local: gawk$(EXEEXT)
# A little extra clean up when making distributions.
# And additional set up for the pc directory.
dist-hook:
cd $(distdir)/extension ; rm -f *.o *.so
cd $(srcdir)/pc ; \
sed -n -f configpk.sed < ../configure.ac > tmp.sed ; \
sed -f config.sed < ../configh.in > config.tmp ; \
sed -f tmp.sed < config.tmp > config.h ; \
$(RM) tmp.sed config.tmp
# Special rules for individual files
# Use of awk instead of $(AWK) is deliberate, in case gawk doesn't build
# or work correctly.
awkgram.c: awkgram.y
$(YACC) $(AM_YFLAGS) $(YFLAGS) $<
sed 's/parse error/syntax error/g' < y.tab.c | awk -f $(srcdir)/bisonfix.awk awkgram > $*.c && rm y.tab.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
version.c: config.status version.in
$(SHELL) ./config.status --file=version.c:version.in
command.c: command.y
$(YACC) -p zz $<
sed 's/parse error/syntax error/g' < y.tab.c | awk -f $(srcdir)/bisonfix.awk command > $*.c && rm y.tab.c
# This is for my development & testing.
efence: gawk
$(CC) $(LDFLAGS) -o gawk $$(ls *.o | grep -v '_p.o$$') $(LIBS) -lefence
diffout valgrind-scan:
@cd test && $(MAKE) $(AM_MAKEFLAGS) $@
valgrind:
cd test; rm -f log.[0-9]*; \
make check VALGRIND="valgrind --leak-check=full --log-file=log.%p"; \
make valgrind-scan
valgrind-noleak:
cd test; rm -f log.[0-9]*; \
make check VALGRIND="valgrind --leak-check=no --log-file=log.%p"; \
make valgrind-scan