diff --git a/Makefile b/Makefile index 550039a1df6..56e11c69f50 100644 --- a/Makefile +++ b/Makefile @@ -44,13 +44,25 @@ SAGE_ROOT_LOGS = logs # except for build/make/Makefile-auto, which is unused by the build system CONFIG_FILES = build/make/Makefile src/bin/sage-env-config build/bin/sage-build-env-config pkgs/sage-conf/_sage_conf/_conf.py -# SPKG_COLLECT_FILES contains all files that influence the SAGE_SPKG_COLLECT macro -SPKG_COLLECT_FILES = build/pkgs/*/type build/pkgs/*/package-version.txt build/pkgs/*/dependencies build/pkgs/*/requirements.txt build/pkgs/*/checksums.ini build/pkgs/*/spkg-install - -# If configure was run before, rerun it with the old arguments. -# Otherwise, run configure with argument $PREREQ_OPTIONS. +# SPKG_COLLECT_FILES contains the files that influence the *runtime* of the +# portions of the 'configure' script generated by the SAGE_SPKG_COLLECT macro +SPKG_COLLECT_FILES = build/pkgs/*/package-version.txt build/pkgs/*/dependencies* + +# If configure was not run before, complain. +# If configure is newer than the files it generated (we test build/make/Makefile), +# we regenerate config.status by running the "config.status --recheck". +# Either way we regenerate the generated files by calling "config.status". build/make/Makefile: configure $(SPKG_COLLECT_FILES) $(CONFIG_FILES:%=%.in) - $(MAKE) reconfigure + @if [ -x config.status ]; then \ + case '$?' in \ + *configure*|*package-version*|*dependencies*) \ + $(MAKE) reconfigure;; \ + *) \ + ./config.status;; \ + esac; \ + else \ + $(MAKE) reconfigure; \ + fi reconfigure: rm -f config.log @@ -324,7 +336,25 @@ ptestoptionallong-nodoc: ############################################################################### -configure: bootstrap src/doc/bootstrap configure.ac src/bin/sage-version.sh m4/*.m4 build/pkgs/*/spkg-configure.m4 build/pkgs/*/type build/pkgs/*/install-requires.txt build/pkgs/*/package-version.txt build/pkgs/*/distros/*.txt +# The 'configure' script is just one of the files generated by 'bootstrap'. +# CONFIGURE_DEPENDENCIES is the list of files that influence the generation of 'configure'. +CONFIGURE_DEPENDENCIES = \ + configure.ac src/bin/sage-version.sh m4/*.m4 \ + build/pkgs/*/spkg-configure.m4 \ + build/pkgs/*/type build/pkgs/*/SPKG.rst \ + build/pkgs/*/checksums.ini build/pkgs/*/requirements.txt \ + build/pkgs/*/install-requires.txt build/pkgs/*/package-version.txt \ + build/pkgs/*/spkg-install build/pkgs/*/spkg-install.in + +# SPKG_INFO_DEPENDENCIES is the list of files that influence the run of 'sage-spkg-info' and hence +# the generation of the files generated in 'src/doc' by 'src/doc/bootstrap'. +SPKG_INFO_DEPENDENCIES = \ + build/pkgs/*/type build/pkgs/*/SPKG.rst \ + build/pkgs/*/requirements.txt \ + build/pkgs/*/install-requires.txt build/pkgs/*/package-version.txt \ + build/pkgs/*/distros/*.txt + +configure: bootstrap src/doc/bootstrap $(CONFIGURE_DEPENDENCIES) $(SPKG_INFO_DEPENDENCIES) ./bootstrap -d install: all