* automake.in: Rename ... * bin/automake.in: ... like this. * aclocal.in: Rename ... * bin/aclocal.in: ... like this. * Makefile.am: Move parts that dealt with the building/distribution of aclocal and Automake .. * bin/Makefile.inc): ... in this new included fragment. Adjust as needed, and make deliberate use of the '%D%' substitution. * lib/gen-perl-protos: Move ... * bin/gen-perl-protos: ... here. * bootstrap.sh, configure.ac, maintainer/rename-tests, t/wrap/aclocal.in, t/wrap/automake.in, doc/Makefile.inc, t/ax/tap-setup.sh, .gitignore: Adjust. * maintainer/syntax-checks.mk: Likewise, and enhance a little.
Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> --- .gitignore | 4 +-- Makefile.am | 58 +++++----------------------------- bin/Makefile.inc | 70 ++++++++++++++++++++++++++++++++++++++++++ aclocal.in => bin/aclocal.in | 0 automake.in => bin/automake.in | 0 {lib => bin}/gen-perl-protos | 0 bootstrap.sh | 12 ++++---- configure.ac | 2 +- doc/Makefile.inc | 4 +-- maintainer/rename-tests | 2 +- maintainer/syntax-checks.mk | 34 +++++++++++--------- t/ax/tap-setup.sh | 2 +- t/wrap/aclocal.in | 2 +- t/wrap/automake.in | 2 +- 14 files changed, 111 insertions(+), 81 deletions(-) create mode 100644 bin/Makefile.inc rename aclocal.in => bin/aclocal.in (100%) rename automake.in => bin/automake.in (100%) rename {lib => bin}/gen-perl-protos (100%) diff --git a/.gitignore b/.gitignore index 4b509d7..f13fd21 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ /config.status /config.status.lineno /configure.lineno -/aclocal -/automake +/bin/aclocal +/bin/automake /runtest /doc/.dirstamp /doc/automake*.info diff --git a/Makefile.am b/Makefile.am index c49d1e9..143308a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,12 @@ nodist_noinst_SCRIPTS = ## Top level. ## ## ------------ ## +EXTRA_DIST += \ + bootstrap.sh \ + GNUmakefile \ + HACKING \ + PLANS + # We want a handful of substitutions to be fully-expanded by make; # then use config.status to substitute the remainder where a single # expansion is sufficient. We use a funny notation here to avoid @@ -63,62 +69,11 @@ generated_file_finalize = $(AM_V_at) \ fi; \ chmod a-w $@-t && mv -f $@-t $@ -bin_SCRIPTS = automake aclocal - -CLEANFILES += $(bin_SCRIPTS) -AUTOMAKESOURCES = automake.in aclocal.in - -TAGS_FILES += $(AUTOMAKESOURCES) - -EXTRA_DIST += \ - $(AUTOMAKESOURCES) \ - bootstrap.sh \ - GNUmakefile \ - HACKING \ - PLANS - # For some tests or targets, we need to have the just-build automake and # aclocal scripts avaiable on PATH. extend_PATH = \ { PATH='$(abs_builddir)/t/wrap'$(PATH_SEPARATOR)$$PATH && export PATH; } -# Make versioned links. We only run the transform on the root name; -# then we make a versioned link with the transformed base name. This -# seemed like the most reasonable approach. -install-exec-hook: - @$(POST_INSTALL) - @for p in $(bin_SCRIPTS); do \ - f=`echo $$p | sed '$(transform)'`; \ - fv="$$f-$(APIVERSION)"; \ - rm -f "$(DESTDIR)$(bindir)/$$fv"; \ - echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \ - $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \ - done - -uninstall-hook: - @for p in $(bin_SCRIPTS); do \ - f=`echo $$p | sed '$(transform)'`; \ - fv="$$f-$(APIVERSION)"; \ - rm -f "$(DESTDIR)$(bindir)/$$fv"; \ - done - -# These files depend on Makefile so they are rebuilt if $(VERSION), -# $(datadir) or other do_subst'ituted variables change. -automake: automake.in -aclocal: aclocal.in -automake aclocal: Makefile lib/gen-perl-protos - $(AM_V_GEN)rm -f $@ $@-t $@-t2 \ -## Common substitutions. - && in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \ -## Auto-compute prototypes of perl subroutines. - && $(PERL) -w $(srcdir)/lib/gen-perl-protos $@-t > $@-t2 \ - && mv -f $@-t2 $@-t \ -## We can't use '$(generated_file_finalize)' here, because currently -## Automake contains occurrences of unexpanded @substitutions@ in -## comments, and that is perfectly legit. - && chmod a+x,a-w $@-t && mv -f $@-t $@ -EXTRA_DIST += lib/gen-perl-protos - # The master location for INSTALL is lib/INSTALL. # This is where "make fetch" will install new versions. # Make sure we also update this copy. @@ -168,6 +123,7 @@ EXTRA_DIST += \ maintainer/syntax-checks.mk # Most work delegated to sub-dir makefile fragments. +include $(srcdir)/bin/Makefile.inc include $(srcdir)/doc/Makefile.inc include $(srcdir)/lib/Makefile.inc include $(srcdir)/lib/Automake/Makefile.inc diff --git a/bin/Makefile.inc b/bin/Makefile.inc new file mode 100644 index 0000000..280fff0 --- /dev/null +++ b/bin/Makefile.inc @@ -0,0 +1,70 @@ +## Copyright (C) 1995-2013 Free Software Foundation, Inc. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see <http://www.gnu.org/licenses/>. + +## ----------------------------------- ## +## The automake and aclocal scripts. ## +## ----------------------------------- ## + +bin_SCRIPTS = %D%/automake %D%/aclocal +CLEANFILES += $(bin_SCRIPTS) + +# Used by maintainer checks and such. +automake_in = $(srcdir)/%D%/automake.in +aclocal_in = $(srcdir)/%D%/aclocal.in +automake_script = %D%/automake +aclocal_script = %D%/aclocal + +AUTOMAKESOURCES = $(automake_in) $(aclocal_in) +TAGS_FILES += $(AUTOMAKESOURCES) +EXTRA_DIST += $(AUTOMAKESOURCES) + +# Make versioned links. We only run the transform on the root name; +# then we make a versioned link with the transformed base name. This +# seemed like the most reasonable approach. +install-exec-hook: + @$(POST_INSTALL) + @for p in $(bin_SCRIPTS); do \ + f=`echo $$p | sed -e 's,.*/,,' -e '$(transform)'`; \ + fv="$$f-$(APIVERSION)"; \ + rm -f "$(DESTDIR)$(bindir)/$$fv"; \ + echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \ + $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \ + done + +uninstall-hook: + @for p in $(bin_SCRIPTS); do \ + f=`echo $$p | sed -e 's,.*/,,' -e '$(transform)'`; \ + fv="$$f-$(APIVERSION)"; \ + rm -f "$(DESTDIR)$(bindir)/$$fv"; \ + done + +# These files depend on Makefile so they are rebuilt if $(VERSION), +# $(datadir) or other do_subst'ituted variables change. +%D%/automake: %D%/automake.in +%D%/aclocal: %D%/aclocal.in +%D%/automake %D%/aclocal: Makefile %D%/gen-perl-protos + $(AM_V_GEN)rm -f $@ $@-t $@-t2 \ +## Common substitutions. + && in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \ +## Auto-compute prototypes of perl subroutines. + && $(PERL) -w $(srcdir)/%D%/gen-perl-protos $@-t > $@-t2 \ + && mv -f $@-t2 $@-t \ +## We can't use '$(generated_file_finalize)' here, because currently +## Automake contains occurrences of unexpanded @substitutions@ in +## comments, and that is perfectly legit. + && chmod a+x,a-w $@-t && mv -f $@-t $@ +EXTRA_DIST += %D%/gen-perl-protos + +# vim: ft=automake noet diff --git a/aclocal.in b/bin/aclocal.in similarity index 100% rename from aclocal.in rename to bin/aclocal.in diff --git a/automake.in b/bin/automake.in similarity index 100% rename from automake.in rename to bin/automake.in diff --git a/lib/gen-perl-protos b/bin/gen-perl-protos similarity index 100% rename from lib/gen-perl-protos rename to bin/gen-perl-protos diff --git a/bootstrap.sh b/bootstrap.sh index 541280e..5add98a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -99,9 +99,9 @@ dosubst automake-$APIVERSION/Automake/Config.in \ dosubst m4/amversion.in m4/amversion.m4 # Create temporary replacement for aclocal and automake. -for p in aclocal automake; do +for p in bin/aclocal bin/automake; do dosubst $p.in $p.tmp - $PERL -w lib/gen-perl-protos $p.tmp > $p.tmp2 + $PERL -w bin/gen-perl-protos $p.tmp > $p.tmp2 mv -f $p.tmp2 $p.tmp done @@ -113,11 +113,11 @@ mv -f t/testsuite-part.tmp t/testsuite-part.am # Run the autotools. Bail out if any warning is triggered. # Use '-I' here so that our own *.m4 files in m4/ gets included, # not copied, in aclocal.m4. -$PERL ./aclocal.tmp -Wall -Werror -I m4 \ - --automake-acdir=m4 --system-acdir=m4/acdir +$PERL ./bin/aclocal.tmp -Wall -Werror -I m4 \ + --automake-acdir=m4 --system-acdir=m4/acdir $AUTOCONF -Wall -Werror -$PERL ./automake.tmp -Wall -Werror +$PERL ./bin/automake.tmp -Wall -Werror # Remove temporary files and directories. rm -rf aclocal-$APIVERSION automake-$APIVERSION -rm -f aclocal.tmp automake.tmp +rm -f bin/aclocal.tmp bin/automake.tmp diff --git a/configure.ac b/configure.ac index 043b467..1a0620f 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ AC_PREREQ([2.69]) AC_INIT([GNU Automake], [1.13a], [bug-autom...@gnu.org]) -AC_CONFIG_SRCDIR([automake.in]) +AC_CONFIG_SRCDIR([bin/automake.in]) AC_CONFIG_AUX_DIR([lib]) AM_SILENT_RULES([yes]) diff --git a/doc/Makefile.inc b/doc/Makefile.inc index 8515a5d..dd477d6 100644 --- a/doc/Makefile.inc +++ b/doc/Makefile.inc @@ -46,9 +46,9 @@ update_mans = \ && f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \ && echo ".so man1/$$f-$(APIVERSION).1" > $@ -%D%/aclocal-$(APIVERSION).1: aclocal.in aclocal lib/Automake/Config.pm +%D%/aclocal-$(APIVERSION).1: $(aclocal_script) lib/Automake/Config.pm $(update_mans) aclocal-$(APIVERSION) -%D%/automake-$(APIVERSION).1: automake.in automake lib/Automake/Config.pm +%D%/automake-$(APIVERSION).1: $(automake_script) lib/Automake/Config.pm $(update_mans) automake-$(APIVERSION) ## ---------------------------- ## diff --git a/maintainer/rename-tests b/maintainer/rename-tests index a584748..28963fa 100755 --- a/maintainer/rename-tests +++ b/maintainer/rename-tests @@ -30,7 +30,7 @@ esac AWK=${AWK-awk} SED=${SED-sed} -[[ -f automake.in && -d lib/Automake ]] \ +[[ -f bin/automake.in && -d lib/Automake ]] \ || fatal "can only be run from the top-level of the Automake source tree" $SED --version 2>&1 | grep GNU >/dev/null 2>&1 \ diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk index ab316cb..61fcef3 100644 --- a/maintainer/syntax-checks.mk +++ b/maintainer/syntax-checks.mk @@ -85,17 +85,19 @@ sc_at_in_texi ## aclocal. automake_diff_no = 8 aclocal_diff_no = 9 +sc_diff_automake sc_diff_aclocal: in=$($*_in) +sc_diff_automake sc_diff_aclocal: out=$($*_script) sc_diff_automake sc_diff_aclocal: sc_diff_% : @set +e; \ in=$*-in.tmp out=$*-out.tmp diffs=$*-diffs.tmp \ - && sed '/^#!.*[pP]rototypes/d' $(srcdir)/$*.in > $$in \ - && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $* > $$out \ + && sed '/^#!.*[pP]rototypes/d' $(in) > $$in \ + && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $(out) > $$out \ && { diff -u $$in $$out > $$diffs; test $$? -eq 1; } \ && added=`grep -v '^+++ ' $$diffs | grep -c '^+'` \ && removed=`grep -v '^--- ' $$diffs | grep -c '^-'` \ && test $$added,$$removed = $($*_diff_no),$($*_diff_no) \ || { \ - echo "Found unexpected diffs between $*.in and $*"; \ + echo "Found unexpected diffs between $(in) and $(out)"; \ echo "Lines added: $$added" ; \ echo "Lines removed: $$removed"; \ cat $$diffs; \ @@ -150,22 +152,22 @@ sc_pre_normal_post_install_uninstall: ## We never want to use "undef", only "delete", but for $/. sc_perl_no_undef: - @if grep -n -w 'undef ' $(srcdir)/automake.in | \ + @if grep -n -w 'undef ' $(automake_in) | \ grep -F -v 'undef $$/'; then \ - echo "Found undef in automake.in; use delete instead" 1>&2; \ + echo "Found 'undef' in the lines above; use 'delete' instead" 1>&2; \ exit 1; \ fi ## We never want split (/ /,...), only split (' ', ...). sc_perl_no_split_regex_space: - @if grep -n 'split (/ /' $(srcdir)/automake.in; then \ + @if grep -n 'split (/ /' $(automake_in) $(acloca_in); then \ echo "Found bad split in the lines above." 1>&2; \ exit 1; \ fi ## Look for cd within backquotes sc_cd_in_backquotes: - @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \ + @if grep -n '^[^#]*` *cd ' $(automake_in) $(ams); then \ echo "Consider using \$$(am__cd) in the lines above." 1>&2; \ exit 1; \ fi @@ -173,7 +175,7 @@ sc_cd_in_backquotes: ## Look for cd to a relative directory (may be influenced by CDPATH). ## Skip some known directories that are OK. sc_cd_relative_dir: - @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \ + @if grep -n '^[^#]*cd ' $(automake_in) $(ams) | \ grep -v 'echo.*cd ' | \ grep -v 'am__cd =' | \ grep -v '^[^#]*cd [./]' | \ @@ -187,22 +189,24 @@ sc_cd_relative_dir: ## Using @_ in a scalar context is most probably a programming error. sc_perl_at_uscore_in_scalar_context: - @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \ + @if grep -Hn '[^%@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' \ + $(automake_in) $(aclocal_in); then \ echo "Using @_ in a scalar context in the lines above." 1>&2; \ exit 1; \ fi -## Allow only few variables to be localized in Automake. +## Allow only few variables to be localized in automake and aclocal. sc_perl_local: - @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \ - grep '^[ \t]*local [^*]'; then \ + @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' \ + $(automake_in) $(aclocal_in) | \ + grep '^[ \t]*local [^*]'; then \ echo "Please avoid 'local'." 1>&2; \ exit 1; \ fi ## Don't let AMDEP_TRUE substitution appear in automake.in. sc_AMDEP_TRUE_in_automake_in: - @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \ + @if grep '@AMDEP''_TRUE@' $(automake_in); then \ echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \ exit 1; \ fi @@ -210,7 +214,7 @@ sc_AMDEP_TRUE_in_automake_in: ## Recursive make invocations should always pass $(AM_MAKEFLAGS) ## to $(MAKE), for portability to non-GNU make. sc_tests_make_without_am_makeflags: - @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in \ + @if grep '^[^#].*(MAKE) ' $(ams) $(automake_in) \ | grep -v 'AM_MAKEFLAGS' \ | grep -v '/am/header-vars\.am:.*am--echo.*| $$(MAKE) -f *-'; \ then \ @@ -532,7 +536,7 @@ sc_at_in_texi: exit 1; \ fi -$(syntax_check_rules): automake aclocal +$(syntax_check_rules): bin/automake bin/aclocal maintainer-check: $(syntax_check_rules) .PHONY: maintainer-check $(syntax_check_rules) diff --git a/t/ax/tap-setup.sh b/t/ax/tap-setup.sh index 6955c86..3c992a3 100644 --- a/t/ax/tap-setup.sh +++ b/t/ax/tap-setup.sh @@ -22,7 +22,7 @@ # Check that we are running from a proper directory: last thing we want # is to overwrite some random user files. -test -f ../../automake && test -f ../../runtest && test -d ../../t \ +test -f ../../bin/automake && test -f ../../runtest && test -d ../../t \ || fatal_ "running from a wrong directory" test ! -f Makefile.am || mv Makefile.am Makefile.am~ \ diff --git a/t/wrap/aclocal.in b/t/wrap/aclocal.in index 3e60eb0..cdcae1a 100644 --- a/t/wrap/aclocal.in +++ b/t/wrap/aclocal.in @@ -26,4 +26,4 @@ BEGIN '--automake-acdir=@abs_top_srcdir@/m4', '--system-acdir=@abs_top_srcdir@/m4/acdir'; } -require '@abs_top_builddir@/aclocal'; +require '@abs_top_builddir@/bin/aclocal'; diff --git a/t/wrap/automake.in b/t/wrap/automake.in index bc6eab6..cf18d7b 100644 --- a/t/wrap/automake.in +++ b/t/wrap/automake.in @@ -24,4 +24,4 @@ BEGIN if '@srcdir@' ne '.'; unshift @ARGV, '--libdir=@abs_top_srcdir@/lib'; } -require '@abs_top_builddir@/automake'; +require '@abs_top_builddir@/bin/automake'; -- 1.8.3.rc0.19.g7e6a0cc