diff Makefile.am @ 21815:418b6066e544

new maintainer-mode for build (bug #48101) * configure.ac: Provide --enable-maintainer-mode option. If maintainer-mode is enabled, set AM_CONDITIONAL AMCOND_MAINTAINER_MODE to true. * Makefile.am (HG-ID): Write "maintainer-mode" to HG-ID file if AMCOND_MAINTAINER_MODE is true. (maintainer-mode-dist-hook): New target. (dist-hook): Also depend on maintainer-mode-dist-hook.
author John W. Eaton <jwe@octave.org>
date Thu, 02 Jun 2016 17:58:33 -0400
parents fccffef9d210
children 7b0436d0f5be
line wrap: on
line diff
--- a/Makefile.am	Wed Jun 01 19:02:03 2016 -0400
+++ b/Makefile.am	Thu Jun 02 17:58:33 2016 -0400
@@ -173,7 +173,16 @@
 include m4/module.mk
 include test/module.mk
 
-dist-hook: doc-interpreter-dist-hook docs-dist-hook icons-dist-hook scripts-dist-hook
+dist-hook: maintainer-mode-dist-hook doc-interpreter-dist-hook docs-dist-hook icons-dist-hook scripts-dist-hook
+
+if AMCOND_MAINTAINER_MODE
+## HG-ID must be correct to package distribution.
+maintainer-mode-dist-hook:
+	@echo "Maintainer-mode enabled.  Cannot package distribution!"
+	exit 1
+else
+maintainer-mode-dist-hook:
+endif
 
 if AMCOND_BUILD_DOCS
 docs-dist-hook:
@@ -293,8 +302,20 @@
 	$(AM_V_GEN)$(changelog-from-hg-log)
 .PHONY: ChangeLog
 
+if AMCOND_MAINTAINER_MODE
+## Avoid unnecessary building just because HG-ID changes (for example,
+## editing a .m file will cause + to be appended to the hg ID and that
+## will trigger compiling the build-info.cc files, relinking libraries
+## and .oct files).
 HG-ID:
 	$(AM_V_GEN)rm -f $@-t && \
+	echo "maintainer-mode" > $@-t && \
+	$(simple_move_if_change_rule)
+else
+HG-ID:
+## Store hg ID in binaries so that we can identify botched installations
+## that are using incorrect or mismatched libraries.
+	$(AM_V_GEN)rm -f $@-t && \
 	if [ -d $(srcdir)/.hg ]; then \
 	  ( cd $(srcdir) && hg identify --id || echo "unknown" ) > $@-t && \
 	  $(simple_move_if_change_rule); \
@@ -305,6 +326,7 @@
 	  echo "preserving existing HG-ID file" 1>&2; \
 	  $(cp_update_rule); \
 	fi
+endif
 .PHONY: HG-ID
 
 octetc_DATA += \