From ec20b0aa2ed711daeea5d0a09102093b3a2a49ec Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 13 Feb 2024 09:51:33 +0000 Subject: [PATCH] 8325626: Allow selection of non-matching configurations using CONF=!string Reviewed-by: erikj, jwaters --- doc/building.html | 29 ++++++++++++++++++++--------- doc/building.md | 25 +++++++++++++++++++------ make/Global.gmk | 7 +++---- make/InitSupport.gmk | 10 ++++++++-- 4 files changed, 50 insertions(+), 21 deletions(-) diff --git a/doc/building.html b/doc/building.html index d51e74d1454..96d2916de41 100644 --- a/doc/building.html +++ b/doc/building.html @@ -2166,15 +2166,26 @@ 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.

+make CONF=<selector>, where +<selector> is interpreted as follows:

+ +

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

If you update the repository and part of the configure script has changed, the build system will force you to re-run diff --git a/doc/building.md b/doc/building.md index 9d928a39245..61daed2270b 100644 --- a/doc/building.md +++ b/doc/building.md @@ -1952,12 +1952,25 @@ configuration with the name ``. Alternatively, you can create a directory under `build` and run `configure` from there, e.g. `mkdir build/ && cd build/ && bash ../../configure`. -Then you can build that configuration using `make CONF_NAME=` or `make -CONF=`, where `` 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/ && make`. +Then you can build that configuration using `make CONF=`, where +`` is interpreted as follows: + +* If `` exacly matches the name of a configuration, this and only + this configuration will be selected. +* If `` matches (i.e. is a substring of) the names of several + configurations, then all these configurations will be selected. +* If `` is empty (i.e. `CONF=`), then all configurations will be + selected. +* If `` begins with `!`, then all configurations **not** matching the + string following `!` will be selected. + +A more specialized version, `CONF_NAME=` also exists, which will only +match if the given `` exactly matches a single configuration. + +Alternatively, you can execute `make` in the configuration directory, e.g. `cd +build/ && make`. + +`make CONF_NAME=` or ### Handling Reconfigurations diff --git a/make/Global.gmk b/make/Global.gmk index e5e76b475b9..1df6c5fb6bc 100644 --- a/make/Global.gmk +++ b/make/Global.gmk @@ -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= # Build the configuration(s) with a name matching) - $(info $(_) # ) - $(info $(_) CONF_NAME= # Build the configuration with exactly the ) + $(info $(_) CONF= # Select which configuration(s) to build) + $(info $(_) CONF= # Select all configurations (note, assignment is empty)) + $(info $(_) CONF_NAME= # Select the configuration with the name ) $(info $(_) SPEC= # Build the configuration given by the spec file) $(info $(_) LOG= # Change the log level from warn to ) $(info $(_) # Available log levels are:) diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index 31c80e2f726..9ea01d375ce 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -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)