7
我想根據條件在Makefile中定義變量。由於ifeq只能在規則中運行,因此我爲每個規則添加了一個額外的規則(def_rule)。使用ifeq在Makefile中定義條件變量
例子:
def_rule:
ifeq ($(TARGET), android)
CC=arm-linux-androideabi-gcc
else
echo "native build"
endf
all: def_rule tp xi_eid_chipset.o
不幸的是,調用使所有返回此:
ifeq (linux, android)
/bin/sh: Syntax error: word unexpected (expecting ")")
make: *** [def_rule] Error 2
我想不通爲什麼。我剛剛遵循GNU Make文檔中的例子。
你知道如何在Makefiles中做條件定義嗎?