Best way to do conditionals ?

David Holmes david.holmes at oracle.com
Fri Apr 12 12:33:40 UTC 2013


On 12/04/2013 7:02 PM, David Holmes wrote:
> I need to examine the JVM_VARIANT(S) variables and logically I want to do:
>
> if (client and server)
>    ...
> else
>    ...
> endif
>
>
> Nesting if blocks doesn't work - I need a conjunction, or a way to
> define a single variable using a conjunction.
>
> Suggestions?

So I re-discovered the "and" operation

   CLIENT_AND_SERVER := $(and $(findstring true, $(JVM_VARIANT_SERVER)), 
$(findstring true, $(JVM_VARIANT_CLIENT)))
   ifeq ($(CLIENT_AND_SERVER), true)
     # Use the committed jvm.cfg for this 32 bit setup but add
     # minimal if needed
     $(JVMCFG): $(JVMCFG_SRC)
         $(call install-file)
         ifeq ($(JVM_VARIANT_MINIMAL1), true)
           $(PRINTF) "-minimal KNOWN\n">>$(@)
         endif
   else
     $(JVMCFG):
         @$(ECHO) C=$(JVM_VARIANT_CLIENT) S=$(JVM_VARIANT_SERVER) 
BOTH=$(CLIENT_AND_SERVER)

Yet I always execute the else but print:

C=true S=true BOTH=true


I'm stumped! :(

Thanks,
David



More information about the build-dev mailing list