build: ensure that a release build fails when a submodule is unclean
authorJim Meyering <meyering@redhat.com>
Sat, 2 May 2009 20:20:10 +0000 (22:20 +0200)
committerJim Meyering <meyering@redhat.com>
Sat, 2 May 2009 20:20:10 +0000 (22:20 +0200)
* top/maint.mk (no-submodule-changes): New rule.
(alpha beta major): Depend on it.

ChangeLog
top/maint.mk

index aacbc0c00421af6ca1a7e5e06aa82898fce651d3..3d72119df11ba88d2b54abf5a5a3ff193fd92162 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-05-02  Jim Meyering  <meyering@redhat.com>
+
+       build: ensure that a release build fails when a submodule is unclean
+       * top/maint.mk (no-submodule-changes): New rule.
+       (alpha beta major): Depend on it.
+
 2009-05-02  Bruno Haible  <bruno@clisp.org>
 
        Remove incompatibility between modules fnmatch-posix and fnmatch-gnu.
index b7f68680ba5601ca8fb2fc559fb77acc57b2b79f..f34f6bf04bbdb60432b613de39df603b36ccb09b 100644 (file)
@@ -676,9 +676,21 @@ define emit-commit-log
     '* cfg.mk (old_NEWS_hash): Auto-update.'
 endef
 
+.PHONY: no-submodule-changes
+no-submodule-changes:
+       if test -d .git; then                                           \
+         diff=$$(git submodule -q foreach git diff-index --name-only HEAD) \
+           || exit 1;                                                  \
+         case $$diff in '') ;;                                         \
+           *) echo '$(ME): submodule files are locally modified:';     \
+               echo "$$diff"; exit 1;; esac;                           \
+       else                                                            \
+         : ;                                                           \
+       fi
+
 .PHONY: alpha beta major
 ALL_RECURSIVE_TARGETS += alpha beta major
-alpha beta major: $(local-check) writable-files
+alpha beta major: $(local-check) writable-files no-submodule-changes
        test $@ = major                                         \
          && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
               || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\