From 097b14e45eb0bfac8ed16df96cacc695fa380803 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sun, 5 May 2013 16:40:10 +0200 Subject: [PATCH] build: no more make recursion for 'bin' subdir * Makefile.am (MOSTLYCLEANFILES): New, to be extended later by included files. ($(srcdir)/doc/local.mk): New include. (SUBDIRS): Drop 'bin'. Adjust comments. * bin/Makefile.am: Rename ... * bin/local.mk: ... like this, and adjust. * configure.ac (AC_CONFIG_FILES): Drop 'bin/Makefile'. Signed-off-by: Stefano Lattarini --- Makefile.am | 6 ++-- bin/{Makefile.am => local.mk} | 62 ++++++++++++++++++++++------------- configure.ac | 2 +- 3 files changed, 44 insertions(+), 26 deletions(-) rename bin/{Makefile.am => local.mk} (72%) diff --git a/Makefile.am b/Makefile.am index 757d8bce7..697625e24 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,13 +15,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# bin/ must be run first, as it builds executables needed for tests. # autom4te uses autotest.m4f to generate 'testsuite', so build tests last. # Rules in man/ use scripts from both bin/ and tests/, so *it* goes last. -SUBDIRS = bin . lib tests man +SUBDIRS = . lib tests man ACLOCAL_AMFLAGS = -I m4 +MOSTLYCLEANFILES = + EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 ChangeLog.3 \ BUGS COPYINGv3 COPYING.EXCEPTION \ GNUmakefile maint.mk cfg.mk \ @@ -102,6 +103,7 @@ dist-hook: gen-ChangeLog distclean-local: if test x"$(VPATH)" != x ; then rm -f GNUmakefile ; fi +include $(srcdir)/bin/local.mk include $(srcdir)/doc/local.mk # Perl coverage statistics. diff --git a/bin/Makefile.am b/bin/local.mk similarity index 72% rename from bin/Makefile.am rename to bin/local.mk index fd264ab0c..57983f82c 100644 --- a/bin/Makefile.am +++ b/bin/local.mk @@ -15,18 +15,30 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -include ../lib/freeze.mk - -bin_SCRIPTS = autom4te \ - autoconf autoheader autoreconf ifnames autoscan autoupdate - -EXTRA_DIST = autoconf.as autoheader.in autoreconf.in autoupdate.in ifnames.in \ - autoscan.in autom4te.in +include $(srcdir)/lib/freeze.mk + +bin_SCRIPTS = \ + bin/autoconf \ + bin/autoheader \ + bin/autom4te \ + bin/autoreconf \ + bin/autoscan \ + bin/autoupdate \ + bin/ifnames + +EXTRA_DIST += \ + bin/autoconf.as \ + bin/autoheader.in \ + bin/autom4te.in \ + bin/autoreconf.in \ + bin/autoscan.in \ + bin/autoupdate.in \ + bin/ifnames.in # Files that should be removed, but which Automake does not know. -MOSTLYCLEANFILES = $(bin_SCRIPTS) autoconf.in *.tmp +MOSTLYCLEANFILES += $(bin_SCRIPTS) bin/autoconf.in bin/*.tmp -# Get the release year from ../ChangeLog. +# Get the release year from ChangeLog. RELEASE_YEAR = \ `sed 's/^\([0-9][0-9][0-9][0-9]\).*/\1/;q' $(top_srcdir)/ChangeLog` @@ -53,14 +65,13 @@ edit = sed \ -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ -e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g' -$(top_builddir)/bin/autom4te: autom4te - # autoconf is written in M4sh. # FIXME: this target should depend on the frozen files below lib/m4sugar, # otherwise autom4te may pick up a frozen m4sh.m4f from an earlier # installation below the same $(prefix); work around this with --melt. -autoconf.in: $(srcdir)/autoconf.as $(m4sh_m4f_dependencies) - $(MY_AUTOM4TE) --language M4sh --cache '' --melt $(srcdir)/autoconf.as -o $@ +bin/autoconf.in: $(srcdir)/bin/autoconf.as $(m4sh_m4f_dependencies) + $(MY_AUTOM4TE) --language M4sh --cache '' \ + --melt $(srcdir)/bin/autoconf.as -o $@ ## All the scripts depend on Makefile so that they are rebuilt when the ## prefix etc. changes. It took quite a while to have the rule correct, @@ -68,6 +79,7 @@ autoconf.in: $(srcdir)/autoconf.as $(m4sh_m4f_dependencies) ## Use chmod -w to prevent people from editing the wrong file by accident. $(bin_SCRIPTS): Makefile rm -f $@ $@.tmp + $(MKDIR_P) $(@D) srcdir=''; \ test -f ./$@.in || srcdir=$(srcdir)/; \ $(edit) $${srcdir}$@.in >$@.tmp @@ -75,13 +87,13 @@ $(bin_SCRIPTS): Makefile chmod a-w $@.tmp mv $@.tmp $@ -autoconf: autoconf.in -autoheader: $(srcdir)/autoheader.in -autom4te: $(srcdir)/autom4te.in -autoreconf: $(srcdir)/autoreconf.in -autoscan: $(srcdir)/autoscan.in -autoupdate: $(srcdir)/autoupdate.in -ifnames: $(srcdir)/ifnames.in +bin/autoconf: bin/autoconf.in +bin/autoheader: $(srcdir)/bin/autoheader.in +bin/autom4te: $(srcdir)/bin/autom4te.in +bin/autoreconf: $(srcdir)/bin/autoreconf.in +bin/autoscan: $(srcdir)/bin/autoscan.in +bin/autoupdate: $(srcdir)/bin/autoupdate.in +bin/ifnames: $(srcdir)/bin/ifnames.in ## --------------- ## @@ -95,9 +107,13 @@ LETTERS = ABCDEFGHIJKLMNOPQRSTUVWXYZ DIGITS = 0123456789 WORD_REGEXP = [$(LETTERS)$(letters)_][$(LETTERS)$(letters)$(DIGITS)_]* ETAGS_PERL = --lang=perl \ - autoheader.in autoreconf.in autoupdate.in autoscan.in autom4te.in \ - ifnames.in + bin/autoheader.in \ + bin/autoreconf.in \ + bin/autoupdate.in \ + bin/autoscan.in \ + bin/autom4te.in \ + bin/ifnames.in ETAGS_SH = --lang=none --regex='/\($(WORD_REGEXP)\)=/\1/' \ - autoconf.in + bin/autoconf.in ETAGS_ARGS = $(ETAGS_PERL) $(ETAGS_SH) diff --git a/configure.ac b/configure.ac index 437206c35..1fc00ae46 100644 --- a/configure.ac +++ b/configure.ac @@ -211,7 +211,7 @@ AC_CONFIG_FILES([Makefile lib/Makefile lib/Autom4te/Makefile lib/autoscan/Makefile lib/m4sugar/Makefile lib/autoconf/Makefile lib/autotest/Makefile - bin/Makefile]) + ]) AC_OUTPUT # Report the state of this version of Autoconf if this is a beta.