From 935002e8992193b670d0fb60519e1020e1b9b52d Mon Sep 17 00:00:00 2001 From: Björn Persson Date: Tue, 10 Sep 2013 22:17:25 +0200 Subject: Save even environment variables in the configuration file. --- comfignat.mk | 53 +++++++++++++++++++++++++++++++++-------------------- manual.en.html | 13 ++++++++----- 2 files changed, 41 insertions(+), 25 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} diff --git a/manual.en.html b/manual.en.html index 70703e4..a9d125a 100755 --- a/manual.en.html +++ b/manual.en.html @@ -425,11 +425,14 @@ your default.

Those Make variables that installing users are expected to change can be configured persistently. Run "make configure" with some variables -set on the command line. Those variables will then be saved in a file named -comfignat_configuration.mk, which will be loaded in all subsequent -Make invocations. Additional variables can be configured incrementally. The -configuration can be erased with "make unconfigure" or as a part -of "make distclean".

+set on the command line or in the environment. Those variables will then be +saved in a file named comfignat_configuration.mk, which will be +loaded in all subsequent Make invocations. Additional variables can be +configured incrementally. In subsequent Make invocations environment variables +override values that were configured from the environment, and variables set on +the command line override all configured values. The configuration can be +erased with "make unconfigure" or as a part of +"make distclean".

The variables that can be configured are listed in the variable configuration_variables. The variables listed in options -- cgit v1.2.3