我想使用一个命令行变量来选择我们用来编译的工具包。在命令行中,我可以使用如下行:
make all-arm OUR_TOOLKIT=1
并且,在每个隐含的makefile中,我都加入了这个include。
include ARM_Compiler.inc
然后,在每个Makefile文件中,
all: setToolkit $(otherOperations)
ARM_Compiler的内容是选择编译器的逻辑:
setToolkit:
ifdef OUR_TOOLKIT
TOOLKIT=1
endif
ifdef CUSTOMER_TOOLKIT
TOOLKIT=2
endif
ifeq ($(TOOLKIT), 1)
$(info "=========Our toolkit selected======================")
rm=/bin/rm -f
CC= arm-linux-c++ -fPIC
CXX= arm-linux-c++ -fPIC
LINK= arm-linux-c++ -shared -Wl
AR= ar cq
RANLIB= ranlib
STRIP=arm-linux-strip
# para que se utilicen las herramientas y librerias del cross compiler
PATH:=$(PATH):/path/to/our/toolkit
LD_LIBRAY_PATH:=$(LD_LIBRAY_PATH):/path/to/our/toolkit
endif
ifeq ($(TOOLKIT), 2)
$(info "================Customer toolkit selected====================")
rm=/bin/rm -f
CC= arm-none-linux-gnueabi-c++ -fPIC
CXX= arm-none-linux-gnueabi-c++ -fPIC
LINK= arm-none-linux-gnueabi-c++ -shared -Wl
AR= ar cq
RANLIB= ranlib
STRIP= arm-none-linux-gnueabi-strip
# para que se utilicen las herramientas y librerias del cross compiler
PATH:=$(PATH):/path/to/other/toolkit
LD_LIBRAY_PATH:=$(LD_LIBRAY_PATH):/path/to/other/toolkit
endif
在0A0D的帮助下,我发现TOOLKIT值始终为空。我稍微修改了代码。现在的问题是make命令抛出了错误。
../makefile-includes/ARM-compiler.inc:10: *** commands commence before first target
在这一行:
ifeq ($(TOOLKIT), 1)
有人有一些想法吗? 谢谢。