On Tue, 23 Aug 2022 22:08:10 GMT, Erik Joelsson <er...@openjdk.org> wrote:
>> @erikj79 I couldn't get it to work. I believe the following is evaluated >> only once, so `$(JVM_VARIANT)` is bound to the value when HotspotCommon.gmk >> is loaded: >> >> >> check-jvm-feature = \ >> $(strip \ >> $(if $(filter-out $(VALID_JVM_FEATURES), $1), \ >> $(error Internal error: Invalid feature tested: $1)) \ >> $(if $(filter $1, $(JVM_FEATURES_$(JVM_VARIANT))), true, false)) >> >> >> So I would need to run a submake in order to get this function to behave >> differently for each variant. That's going to be complicated in order to >> support multiple JVM variants per build. >> >> I heard that we are going to remove multiple variant support (?), so maybe >> this is not worth it. > > The suggested code should be something like this, note the double `$$` in the > call. > > Suggestion: > > $1_$2_CDS_DUMP_FLAGS := $$(CDS_DUMP_FLAGS) > ifeq ($$(call check-jvm-feature, g1gc), true) > $1_$2_CDS_DUMP_FLAGS += -XX:+UseG1GC > endif I just realized that check-jvm-feature is only defined in HotspotCommon.gmk, which isn't included here (and can't really be either without modifications). Sorry to lead you on a wild goose chase. Unless Magnus can think of a reasonable way of exposing that macro here, I think your current solution is good enough. ------------- PR: https://git.openjdk.org/jdk/pull/9984