Rombobjörn

summaryrefslogtreecommitdiff
path: root/comfignat.mk
diff options
context:
space:
mode:
authorBjörn Persson <bjorn@rombobjörn.se>2013-09-10 22:17:25 +0200
committerBjörn Persson <bjorn@rombobjörn.se>2013-09-10 22:17:25 +0200
commit935002e8992193b670d0fb60519e1020e1b9b52d (patch)
tree67e1f4e7352a0d26655000af4a9e6eab392373d6 /comfignat.mk
parenteecfaa22e39f3613bd73241526cf99a68d3986ca (diff)
Save even environment variables in the configuration file.
Diffstat (limited to 'comfignat.mk')
-rw-r--r--comfignat.mk53
1 files changed, 33 insertions, 20 deletions
diff --git a/comfignat.mk b/comfignat.mk
index 7916743..23e71aa 100644
--- a/comfignat.mk
+++ b/comfignat.mk
@@ -496,33 +496,46 @@ ${builddir}/Makefile: | ${builddir}
# How to save configured variables:
configure:: ${builddir}/Makefile
@echo "Writing ${configuration}."
- @( ${foreach variable,${configuration_variables}, \
- ${if ${or ${findstring command line, \
- ${origin ${variable}}}, \
- ${filter true,${${variable}_is_overridden}}, \
- ${filter true,${${variable}_is_configured}}}, \
- echo 'ifneq "$${origin ${variable}}" "command line"';\
- echo ' override ${variable} = ${value ${variable}}';\
+ @( ${foreach var,${configuration_variables}, \
+ ${if ${or ${findstring command line,${origin ${var}}}, \
+ ${filter true,${${var}_is_overridden}}, \
+ ${filter true,${${var}_is_configured}}}, \
+ echo 'ifneq "$${origin ${var}}" "command line"'; \
+ echo ' override ${var} = ${value ${var}}';\
echo 'endif'; \
- echo '${variable}_is_configured = true'; \
- echo;}} \
+ echo '${var}_is_configured = true'; \
+ echo;, \
+ ${if ${or ${findstring environment,${origin ${var}}}, \
+ ${filter true,${${var}_is_weakly_configured}}}, \
+ echo 'ifneq "$${origin ${var}}" "environment"'; \
+ echo ' ${var} = ${value ${var}}'; \
+ echo 'endif'; \
+ echo '${var}_is_weakly_configured = true'; \
+ echo;}}} \
true \
) > "${configuration}"
# Out of the variables listed in configuration_variables, all that were
-# overridden on the command line, and all that were previously configured, are
-# written to the configuration file. Configured values override defaults
-# defined later in the containing makefile, but can be overridden on the
-# command line. A variable is considered previously configured if there is
-# another variable with "_is_configured" appended to its name and a value of
-# "true". Such a variable is also written for each configured variable. As a
-# side effect of this it is possible to delete a variable V from the
-# configuration by running "make configure V_is_configured=false".
+# overridden on the command line, all that are set in the environment and not
+# overridden elsewhere, and all that were previously configured, are written
+# to the configuration file. Command-line-configured values override defaults
+# assigned later in the containing makefile, but can be overridden on the
+# command line. Environment-configured values override defaults assigned with
+# "?=", but can be overridden in the environment or on the command line. A
+# variable is considered previously configured if there is another variable
+# with "_is_configured" or "_is_weakly_configured" appended to its name and a
+# value of "true". Such a variable is also written for each configured
+# variable. As a side effect of this it is possible to delete a variable V from
+# the configuration by running "make configure V_is_configured=false
+# V_is_weakly_configured=false".
# How to show the values of configured variables:
show_configuration::
- @${foreach variable,${configuration_variables}, \
- ${if ${filter true,${${variable}_is_configured}}, \
- echo '${variable} = ${value ${variable}}';}}
+ @${foreach var,${configuration_variables}, \
+ ${if ${filter true,${${var}_is_configured}}, \
+ echo '${var} = ${value ${var}}';} \
+ ${if ${filter true,${${var}_is_weakly_configured}}, \
+ echo '${var} ?= ${value ${var}}';}} \
+ true
# How to preprocess the project Comfignat:
${builddir}/comfignat.gpr: comfignat.gpr.gp | ${builddir}