Makefile ifeq logical or

前端 未结 5 804
有刺的猬
有刺的猬 2020-12-02 06:51

How do you perform a logical OR using make\'s ifeq operator?

e.g., I have (simplified):

ifeq ($(GCC_MINOR), 4)
    CFLAGS += -fno-strict         


        
5条回答
  •  心在旅途
    2020-12-02 07:14

    I don't think there's a concise, sensible way to do that, but there are verbose, sensible ways (such as Foo Bah's) and concise, pathological ways, such as

    ifneq (,$(findstring $(GCC_MINOR),4-5))
        CFLAGS += -fno-strict-overflow
    endif
    

    (which will execute the command provided that the string $(GCC_MINOR) appears inside the string 4-5).

提交回复
热议问题