Monkey_play
Monkey_play

Reputation: 73

Using ifeq with multiple options

I want check for a condition in makefile using ifeq, & not sure how to go about:

ifeq ( cond1 = yes || cond2 = yes )   
  set value x = 1;   
else  
  set value x = 2;  
endif 

Please suggest the proper way to do it?

Upvotes: 4

Views: 8148

Answers (3)

Addishiwot Shimels
Addishiwot Shimels

Reputation: 342

If you want to check if x=4 or x=6

ifeq ($(x),$(filter $(x),4 6))   
   x is either 4 or 6. do whatever you like with it
else  
   x is neither 4 nor 6  
endif

Upvotes: 12

Wengchong Tan
Wengchong Tan

Reputation: 11

Alternate answer is:

ifneq (,$(filter yes,$(cond1) $(cond2)))   
   x := 1
else  
   x := 2
endif

Upvotes: 1

Mark Galeck
Mark Galeck

Reputation: 6385

ifeq ($(filter $(cond1) $(cond2),yes),)
    x := 2
else  
    x := 1
endif 

Upvotes: 4

Related Questions