From: Gary V. Vaughan Date: Wed, 24 Nov 2004 14:55:55 +0000 (+0000) Subject: * Makefile.am: Move Autotest rules from here... X-Git-Tag: release-2-1b~841 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bce1e676de55b838e6c521bf0326d81973b5f582;p=thirdparty%2Flibtool.git * Makefile.am: Move Autotest rules from here... * tests/Makefile.am: ...to here. * bootstrap: Adjust. Also, create temporary Makefile from tests/Makefile.am so that bootstrap can create the Autotest testsuite. --- diff --git a/ChangeLog b/ChangeLog index f131cad88..1eacf4d6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-11-24 Gary V. Vaughan + + * Makefile.am: Move Autotest rules from here... + * tests/Makefile.am: ...to here. + * bootstrap: Adjust. Also, create temporary Makefile from + tests/Makefile.am so that bootstrap can create the Autotest + testsuite. + 2004-11-23 Gary V. Vaughan If the user's login shell is something crazy like, oooh, diff --git a/Makefile.am b/Makefile.am index 51b734100..60a2a6da3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -64,6 +64,22 @@ EXTRA_DIST = bootstrap libtoolize.in config/ltmain.m4sh config/mkstamp \ CLEANFILES = libtool libtoolize \ libtoolize.tmp config/ltmain.tmp m4/ltversion.tmp +## This properly belongs in tests/Makefile.am, but then we would have +## to pass $(edit) to the submake or, worse, keep two copies of $(edit) +## in synch, so instead we just build it from this Makefile.am: +.PHONY: update-package-m4 +update-package-m4: $(top_srcdir)/tests/package.m4 +$(top_srcdir)/tests/package.m4: $(top_srcdir)/configure.ac + cd $(top_srcdir); \ + { \ + echo '# Signature of the current package.'; \ + echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ + echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ + echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ + echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ + } | $(edit) > tests/package.m4 + # These are required by libtoolize and must be executable when installed. # Since _SCRIPTS gets the program transform applied we make them # executable by hand @@ -119,12 +135,12 @@ $(top_srcdir)/m4/ltversion.m4: m4/ltversion.in configure.ac $(top_srcdir)/stamp- mv -f m4/ltversion.tmp m4/ltversion.m4 ## And for similar reasons, ltmain.sh can't be built from config.status. -## WARNING: If you edit this rule to change the contents of ltmain.sh, -## you must `touch $(top_srcdir)/config/ltmain.in' from the -## shell if you need ltmain.sh to be regenerated. Ideally, we -## should make this rule depend on Makefile but that will break -## distcheck (at least) by rebuilding ltmain.sh in the source -## tree whenever config.status regenerates the Makefile. +## !WARNING! If you edit this rule to change the contents of ltmain.sh, +## you must `touch $(top_srcdir)/config/ltmain.in' from the +## shell if you need ltmain.sh to be regenerated. Ideally, we +## should make this rule depend on Makefile but that will break +## distcheck (at least) by rebuilding ltmain.sh in the source +## tree whenever config.status regenerates the Makefile. EXTRA_DIST += config/ltmain.sh $(top_srcdir)/config/ltmain.sh: $(sh_files) config/ltmain.m4sh configure.ac \ $(top_srcdir)/stamp-vcl @@ -178,6 +194,10 @@ $(top_srcdir)/tests/defs.in: tests/defs.m4sh Makefile.am rm -f tests/defs.in; \ $(M4SH) -B ./config tests/defs.m4sh > tests/defs.in +$(top_srcdir)/tests/testsuite: + cd tests; \ + $(MAKE) $(AM_MAKEFLAGS) testsuite + # Automake doesn't want us to generate distributed files from config.status, # but the alternative (see libtool-1.4.3) was even uglier! libtool: $(top_builddir)/config.status $(top_srcdir)/config/ltmain.sh \ @@ -192,65 +212,6 @@ configure-subdirs distdir: $(DIST_MAKEFILE_LIST) abs_srcdir=`cd $(top_srcdir) && pwd`; \ (cd $$dir && $$abs_srcdir/$$dir/configure) || exit 1 -## ------------ ## -## Test suite. ## -## ------------ ## - -## Although the Autotest suite is generated by make, we want to distribute -## a precompiled `$(top_srcdir)/tests/testsuite' so the rules are in this -## top-level Makefile.am in order that `bootstrap' can compile everything -## in the source tree; ready for distribution. - -TESTSUITE = tests/testsuite -TESTSUITE_AT = tests/testsuite.at tests/am-subdir.at - -EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) tests/package.m4 - -# Be sure to reexport important environment variables. -# This is a copy of tests/Makefile.am (TESTS_ENVIRONMENT), be sure to -# keep them is sync if you change them before those tests are migrated! -TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ - CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ - LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ - OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" F77="$(F77)" \ - FFLAGS="$(FFLAGS)" CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CPP="$(CPP)" - -## This is the beginning of the end of the defs.m4sh based tests. For -## now we run the diminutive new Autotest testsuite first, followed by -## our legacy tests. The legacy tests will be migrated to Autotest and -## the majority of the contents of the test subdir will not be needed! - -$(top_srcdir)/tests/package.m4: configure.ac - cd $(top_srcdir); \ - { \ - echo '# Signature of the current package.'; \ - echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ - echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ - echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ - echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ - echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ - } | $(edit) > tests/package.m4 - -$(top_srcdir)/$(TESTSUITE): $(top_srcdir)/tests/package.m4 $(TESTSUITE_AT) - cd $(top_srcdir); \ - $(AUTOTEST) -I ./tests tests/testsuite.at -o $(TESTSUITE) - -tests/atconfig: config.status - ./config.status tests/atconfig - -# Hook the test suite into the check rule -check-local: tests/atconfig $(top_srcdir)/$(TESTSUITE) - $(TESTS_ENVIRONMENT) $(SHELL) $(srcdir)/$(TESTSUITE) $(TESTSUITE_FLAGS) - -# Run the test suite on the *installed* tree. -installcheck-local: - $(TESTS_ENVIRONMENT) $(SHELL) $(srcdir)/$(TESTSUITE) $(TESTSUITE_FLAGS) AUTOTEST_PATH=$(exec_prefix)/bin - -# We need to remove any file droppings left behind by testsuite -clean-local: legacy-clean-local - $(SHELL) $(srcdir)/$(TESTSUITE) --clean - - install-data-local: ## Don't install over the top of an old pkgvdatadir -rm -rf $(DESTDIR)$(pkgvdatadir) diff --git a/bootstrap b/bootstrap index b2b9af6ae..7ec22b9ee 100755 --- a/bootstrap +++ b/bootstrap @@ -51,24 +51,38 @@ fi # Extract the package name and version number from configure.ac: set -- `sed '/AC_INIT/{s/[][,()]/ /g; p;};d' configure.ac` +# Whip up some dirty Makefiles: +makefiles= +for dirty in ./Makefile ./tests/Makefile +do + test -f $dirty || { + makefiles="$makefiles $dirty" + sed '/^if /,/^endif$/d;/^else$/,/^endif$/d' $dirty.am > $dirty + } +done + # Building distributed files from configure is bad for automake, so we # generate them here, and have Makefile rules to keep them up to date. # We don't have all the substitution values to build ltmain.sh from this # script yet, but we need config/ltmain.sh for the libtool commands in # configure, and ltversion.m4 to generate configure in the first place: rm -f ./config/ltmain.sh ./m4/ltversion.m4 -test -f Makefile || { makefile=Makefile; cp Makefile.am $makefile; } + make ./config/ltmain.sh ./m4/ltversion.m4 ./libtoolize.in ./tests/defs.in \ top_srcdir=. PACKAGE="$2" VERSION="$3" M4SH="autom4te --language=m4sh" -make ./tests/testsuite AUTOTEST="autom4te --language=autotest" \ - top_srcdir=. PACKAGE="$2" VERSION="$3" PACKAGE_BUGREPORT="bug-$2@gnu.org" +{ + cd tests + make ./testsuite AUTOTEST="autom4te --language=autotest" \ + top_srcdir=.. PACKAGE="$2" VERSION="$3" PACKAGE_BUGREPORT="bug-$2@gnu.org" + cd .. +} test -f clcommit.m4sh && make -f Makefile.maint commit \ top_srcdir=. PACKAGE="$2" VERSION="$3" M4SH="autom4te -l m4sh" \ SED=sed GREP=grep FGREP=fgrep EGREP=egrep LN_S="ln -s" -test -z "$makefile" || rm -f "$makefile" +test -z "$makefiles" || rm -f "$makefiles" # Make a dummy libtoolize script for autoreconf: test -f clcommit.m4sh && cat > ./config/libtoolize <<'EOF' diff --git a/tests/Makefile.am b/tests/Makefile.am index d5f7ba0dc..5f58bfd2d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -## Process this file with automake to produce Makefile.in +## Makefile.am -- Process this file with automake to produce Makefile.in ## ## Copyright (C) 2003, 2004 Free Software Foundation ## @@ -17,7 +17,56 @@ ## the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ## Boston, MA 02111-1307, USA. -DISTCLEANFILES = +## ------------ ## +## Test suite. ## +## ------------ ## + +TESTSUITE = testsuite +TESTSUITE_AT = testsuite.at \ + am-subdir.at + +EXTRA_DIST = $(TESTSUITE) $(TESTSUITE_AT) package.m4 + +# Be sure to reexport important environment variables: +TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ + CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ + LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ + OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" F77="$(F77)" \ + FFLAGS="$(FFLAGS)" CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CPP="$(CPP)" + +# ../Makefile knows how to rebuild this file: +$(srcdir)/package.m4: + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) update-package-m4 + +$(srcdir)/$(TESTSUITE): $(srcdir)/package.m4 $(TESTSUITE_AT) + cd $(srcdir); \ + $(AUTOTEST) testsuite.at -o $(TESTSUITE) + +atconfig: $(top_builddir)/config.status + cd $(top_builddir); \ + ./config.status tests/atconfig + +# Hook the test suite into the check rule +check-local: atconfig $(srcdir)/$(TESTSUITE) + $(TESTS_ENVIRONMENT) $(SHELL) $(srcdir)/$(TESTSUITE) $(TESTSUITE_FLAGS) + +# Run the test suite on the *installed* tree. +installcheck-local: + $(TESTS_ENVIRONMENT) $(SHELL) $(srcdir)/$(TESTSUITE) $(TESTSUITE_FLAGS) AUTOTEST_PATH=$(exec_prefix)/bin + +# We need to remove any file droppings left behind by testsuite +clean-local: clean-local-legacy + $(SHELL) $(srcdir)/$(TESTSUITE) --clean + + +## ------------- ## +## Legacy tests. ## +## ------------- ## + +# !WARNING! Don't add any new tests here, we are migrating to an +# Autotest driven framework, please add new test cases +# using the new framework above. When the migration is +# complete this section should be removed. CXX_TESTS = \ tagdemo-static.test tagdemo-make.test tagdemo-exec.test \ @@ -85,16 +134,7 @@ demo-conf.test: $(top_builddir)/libtool $(top_builddir)/libtool: cd $(top_builddir) && $(MAKE) all -# Be sure to reexport important environment variables. -# This is a copy of ../Makefile.am (TESTS_ENVIRONMENT), be sure to -# keep them is sync if you change them before these tests are migrated! -TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ - CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \ - LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ - OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" F77="$(F77)" \ - FFLAGS="$(FFLAGS)" CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CPP="$(CPP)" - -EXTRA_DIST = defs.in defs.m4sh $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS) +EXTRA_DIST += defs.in defs.m4sh $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS) DIST_SUBDIRS = $(CONF_SUBDIRS) # FIXME: Automake-1.7b (at least) only honours DIST_SUBDIRS if SUBDIRS is @@ -102,7 +142,7 @@ DIST_SUBDIRS = $(CONF_SUBDIRS) SUBDIRS = . # We need to remove any files that the above tests created. -clean-local: +clean-local-legacy: -for dir in cdemo demo depdemo f77demo mdemo mdemo2 pdemo tagdemo; \ do \ test -f $$dir/Makefile && ( cd $$dir && $(MAKE) distclean; ); \ @@ -110,6 +150,6 @@ clean-local: rm -rf _inst $(TESTS): defs -defs: defs.in ../Makefile.am - cd .. && $(MAKE) $(AM_MAKEFLAGS) tests/defs -DISTCLEANFILES += defs +defs: defs.in $(top_srcdir)/Makefile.am + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) tests/defs +DISTCLEANFILES = defs