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>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
<code>make CONF_NAME=&lt;name&gt;</code> or
<code>make CONF=&lt;pattern&gt;</code>, where
<code>&lt;pattern&gt;</code> is a substring matching one or several
configurations, e.g. <code>CONF=debug</code>. The special empty pattern
(<code>CONF=</code>) will match <em>all</em> available configuration, so
<code>make CONF= hotspot</code> will build the <code>hotspot</code>
target for all configurations. Alternatively, you can execute
<code>make</code> in the configuration directory, e.g.
<code>cd build/&lt;name&gt; &amp;&amp; make</code>.</p>
<code>make CONF=&lt;selector&gt;</code>, where
<code>&lt;selector&gt;</code> is interpreted as follows:</p>
<ul>
<li>If <code>&lt;selector&gt;</code> exacly matches the name of a
configuration, this and only this configuration will be selected.</li>
<li>If <code>&lt;selector&gt;</code> matches (i.e. is a substring of)
the names of several configurations, then all these configurations will
be selected.</li>
<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>
<p>If you update the repository and part of the configure script has
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
build/<name> && bash ../../configure`.
Then you can build that configuration using `make CONF_NAME=<name>` or `make
CONF=<pattern>`, where `<pattern>` is a substring matching one or several
configurations, e.g. `CONF=debug`. The special empty pattern (`CONF=`) will
match *all* available configuration, so `make CONF= hotspot` will build the
`hotspot` target for all configurations. Alternatively, you can execute `make`
in the configuration directory, e.g. `cd build/<name> && make`.
Then you can build that configuration using `make CONF=<selector>`, where
`<selector>` is interpreted as follows:
* If `<selector>` exacly matches the name of a configuration, this and only
this configuration will be selected.
* 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

View File

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

View File

@ -202,8 +202,14 @@ ifeq ($(HAS_SPEC),)
matching_confs := $$(strip $$(all_confs))
else
# Otherwise select those that contain the given CONF string
matching_confs := $$(strip $$(foreach var, $$(all_confs), \
$$(if $$(findstring $$(CONF), $$(var)), $$(var))))
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), \
$$(if $$(findstring $$(CONF), $$(var)), $$(var))))
endif
ifneq ($$(filter $$(CONF), $$(matching_confs)), )
# If we found an exact match, use that
matching_confs := $$(CONF)