2014-10-29 45 views
1

我要檢查使用IFEQ makefile中的條件,&不知道如何去:使用IFEQ多個選項

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

請建議適當的方式做到這一點?

+2

可能重複的[生成文件IFEQ邏輯或(HTTP://計算器.com/questions/7656425/makefile-ifeq-logical-or) – Chnossos 2014-10-29 08:29:00

回答

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

充分利用它!感謝回覆 ! – 2014-11-07 08:46:05

2

除了上面給出的正確答案:如果要檢查是否爲x = 4或x = 6

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