Blame Makefile.am

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