diff options
-rw-r--r-- | comfignat.mk | 53 | ||||
-rwxr-xr-x | 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.</p> <p>Those Make variables that installing users are expected to change can be configured persistently. Run "<samp>make configure</samp>" with some variables -set on the command line. Those variables will then be saved in a file named -<var>comfignat_configuration.mk</var>, which will be loaded in all subsequent -Make invocations. Additional variables can be configured incrementally. The -configuration can be erased with "<samp>make unconfigure</samp>" or as a part -of "<samp>make distclean</samp>".</p> +set on the command line or in the environment. Those variables will then be +saved in a file named <var>comfignat_configuration.mk</var>, 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 "<samp>make unconfigure</samp>" or as a part of +"<samp>make distclean</samp>".</p> <p>The variables that can be configured are listed in the variable <var>configuration_variables</var>. The variables listed in <var>options</var> |