diff Makefile.am @ 21413:3fb2bdea47a5

check substituted variables against current make variables * build-aux/check-subst-vars.in.sh: New script. * Makefile.am (EXTRA_DIST): Include it in the list. (GEN_CONFIG_SHELL, AUTOCONF_SUBST_VARS, ALL_SUBST_VARS): New variables. (config-vars, make-vars, check-subst-vars): New targets. (CLEANFILES): Include config-vars and make-vars in the list. * configure.ac (AUTOCONF_SUBST_VARS): Define and substitute. (OCTAVE_CONFIG_FILES): Include build-aux/check-subst-vars.sh in the list of generated files. * build-aux/common.mk: Use := to define version and api_version.
author John W. Eaton <jwe@octave.org>
date Mon, 07 Mar 2016 19:06:35 -0500
parents 9773a1c2b55f
children 1562e7e27f6d
line wrap: on
line diff
--- a/Makefile.am	Mon Mar 07 19:07:25 2016 -0500
+++ b/Makefile.am	Mon Mar 07 19:06:35 2016 -0500
@@ -46,6 +46,7 @@
   NEWS \
   README \
   build-aux/OctJavaQry.class \
+  build-aux/check-subst-vars.in.sh \
   build-aux/find-files-with-tests.sh \
   build-aux/mk-default-qt-settings.in.sh \
   build-aux/mk-f77-def.in.sh \
@@ -63,6 +64,25 @@
   run-octave.in \
   $(BUILT_DISTFILES)
 
+GEN_CONFIG_SHELL = \
+  build-aux/mk-default-qt-settings.sh \
+  build-aux/mk-f77-def.sh \
+  build-aux/mk-mxarray-h.sh \
+  build-aux/mk-version-h.sh \
+  build-aux/subst-config-vals.sh \
+  build-aux/subst-cross-config-vals.sh \
+  build-aux/subst-default-vals.sh \
+  build-aux/subst-f77-isnan-macro.sh \
+  build-aux/subst-script-vals.sh
+
+AUTOCONF_SUBST_VARS = @AUTOCONF_SUBST_VARS@
+ALL_SUBST_VARS = \
+  $(AUTOCONF_SUBST_VARS) \
+  abs_top_builddir \
+  abs_top_srcdir \
+  api_version \
+  version
+
 DIRSTAMP_FILES =
 
 octave_dirstamp = $(am__leading_dot)octave-dirstamp
@@ -173,7 +193,9 @@
 noinst_SCRIPTS = run-octave
 
 CLEANFILES += \
-  $(BUILT_SOURCES)
+  $(BUILT_SOURCES) \
+  config-vars \
+  make-vars
 
 DISTCLEANFILES += \
   .gdbinit \
@@ -214,6 +236,23 @@
 	$(AM_V_GEN)$(MKDIR_P) bits && \
 	$(INSTALL_HEADER) $< $@
 
+config-vars: $(GEN_CONFIG_SHELL)
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	$(SED) -n 's/  *"$$/"/; s/^\([A-Za-z_][A-Za-z0-9_]*\)=" *\(.*\)" *$$/\1 \2/p' $^ | sort -u > $@-t && \
+	mv $@-t $@
+
+## We always have to create this file because values for Make variables
+## may be passed on the command line.
+
+make-vars:
+	$(file >$@-t) $(foreach v, $(ALL_SUBST_VARS), $(file >>$@-t,$(v) $(value $(v))))
+	$(AM_V_GEN)mv $@-t $@
+.PHONY: make-vars
+
+check-subst-vars: build-aux/check-subst-vars.sh make-vars config-vars
+	@$(SHELL) -f build-aux/check-subst-vars.sh make-vars config-vars
+.PHONY: check-subst-vars
+
 ## If we aren't trying to fix stl_algo.h, then try to ensure that
 ## there isn't a stray copy sitting in the build tree.