[PATCH 12/16] build: no more recursion for lib subdir

Stefano Lattarini <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <ca74c2f1d37a0d20b2b2946445249b19f14d39ce.1367789028.git.stefano.lattarini@gmail.com>
Signed-off-by: Stefano Lattarini <[email protected]>
---
 Makefile.am                   |  25 +++++++-
 bin/local.mk                  |  21 ------
 configure.ac                  |   2 +-
 lib/freeze.mk                 |  12 ++--
 lib/{Makefile.am => local.mk} | 146 +++++++++++++++++++-----------------------
 5 files changed, 99 insertions(+), 107 deletions(-)
 rename lib/{Makefile.am => local.mk} (61%)

diff --git a/Makefile.am b/Makefile.am
index 697625e..c4544bb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,11 +17,12 @@
 
 # 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 = . lib tests man
+SUBDIRS = . tests man
 
 ACLOCAL_AMFLAGS = -I m4
 
 MOSTLYCLEANFILES =
+CLEANFILES =
 
 EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 ChangeLog.3 \
 	     BUGS COPYINGv3 COPYING.EXCEPTION \
@@ -32,6 +33,27 @@ EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 ChangeLog.3 \
 	     build-aux/gitlog-to-changelog \
 	     .prev-version .version
 
+edit = sed \
+	-e 's|@SHELL[@]|$(SHELL)|g' \
+	-e 's|@PERL[@]|$(PERL)|g' \
+	-e 's|@PERL_FLOCK[@]|$(PERL_FLOCK)|g' \
+	-e 's|@bindir[@]|$(bindir)|g' \
+	-e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
+	-e 's|@prefix[@]|$(prefix)|g' \
+	-e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \
+	-e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \
+	-e 's|@autom4te-name[@]|'`echo autom4te | sed '$(transform)'`'|g' \
+	-e 's|@M4[@]|$(M4)|g' \
+	-e 's|@M4_DEBUGFILE[@]|$(M4_DEBUGFILE)|g' \
+	-e 's|@M4_GNU[@]|$(M4_GNU)|g' \
+	-e 's|@AWK[@]|$(AWK)|g' \
+	-e 's|@RELEASE_YEAR[@]|$(RELEASE_YEAR)|g' \
+	-e 's|@VERSION[@]|$(VERSION)|g' \
+	-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
+	-e 's|@configure_input[@]|Generated from [email protected]; do not edit by hand.|g'
+
+include $(srcdir)/lib/freeze.mk
+
 ## --------- ##
 ## INSTALL.  ##
 ## --------- ##
@@ -105,6 +127,7 @@ distclean-local:
 
 include $(srcdir)/bin/local.mk
 include $(srcdir)/doc/local.mk
+include $(srcdir)/lib/local.mk
 
 # Perl coverage statistics.
 PERL_COVERAGE_DB = `pwd`/cover_db
diff --git a/bin/local.mk b/bin/local.mk
index ff7b2cf..c4ed17f 100644
--- a/bin/local.mk
+++ b/bin/local.mk
@@ -15,8 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-include $(srcdir)/lib/freeze.mk
-
 bin_SCRIPTS = \
   bin/autoconf \
   bin/autoheader \
@@ -42,25 +40,6 @@ MOSTLYCLEANFILES += $(bin_SCRIPTS) bin/autoconf.in bin/*.tmp
 ## The scripts.  ##
 ## ------------- ##
 
-edit = sed \
-	-e 's|@SHELL[@]|$(SHELL)|g' \
-	-e 's|@PERL[@]|$(PERL)|g' \
-	-e 's|@PERL_FLOCK[@]|$(PERL_FLOCK)|g' \
-	-e 's|@bindir[@]|$(bindir)|g' \
-	-e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
-	-e 's|@prefix[@]|$(prefix)|g' \
-	-e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \
-	-e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \
-	-e 's|@autom4te-name[@]|'`echo autom4te | sed '$(transform)'`'|g' \
-	-e 's|@M4[@]|$(M4)|g' \
-	-e 's|@M4_DEBUGFILE[@]|$(M4_DEBUGFILE)|g' \
-	-e 's|@M4_GNU[@]|$(M4_GNU)|g' \
-	-e 's|@AWK[@]|$(AWK)|g' \
-	-e 's|@RELEASE_YEAR[@]|$(RELEASE_YEAR)|g' \
-	-e 's|@VERSION[@]|$(VERSION)|g' \
-	-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
-	-e 's|@configure_input[@]|Generated from [email protected]; do not edit by hand.|g'
-
 # 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
diff --git a/configure.ac b/configure.ac
index 91f6a74..0fa61f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,7 +211,7 @@ AC_PROG_MAKE_CASE_SENSITIVE
 dnl Allow maintainer rules under GNU make even in VPATH builds.
 AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
 
-AC_CONFIG_FILES([Makefile lib/Makefile])
+AC_CONFIG_FILES([Makefile])
 
 AC_OUTPUT
 # Report the state of this version of Autoconf if this is a beta.
diff --git a/lib/freeze.mk b/lib/freeze.mk
index 60d3614..fffc20c 100644
--- a/lib/freeze.mk
+++ b/lib/freeze.mk
@@ -24,7 +24,7 @@ SUFFIXES = .m4 .m4f
 
 AUTOM4TE_CFG = $(top_builddir)/lib/autom4te.cfg
 $(AUTOM4TE_CFG): $(top_srcdir)/lib/autom4te.in
-	cd $(top_builddir)/lib && $(MAKE) $(AM_MAKEFLAGS) autom4te.cfg
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) lib/autom4te.cfg
 
 # Do not use AUTOM4TE here, since maint.mk (my-distcheck)
 # checks if we are independent of Autoconf by defining AUTOM4TE (and
@@ -43,9 +43,13 @@ MY_AUTOM4TE =									\
 # force an end of line when reporting errors.
 .m4.m4f:
 	$(MKDIR_P) $(@D)
-	$(MY_AUTOM4TE)				\
-		--language=$(*F)		\
-		--freeze			\
+	lang=`echo '$*' | sed 's,.*/,,'` \
+	  && if test $$lang = autoconf; then \
+	       lang=autoconf-without-aclocal-m4; \
+	     else :; fi \
+	  && $(MY_AUTOM4TE) \
+		--language=$$lang \
+		--freeze \
 		--output=$@
 
 # Factor the dependencies between all the frozen files.
diff --git a/lib/Makefile.am b/lib/local.mk
similarity index 61%
rename from lib/Makefile.am
rename to lib/local.mk
index 2b4c494..36ff484 100644
--- a/lib/Makefile.am
+++ b/lib/local.mk
@@ -17,12 +17,8 @@
 
 TAGS_FILES = # Incrementally updated later.
 ETAGS_ARGS = # Likewise.
-EXTRA_DIST = # Likewise.
 
-## Required by rules to build several m4 libraries.
-include $(srcdir)/freeze.mk
-
-## Checks.
+# Additional checks.
 check-local: check-forbidden-patterns
 forbidden_patterns = -e '^_*EOF' -e ' cmp '
 forbidden_patterns_files = # Incrementally updated later.
@@ -34,15 +30,15 @@ forbidden_patterns_files = # Incrementally updated later.
 perllibdir = $(pkgdatadir)/Autom4te
 
 dist_perllib_DATA = \
-  Autom4te/C4che.pm \
-  Autom4te/ChannelDefs.pm \
-  Autom4te/Channels.pm \
-  Autom4te/Configure_ac.pm \
-  Autom4te/FileUtils.pm \
-  Autom4te/General.pm \
-  Autom4te/Getopt.pm \
-  Autom4te/Request.pm \
-  Autom4te/XFile.pm
+  lib/Autom4te/C4che.pm \
+  lib/Autom4te/ChannelDefs.pm \
+  lib/Autom4te/Channels.pm \
+  lib/Autom4te/Configure_ac.pm \
+  lib/Autom4te/FileUtils.pm \
+  lib/Autom4te/General.pm \
+  lib/Autom4te/Getopt.pm \
+  lib/Autom4te/Request.pm \
+  lib/Autom4te/XFile.pm
 
 TAGS_FILES += $(dist_perllib_DATA)
 ETAGS_ARGS += --lang=perl
@@ -51,38 +47,25 @@ ETAGS_ARGS += --lang=perl
 ## Make Autom4te default configuration file.  ##
 ## ------------------------------------------ ##
 
-nodist_pkgdata_DATA = autom4te.cfg
-EXTRA_DIST += autom4te.in
-
-edit = sed \
-	-e 's|@SHELL[@]|$(SHELL)|g' \
-	-e 's|@PERL[@]|$(PERL)|g' \
-	-e 's|@bindir[@]|$(bindir)|g' \
-	-e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
-	-e 's|@prefix[@]|$(prefix)|g' \
-	-e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \
-	-e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \
-	-e 's|@autom4te-name[@]|'`echo autom4te | sed '$(transform)'`'|g' \
-	-e 's|@M4[@]|$(M4)|g' \
-	-e 's|@AWK[@]|$(AWK)|g' \
-	-e 's|@VERSION[@]|$(VERSION)|g' \
-	-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g'
+nodist_pkgdata_DATA = lib/autom4te.cfg
+EXTRA_DIST += lib/autom4te.in
 
 # All the files below depend on Makefile so that they are rebuilt
 # when the prefix, etc. changes. Unfortunately, suffix rules
 # cannot have additional dependencies, so we have to use explicit rules.
-CLEANFILES = autom4te.cfg
-autom4te.cfg: $(srcdir)/autom4te.in Makefile
-	rm -f autom4te.cfg autom4te.tmp
-	$(edit) $(srcdir)/autom4te.in >autom4te.tmp
-	chmod a-w autom4te.tmp
-	mv autom4te.tmp autom4te.cfg
+CLEANFILES += lib/autom4te.cfg
+lib/autom4te.cfg: $(srcdir)/lib/autom4te.in Makefile
+	rm -f $@ $@-t
+	$(MKDIR_P) $(@D)
+	$(edit) $(srcdir)/lib/autom4te.in >$@-t
+	chmod a-w $@-t
+	mv -f $@-t $@
 
 ## ----------------------------- ##
 ## Make Autoconf Emacs library.  ##
 ## ----------------------------- ##
 
-dist_lisp_LISP = emacs/autoconf-mode.el emacs/autotest-mode.el
+dist_lisp_LISP = lib/emacs/autoconf-mode.el lib/emacs/autotest-mode.el
 
 # TODO: This is required to work around a limitation in older
 #	Automake.  Remove once we can assume Automake 1.13 or later.
@@ -95,27 +78,27 @@ CLEANFILES += autoconf-mode.elc autotest-mode.elc
 autoconflibdir = $(pkgdatadir)/autoconf
 
 dist_autoconflib_DATA = \
-  autoconf/autoconf.m4 \
-  autoconf/general.m4 \
-  autoconf/status.m4 \
-  autoconf/oldnames.m4 \
-  autoconf/specific.m4 \
-  autoconf/autoheader.m4 \
-  autoconf/autoupdate.m4 \
-  autoconf/autotest.m4 \
-  autoconf/autoscan.m4 \
-  autoconf/lang.m4 \
-  autoconf/c.m4 \
-  autoconf/erlang.m4 \
-  autoconf/fortran.m4 \
-  autoconf/functions.m4 \
-  autoconf/go.m4 \
-  autoconf/headers.m4 \
-  autoconf/types.m4 \
-  autoconf/libs.m4 \
-  autoconf/programs.m4
-
-nodist_autoconflib_DATA = autoconf/autoconf.m4f
+  lib/autoconf/autoconf.m4 \
+  lib/autoconf/general.m4 \
+  lib/autoconf/status.m4 \
+  lib/autoconf/oldnames.m4 \
+  lib/autoconf/specific.m4 \
+  lib/autoconf/autoheader.m4 \
+  lib/autoconf/autoupdate.m4 \
+  lib/autoconf/autotest.m4 \
+  lib/autoconf/autoscan.m4 \
+  lib/autoconf/lang.m4 \
+  lib/autoconf/c.m4 \
+  lib/autoconf/erlang.m4 \
+  lib/autoconf/fortran.m4 \
+  lib/autoconf/functions.m4 \
+  lib/autoconf/go.m4 \
+  lib/autoconf/headers.m4 \
+  lib/autoconf/types.m4 \
+  lib/autoconf/libs.m4 \
+  lib/autoconf/programs.m4
+
+nodist_autoconflib_DATA = lib/autoconf/autoconf.m4f
 CLEANFILES += $(nodist_autoconflib_DATA)
 
 TAGS_FILES += $(dist_autoconflib_DATA)
@@ -123,7 +106,7 @@ ETAGS_ARGS += $(ETAGS_FOR_AUTOCONF)
 
 forbidden_patterns_files += $(dist_autoconflib_DATA)
 
-autoconf/autoconf.m4f: $(autoconf_m4f_dependencies)
+lib/autoconf/autoconf.m4f: $(autoconf_m4f_dependencies)
 
 ## ------------------------ ##
 ##  Make Autoscan library.  ##
@@ -131,19 +114,22 @@ autoconf/autoconf.m4f: $(autoconf_m4f_dependencies)
 
 autoscanlibdir = $(pkgdatadir)/autoscan
 
-EXTRA_DIST += autoscan/autoscan.pre
-nodist_autoscanlib_DATA = autoscan/autoscan.list
-CLEANFILES += autoscan/autoscan.list
+EXTRA_DIST += lib/autoscan/autoscan.pre
+nodist_autoscanlib_DATA = lib/autoscan/autoscan.list
+CLEANFILES += lib/autoscan/autoscan.list
 
-autoscan/autoscan.list: $(srcdir)/autoscan/autoscan.pre $(autoconf_m4f_dependencies) Makefile.am
+lib/autoscan/autoscan.list: $(srcdir)/lib/autoscan/autoscan.pre
 	$(MKDIR_P) $(@D)
 	echo '# Automatically Generated: do not edit this file' >$@
-	sed '/^[#]/!q' $(srcdir)/autoscan/autoscan.pre >>$@
+	sed '/^[#]/!q' $(srcdir)/lib/autoscan/autoscan.pre >>$@
 	( \
-	  sed -n '/^[^#]/p' $(srcdir)/autoscan/autoscan.pre; \
-	  $(MY_AUTOM4TE) --cache '' -M -l autoconf -t'AN_OUTPUT:$$1: $$2		$$3' \
+	  sed -n '/^[^#]/p' $(srcdir)/lib/autoscan/autoscan.pre; \
+	  $(MY_AUTOM4TE) --cache '' -M -l autoconf-without-aclocal-m4 \
+	                 -t'AN_OUTPUT:$$1: $$2		$$3' \
 	) | LC_ALL=C sort >>$@
 
+lib/autoscan/autoscan.list: $(autoconf_m4f_dependencies) Makefile
+
 ## ----------------------------------- ##
 ## Make Autoconf library for M4sugar.  ##
 ## ----------------------------------- ##
@@ -151,20 +137,20 @@ autoscan/autoscan.list: $(srcdir)/autoscan/autoscan.pre $(autoconf_m4f_dependenc
 m4sugarlibdir = $(pkgdatadir)/m4sugar
 
 dist_m4sugarlib_DATA = \
-  m4sugar/m4sugar.m4 \
-  m4sugar/foreach.m4 \
-  m4sugar/m4sh.m4
+  lib/m4sugar/m4sugar.m4 \
+  lib/m4sugar/foreach.m4 \
+  lib/m4sugar/m4sh.m4
 
 nodist_m4sugarlib_DATA = \
-  m4sugar/version.m4 \
-  m4sugar/m4sugar.m4f \
-  m4sugar/m4sh.m4f
+  lib/m4sugar/version.m4 \
+  lib/m4sugar/m4sugar.m4f \
+  lib/m4sugar/m4sh.m4f
 
 CLEANFILES += $(nodist_m4sugarlib_DATA)
 
 # The ':;' in the second line of the recipe works around a redirected
 # compound command bash exit status bug.
-m4sugar/version.m4: Makefile
+lib/m4sugar/version.m4: Makefile
 	$(MKDIR_P) $(@D)
 	:;{ \
 	  echo '# This file is part of -*- Autoconf -*-.' && \
@@ -187,8 +173,8 @@ ETAGS_ARGS += $(ETAGS_FOR_AUTOCONF)
 
 forbidden_patterns_files += $(dist_m4sugarlib_DATA)
 
-m4sugar/m4sugar.m4f: $(m4sugar_m4f_dependencies)
-m4sugar/m4sh.m4f: $(m4sh_m4f_dependencies)
+lib/m4sugar/m4sugar.m4f: $(m4sugar_m4f_dependencies)
+lib/m4sugar/m4sh.m4f: $(m4sh_m4f_dependencies)
 
 ## ----------------------- ##
 ## Make Autotest library.  ##
@@ -197,11 +183,11 @@ m4sugar/m4sh.m4f: $(m4sh_m4f_dependencies)
 autotestlibdir = $(pkgdatadir)/autotest
 
 dist_autotestlib_DATA = \
-  autotest/autotest.m4 \
-  autotest/general.m4 \
-  autotest/specific.m4
+  lib/autotest/autotest.m4 \
+  lib/autotest/general.m4 \
+  lib/autotest/specific.m4
 
-nodist_autotestlib_DATA = autotest/autotest.m4f
+nodist_autotestlib_DATA = lib/autotest/autotest.m4f
 CLEANFILES += $(nodist_autotestlib_DATA)
 
 TAGS_FILES += $(dist_autotestlib_DATA)
@@ -209,4 +195,4 @@ ETAGS_ARGS += $(ETAGS_FOR_AUTOCONF)
 
 forbidden_patterns_files += $(dist_autotestlib_DATA)
 
-autotest/autotest.m4f: $(autotest_m4f_dependencies)
+lib/autotest/autotest.m4f: $(autotest_m4f_dependencies)
-- 
1.8.3.rc0.19.g7e6a0cc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.