1#
2# Makefile.am --- automake input file for gawk
3#
4# Copyright (C) 2000-2003 the Free Software Foundation, Inc.
5#
6# This file is part of GAWK, the GNU implementation of the
7# AWK Programming Language.
8#
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 2 of the License, or
12# (at your option) any later version.
13#
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.
18#
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
22#
23
24## process this file with automake to produce Makefile.in
25
26# Automatic de-ANSI-fication if needed, make .bz2 files also.
27AUTOMAKE_OPTIONS = ansi2knr dist-bzip2
28
29# This undocumented variable insures that aclocal runs
30# correctly after changing configure.ac
31ACLOCAL_AMFLAGS = -I m4
32
33# This insures that make flags get passed down to child makes.
34AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)'
35
36# Stuff to include in the dist that doesn't need it's own
37# Makefile.am files
38EXTRA_DIST = \
39	COPYING \
40	FUTURES \
41	INSTALL \
42	LIMITATIONS \
43	NEWS \
44	POSIX.STD \
45	PROBLEMS \
46	README_d \
47	bisonfix.sed \
48	config.guess \
49	config.rpath  \
50	config.sub \
51	depcomp \
52	extension \
53	fixvers \
54	m4 \
55	missing \
56	missing_d \
57	pc \
58	posix \
59	regcomp.c \
60	regex_internal.c \
61	regex_internal.h \
62	regexec.c \
63	unsupported \
64	vms \
65	ylwrap
66
67# The order to do things in.
68# Build in intl first in case we need the local gettext version.
69# Build explicitly  "." next in order to build gawk first, so
70# that `make check' without a prior `make' works.
71SUBDIRS = \
72	intl \
73	. \
74	awklib \
75	doc \
76	po \
77	test
78
79# what to make and install
80bin_PROGRAMS = gawk pgawk
81
82# sources for both gawk and pgawk
83base_sources = \
84	array.c \
85	awk.h \
86	awkgram.y \
87	builtin.c \
88	custom.h \
89	ext.c \
90	field.c \
91	gawkmisc.c \
92	getopt.c \
93	getopt.h \
94	getopt1.c \
95	gettext.h \
96	io.c \
97	main.c \
98	msg.c \
99	node.c \
100	patchlev.h \
101	protos.h \
102	random.c \
103	random.h \
104	re.c \
105	regex.c \
106	regex.h \
107	replace.c \
108	version.in \
109	version.c
110
111gawk_SOURCES = $(base_sources) eval.c profile.c
112pgawk_SOURCES = $(base_sources) eval_p.c profile_p.c
113
114# Get extra libs as needed
115LDADD = @LIBINTL@ @SOCKET_LIBS@
116
117# Set autoconf Makefile.in variables correctly
118datadir = @datadir@
119awkdatadir = @datadir@/awk
120libexecdir = @libexecdir@/awk
121
122# stuff for compiling gawk/pgawk
123DEFPATH="\".$(PATH_SEPARATOR)$(awkdatadir)\""
124
125DEFS= -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR="\"$(datadir)/locale\""
126
127INCLUDES = -I$(srcdir)/intl
128
129# We want hard links for install-exec-hook, below
130LN= ln
131
132# First, add a link from gawk to gawk-X.Y.Z
133# Same for pgawk
134# For systems where gawk is awk, add a link to awk
135install-exec-hook:
136	(fullname=gawk-`./gawk --version | sed 1q | awk '{print $$3}'` ; \
137	cd $(DESTDIR)$(bindir); \
138	$(LN) gawk $$fullname 2>/dev/null ; \
139	$(LN) pgawk p$$fullname 2>/dev/null ; \
140	if [ ! -f awk$(EXEEXT) ]; \
141	then	$(LN_S) gawk$(EXEEXT) awk$(EXEEXT); \
142	fi; exit 0)
143
144# Undo the above when uninstalling
145uninstall-links:
146	(cd $(DESTDIR)$(bindir); \
147	if [ -f awk$(EXEEXT) ] && cmp awk$(EXEEXT) gawk$(EXEEXT) > /dev/null; then rm -f awk$(EXEEXT); fi ; \
148	fullname=gawk-`./gawk --version | sed 1q | ./gawk '{print $$3}'` ; \
149	rm -f $$fullname p$$fullname; exit 0)
150
151uninstall-recursive: uninstall-links
152
153# force there to be a gawk executable before running tests
154check-local: gawk$(EXEEXT) pgawk$(EXEEXT)
155
156# A little extra clean up when making distributions.
157# FIXME: most of this rule should go away upon switching to libtool.
158dist-hook:
159	cd $(distdir)/extension ; rm -f *.o *.so
160
161# Special rules for individual files
162awkgram.c: awkgram.y
163	$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && sed -f $(srcdir)/bisonfix.sed < y.tab.c > $*.c && $(RM) y.tab.c
164	if test -f y.tab.h; then \
165	if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
166	else :; fi
167
168# These force version and patchlevel to be up to date based
169# on what's in configure.ac.  No-one else but me should have
170# to use them. So there.
171patchlev.h: configure.ac
172	$(srcdir)/fixvers -p
173
174version.c: configure.ac version.in
175	$(srcdir)/fixvers -v
176
177# This is for my development & testing.
178efence: gawk
179	$(CC) $(LDFLAGS) -o gawk $$(ls *.o | grep -v '_p.o$$') $(LIBS) -lefence
180