2017-04-12 102 views
0

我知道它很简单,但我错过了这里的一些东西。如何在ifdef条件中提供make文件参数来代替

我想在x86主机上构建我的代码。当我给make它为手臂建立。

我想知道如何让这个构建到我的主机?我设置变量LOCAL_BUILD:=host和给make主机我得到了错误。

make: *** No rule to make target 'host'. Stop. 

common.makefile,这看起来是怎样的。

DEFAULT: all 

# Generic platform code 

LOCAL_BUILD:=host 

ifdef LOCAL_BUILD 
include $(PLATFORM)/scripts/x86.makefile 
else 
include $(PLATFORM)/scripts/arm.makefile 
endif 

all: 
ifndef LOCAL_BUILD 
    TOP=$(TOP)/scripts/see.sh 
endif 
    mkdir -p $(BUILD_DIR) 
    $(MAKE) imag 

编辑: 默认情况下它建立了手臂,我的意思只是make从目录建立了手臂。

如何从make参数替换ifdef变量?

任何帮助非常感谢谢谢。

+0

“我设置变量LOCAL_BUILD:=主机”。你的'common.makefile'不是 表明。 [mcve]需要。 –

回答

1

如何用make参数替换ifdef变量?

Variables assigned to in make command line override assignments in the makefile,例如:

$ cat Makefile 
LOCAL_BUILD := anything 
$(info LOCAL_BUILD=${LOCAL_BUILD}) 

$ make 
LOCAL_BUILD=anything 
make: *** No targets. Stop. 

$ make LOCAL_BUILD=host 
LOCAL_BUILD=host 
make: *** No targets. Stop. 
+0

实际上'make LOCAL_BUILD = host',替换值。我现在可以建立,谢谢。我的错误是'make host'。我的印象是我可以传递变量的价值。 – LethalProgrammer

相关问题