build: use Automake 1.14's non-recursive Makefile features

* configure.ac: Require Automake 1.14.
* examples/calc++/local.mk, examples/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk, tests/local.mk: Use %D% and %C%.
This commit is contained in:
Akim Demaille
2013-11-05 14:32:20 +01:00
parent 60dcc936ce
commit afc4457605
6 changed files with 54 additions and 65 deletions

View File

@@ -33,11 +33,7 @@ AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here: # We use Automake 1.14's %D% and %C%.
#
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
#
# To avoid 1.11, we make 1.11.1 the minimum version.
# #
# We want gnits strictness only when rolling a stable release. For # We want gnits strictness only when rolling a stable release. For
# release candidates, we use version strings like 2.4.3_rc1, but gnits # release candidates, we use version strings like 2.4.3_rc1, but gnits
@@ -45,7 +41,7 @@ AC_CONFIG_MACRO_DIR([m4])
# releases, we want to be able run make dist without being required to # releases, we want to be able run make dist without being required to
# add a bogus NEWS entry. In that case, the version string # add a bogus NEWS entry. In that case, the version string
# automatically contains a dash, which we also let disable gnits. # automatically contains a dash, which we also let disable gnits.
AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc
color-tests parallel-tests color-tests parallel-tests
silent-rules] silent-rules]
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]], m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],

View File

@@ -19,7 +19,7 @@
# Don't depend on $(BISON) otherwise we would rebuild these files # Don't depend on $(BISON) otherwise we would rebuild these files
# in srcdir, including during distcheck, which is forbidden. # in srcdir, including during distcheck, which is forbidden.
examples/calc++/calc++-parser.stamp: $(BISON_IN) %D%/calc++-parser.stamp: $(BISON_IN)
SUFFIXES += .yy .stamp SUFFIXES += .yy .stamp
.yy.stamp: .yy.stamp:
$(AM_V_YACC)rm -f $@ $(AM_V_YACC)rm -f $@
@@ -27,14 +27,14 @@ SUFFIXES += .yy .stamp
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $< $(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
$(AM_V_at)mv -f $@.tmp $@ $(AM_V_at)mv -f $@.tmp $@
$(calc_sources_generated): examples/calc++/calc++-parser.stamp $(calc_sources_generated): %D%/calc++-parser.stamp
@test -f $@ || rm -f examples/calc++/calc++-parser.stamp @test -f $@ || rm -f %D%/calc++-parser.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/calc++-parser.stamp
CLEANFILES += \ CLEANFILES += \
$(calc_sources_generated) \ $(calc_sources_generated) \
examples/calc++/calc++-parser.output \ %D%/calc++-parser.output \
examples/calc++/calc++-parser.stamp \ %D%/calc++-parser.stamp \
examples/calc++/calc++-scanner.cc %D%/calc++-scanner.cc
## -------------------- ## ## -------------------- ##
@@ -42,35 +42,35 @@ CLEANFILES += \
## -------------------- ## ## -------------------- ##
# Avoid using BUILT_SOURCES which is too global. # Avoid using BUILT_SOURCES which is too global.
$(examples_calc___calc___OBJECTS): $(calc_sources_generated) $(%C%_calc___OBJECTS): $(calc_sources_generated)
calc_sources_extracted = \ calc_sources_extracted = \
examples/calc++/calc++-driver.cc \ %D%/calc++-driver.cc \
examples/calc++/calc++-driver.hh \ %D%/calc++-driver.hh \
examples/calc++/calc++-scanner.ll \ %D%/calc++-scanner.ll \
examples/calc++/calc++.cc %D%/calc++.cc
calc_extracted = \ calc_extracted = \
$(calc_sources_extracted) \ $(calc_sources_extracted) \
examples/calc++/calc++-parser.yy %D%/calc++-parser.yy
extracted += $(calc_extracted) extracted += $(calc_extracted)
calc_sources_generated = \ calc_sources_generated = \
examples/calc++/calc++-parser.cc \ %D%/calc++-parser.cc \
examples/calc++/calc++-parser.hh \ %D%/calc++-parser.hh \
examples/calc++/location.hh \ %D%/location.hh \
examples/calc++/position.hh \ %D%/position.hh \
examples/calc++/stack.hh %D%/stack.hh
calc_sources = \ calc_sources = \
$(calc_sources_extracted) \ $(calc_sources_extracted) \
$(calc_sources_generated) $(calc_sources_generated)
if FLEX_CXX_WORKS if FLEX_CXX_WORKS
check_PROGRAMS += examples/calc++/calc++ check_PROGRAMS += %D%/calc++
nodist_examples_calc___calc___SOURCES = \ nodist_%C%_calc___SOURCES = \
$(calc_sources) $(calc_sources)
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++ %C%_calc___CPPFLAGS = -I$(top_builddir)/%D%
examples_calc___calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS) %C%_calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
dist_TESTS += examples/calc++/calc++.test dist_TESTS += %D%/calc++.test
else else
EXTRA_DIST += examples/calc++/calc++.test EXTRA_DIST += %D%/calc++.test
endif endif

View File

@@ -13,8 +13,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
dist_noinst_SCRIPTS = examples/extexi examples/test dist_noinst_SCRIPTS = %D%/extexi %D%/test
TEST_LOG_COMPILER = $(top_srcdir)/examples/test TEST_LOG_COMPILER = $(top_srcdir)/%D%/test
AM_CXXFLAGS = \ AM_CXXFLAGS = \
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS) $(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
@@ -24,20 +24,20 @@ AM_CXXFLAGS = \
## ------------ ## ## ------------ ##
doc = $(top_srcdir)/doc/bison.texi doc = $(top_srcdir)/doc/bison.texi
extexi = $(top_srcdir)/examples/extexi extexi = $(top_srcdir)/%D%/extexi
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(doc) -- extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(doc) --
extracted = extracted =
CLEANFILES += $(extracted) examples/extracted.stamp CLEANFILES += $(extracted) %D%/extracted.stamp
examples/extracted.stamp: $(doc) $(extexi) %D%/extracted.stamp: $(doc) $(extexi)
$(AM_V_GEN)rm -f $@ $@.tmp $(AM_V_GEN)rm -f $@ $@.tmp
$(AM_V_at)touch $@.tmp $(AM_V_at)touch $@.tmp
$(AM_V_at)$(extract) $(extracted) $(AM_V_at)$(extract) $(extracted)
$(AM_V_at)mv $@.tmp $@ $(AM_V_at)mv $@.tmp $@
$(extracted): examples/extracted.stamp $(extracted): %D%/extracted.stamp
@test -f $@ || rm -f examples/extracted.stamp @test -f $@ || rm -f %D%/extracted.stamp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
include examples/calc++/local.mk include %D%/calc++/local.mk
include examples/mfcalc/local.mk include %D%/mfcalc/local.mk
include examples/rpcalc/local.mk include %D%/rpcalc/local.mk

View File

@@ -18,19 +18,15 @@
## -------------------- ## ## -------------------- ##
BUILT_SOURCES += $(mfcalc_sources) BUILT_SOURCES += $(mfcalc_sources)
CLEANFILES += examples/mfcalc/mfcalc.[ch] examples/mfcalc/mfcalc.output CLEANFILES += %D%/mfcalc.[ch] %D%/mfcalc.output
mfcalc_extracted = \ mfcalc_extracted = %D%/calc.h %D%/mfcalc.y
examples/mfcalc/calc.h \ mfcalc_sources = $(mfcalc_extracted)
examples/mfcalc/mfcalc.y
mfcalc_sources = \
$(mfcalc_extracted)
extracted += $(mfcalc_extracted) extracted += $(mfcalc_extracted)
check_PROGRAMS += examples/mfcalc/mfcalc check_PROGRAMS += %D%/mfcalc
examples_mfcalc_mfcalc_LDADD = -lm %C%_mfcalc_LDADD = -lm
nodist_examples_mfcalc_mfcalc_SOURCES = \ nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
$(mfcalc_sources)
examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc %C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D%
dist_TESTS += examples/mfcalc/mfcalc.test dist_TESTS += %D%/mfcalc.test

View File

@@ -18,18 +18,15 @@
## -------------------- ## ## -------------------- ##
BUILT_SOURCES += $(rpcalc_sources) BUILT_SOURCES += $(rpcalc_sources)
CLEANFILES += examples/rpcalc/rpcalc.[ch] examples/rpcalc/rpcalc.output CLEANFILES += %D%/rpcalc.[ch] %D%/rpcalc.output
rpcalc_extracted = \ rpcalc_extracted = %D%/rpcalc.y
examples/rpcalc/rpcalc.y rpcalc_sources = $(rpcalc_extracted)
rpcalc_sources = \
$(rpcalc_extracted)
extracted += $(rpcalc_extracted) extracted += $(rpcalc_extracted)
check_PROGRAMS += examples/rpcalc/rpcalc check_PROGRAMS += %D%/rpcalc
examples_rpcalc_rpcalc_LDADD = -lm %C%_rpcalc_LDADD = -lm
nodist_examples_rpcalc_rpcalc_SOURCES = \ nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
$(rpcalc_sources)
examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc %C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
dist_TESTS += examples/rpcalc/rpcalc.test dist_TESTS += %D%/rpcalc.test

View File

@@ -85,7 +85,7 @@ $(TESTSUITE): $(TESTSUITE_AT)
# Move into tests/ so that testsuite.dir etc. be created there. # Move into tests/ so that testsuite.dir etc. be created there.
RUN_TESTSUITE = $(TESTSUITE) -C tests $(TESTSUITEFLAGS) RUN_TESTSUITE = $(TESTSUITE) -C tests $(TESTSUITEFLAGS)
check_SCRIPTS = $(BISON) tests/atconfig tests/atlocal check_SCRIPTS = $(BISON) tests/atconfig tests/atlocal
RUN_TESTSUITE_deps = $(TESTSUITE) $(check_SCRIPTS) RUN_TESTSUITE_deps = all $(TESTSUITE) $(check_SCRIPTS)
clean-local: clean-local-tests clean-local: clean-local-tests
clean-local-tests: clean-local-tests: