天天看點

makefile中兩重if判斷

makefile中兩重if判斷

法一:

ifeq ($(GCC_MINOR),$(filter $(GCC_MINOR),4 5))

filter X, A B will return those of A,B that are equal X.

A variation of this is

ifneq (,$(filter $(GCC_MINOR),4 5))

where a negative comparison against an empty string is used instead (filter will return en empty string if GCC_MINOR doesn't match the arguments)

法二:

You can introduce another variable. It doesnt consolidate both checks, but it at least avoids having to put the body in twice:

do_it =

ifeq ($(GCC_MINOR), 4)

do_it = yes

endif

ifeq ($(GCC_MINOR), 5)

ifdef do_it

CFLAGS += -fno-strict-overflow

原文:

http://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or

繼續閱讀