8325626: Allow selection of non-matching configurations using CONF=!string

Reviewed-by: erikj, jwaters
This commit is contained in:
Magnus Ihse Bursie 2024-02-13 09:51:33 +00:00
parent 618af397b4
commit ec20b0aa2e
4 changed files with 50 additions and 21 deletions

View File

@ -2166,15 +2166,26 @@ you can create a directory under <code>build</code> and run
<code>configure</code> from there, e.g. <code>configure</code> from there, e.g.
<code>mkdir build/&lt;name&gt; &amp;&amp; cd build/&lt;name&gt; &amp;&amp; bash ../../configure</code>.</p> <code>mkdir build/&lt;name&gt; &amp;&amp; cd build/&lt;name&gt; &amp;&amp; bash ../../configure</code>.</p>
<p>Then you can build that configuration using <p>Then you can build that configuration using
<code>make CONF_NAME=&lt;name&gt;</code> or <code>make CONF=&lt;selector&gt;</code>, where
<code>make CONF=&lt;pattern&gt;</code>, where <code>&lt;selector&gt;</code> is interpreted as follows:</p>
<code>&lt;pattern&gt;</code> is a substring matching one or several <ul>
configurations, e.g. <code>CONF=debug</code>. The special empty pattern <li>If <code>&lt;selector&gt;</code> exacly matches the name of a
(<code>CONF=</code>) will match <em>all</em> available configuration, so configuration, this and only this configuration will be selected.</li>
<code>make CONF= hotspot</code> will build the <code>hotspot</code> <li>If <code>&lt;selector&gt;</code> matches (i.e. is a substring of)
target for all configurations. Alternatively, you can execute the names of several configurations, then all these configurations will
<code>make</code> in the configuration directory, e.g. be selected.</li>
<code>cd build/&lt;name&gt; &amp;&amp; make</code>.</p> <li>If <code>&lt;selector&gt;</code> is empty (i.e. <code>CONF=</code>),
then all configurations will be selected.</li>
<li>If <code>&lt;selector&gt;</code> begins with <code>!</code>, then
all configurations <strong>not</strong> matching the string following
<code>!</code> will be selected.</li>
</ul>
<p>A more specialized version, <code>CONF_NAME=&lt;name&gt;</code> also
exists, which will only match if the given <code>&lt;name&gt;</code>
exactly matches a single configuration.</p>
<p>Alternatively, you can execute <code>make</code> in the configuration
directory, e.g. <code>cd build/&lt;name&gt; &amp;&amp; make</code>.</p>
<p><code>make CONF_NAME=&lt;name&gt;</code> or</p>
<h3 id="handling-reconfigurations">Handling Reconfigurations</h3> <h3 id="handling-reconfigurations">Handling Reconfigurations</h3>
<p>If you update the repository and part of the configure script has <p>If you update the repository and part of the configure script has
changed, the build system will force you to re-run changed, the build system will force you to re-run

View File

@ -1952,12 +1952,25 @@ configuration with the name `<name>`. Alternatively, you can create a directory
under `build` and run `configure` from there, e.g. `mkdir build/<name> && cd under `build` and run `configure` from there, e.g. `mkdir build/<name> && cd
build/<name> && bash ../../configure`. build/<name> && bash ../../configure`.
Then you can build that configuration using `make CONF_NAME=<name>` or `make Then you can build that configuration using `make CONF=<selector>`, where
CONF=<pattern>`, where `<pattern>` is a substring matching one or several `<selector>` is interpreted as follows:
configurations, e.g. `CONF=debug`. The special empty pattern (`CONF=`) will
match *all* available configuration, so `make CONF= hotspot` will build the * If `<selector>` exacly matches the name of a configuration, this and only
`hotspot` target for all configurations. Alternatively, you can execute `make` this configuration will be selected.
in the configuration directory, e.g. `cd build/<name> && make`. * If `<selector>` matches (i.e. is a substring of) the names of several
configurations, then all these configurations will be selected.
* If `<selector>` is empty (i.e. `CONF=`), then all configurations will be
selected.
* If `<selector>` begins with `!`, then all configurations **not** matching the
string following `!` will be selected.
A more specialized version, `CONF_NAME=<name>` also exists, which will only
match if the given `<name>` exactly matches a single configuration.
Alternatively, you can execute `make` in the configuration directory, e.g. `cd
build/<name> && make`.
`make CONF_NAME=<name>` or
### Handling Reconfigurations ### Handling Reconfigurations

View File

@ -87,10 +87,9 @@ help:
$(info $(_) # (gensrc, java, copy, libs, launchers, gendata)) $(info $(_) # (gensrc, java, copy, libs, launchers, gendata))
$(info ) $(info )
$(info Make control variables) $(info Make control variables)
$(info $(_) CONF= # Build all configurations (note, assignment is empty)) $(info $(_) CONF=<selector> # Select which configuration(s) to build)
$(info $(_) CONF=<substring> # Build the configuration(s) with a name matching) $(info $(_) CONF= # Select all configurations (note, assignment is empty))
$(info $(_) # <substring>) $(info $(_) CONF_NAME=<string> # Select the configuration with the name <string>)
$(info $(_) CONF_NAME=<string> # Build the configuration with exactly the <string>)
$(info $(_) SPEC=<spec file> # Build the configuration given by the spec file) $(info $(_) SPEC=<spec file> # Build the configuration given by the spec file)
$(info $(_) LOG=<loglevel> # Change the log level from warn to <loglevel>) $(info $(_) LOG=<loglevel> # Change the log level from warn to <loglevel>)
$(info $(_) # Available log levels are:) $(info $(_) # Available log levels are:)

View File

@ -202,8 +202,14 @@ ifeq ($(HAS_SPEC),)
matching_confs := $$(strip $$(all_confs)) matching_confs := $$(strip $$(all_confs))
else else
# Otherwise select those that contain the given CONF string # Otherwise select those that contain the given CONF string
ifeq ($$(patsubst !%,,$$(CONF)),)
# A CONF starting with ! means we should negate the search term
matching_confs := $$(strip $$(foreach var, $$(all_confs), \
$$(if $$(findstring $$(subst !,,$$(CONF)), $$(var)), ,$$(var))))
else
matching_confs := $$(strip $$(foreach var, $$(all_confs), \ matching_confs := $$(strip $$(foreach var, $$(all_confs), \
$$(if $$(findstring $$(CONF), $$(var)), $$(var)))) $$(if $$(findstring $$(CONF), $$(var)), $$(var))))
endif
ifneq ($$(filter $$(CONF), $$(matching_confs)), ) ifneq ($$(filter $$(CONF), $$(matching_confs)), )
# If we found an exact match, use that # If we found an exact match, use that
matching_confs := $$(CONF) matching_confs := $$(CONF)