I've downloaded a custom toolchain (linaro) to build ARM based Android apps. How do I tell the NDK to use it? Can I define or set something in Android.mk and Application.mk that would allow me to do that? Is there another way?
The NDK makefile system is quite extensible and you can indeed define a different toolchain. You'll need some understanding of how Make works.
Toolchains are discovered and initialized in build/core/init.mk
line 261 (in NDKr6, the line # may change in future versions). The initialization code looks for files named config.mk
under $(NDK_ROOT)/toolchains/*
. So you'll need to add your toolchain in a subdirectory under the NDK toolchains directory, and add a config.mk
and setup.mk
to that subdirectory. Look at toolchains/x86-4.4.3
and toolchains/arm-linux-androideabi-4.4.3
for examples. You should be able to cut and paste the ARM toolchain config.mk
and setup.mk
if your toolchain has a standard layout.
Once you've defined a toolchain in the toolchain directory, you can switch to it by setting the NDK_TOOLCHAIN
variable inside your Application.mk
file.