2017-04-12 101 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

相關問題