Best way to do conditionals ?
David Chase
david.r.chase at oracle.com
Sat Apr 13 13:24:44 UTC 2013
On 2013-04-12, at 7:00 PM, David Holmes <david.holmes at oracle.com> wrote:
>
> Thanks for the sanity check.
>
> This implies to me that either
>
> a) it is a phase 1 versus phase 2 issue, but given the content of spec.gmk I can't see how that can be the case; or
>
> b) the value of something is not what I naively thing it is ...
>
> but I have investigated both of those in depth and nothing seems to be wrong. Yet I always take the else path :(
I think I have it, or at least, I can reproduce your results:
-------------------------------
JVM_VARIANT_SERVER := true
JVM_VARIANT_CLIENT := true
ifeq ($(CLIENT_AND_SERVER1), true)
one: two
@echo one then C=$(JVM_VARIANT_CLIENT) S=$(JVM_VARIANT_SERVER) BOTH1=$(CLIENT_AND_SERVER1) BOTH2=$(CLIENT_AND_SERVER2)
else
one: two
@echo one else C=$(JVM_VARIANT_CLIENT) S=$(JVM_VARIANT_SERVER) BOTH1=$(CLIENT_AND_SERVER1) BOTH2=$(CLIENT_AND_SERVER2)
endif
ifeq ($(CLIENT_AND_SERVER2), true)
two:
@echo two then C=$(JVM_VARIANT_CLIENT) S=$(JVM_VARIANT_SERVER) BOTH1=$(CLIENT_AND_SERVER1) BOTH2=$(CLIENT_AND_SERVER2)
else
two:
@echo two else C=$(JVM_VARIANT_CLIENT) S=$(JVM_VARIANT_SERVER) BOTH1=$(CLIENT_AND_SERVER1) BOTH2=$(CLIENT_AND_SERVER2)
endif
CLIENT_AND_SERVER1 := $(and $(findstring true, $(JVM_VARIANT_SERVER)), $(findstring true, $(JVM_VARIANT_CLIENT)))
CLIENT_AND_SERVER2 := $(and $(JVM_VARIANT_SERVER), $(JVM_VARIANT_CLIENT))
--------------------------------------
two else C=true S=true BOTH1=true BOTH2=true
one else C=true S=true BOTH1=true BOTH2=true
This seems a little simple, but it is at least a reproduction.
More information about the build-dev
mailing list