I am trying to use the var command line to select the tools we use to compile. When on the command line I use a line like:
make all-arm OUR_TOOLKIT=1
And in every makefile it is implied that I include
include ARM_Compiler.inc
Then in each makefile
all: setToolkit $(otherOperations)
And the contents of ARM_Compiler is the compiler choice logic:
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
Thanks to the help of 0A0D, I found that the TOOLKIT value is always empty. I changed the code a bit. Now the problem is that make throws an error
../makefile-includes/ARM-compiler.inc:10: *** commands commence before first target
in this line:
ifeq ($(TOOLKIT), 1)
Does anyone have an idea? Thanks
source share