By default, the Android* NDK is configured to build an application for debugging within Eclipse* and all optimizations are turned off. When the code is ready for deployment, you must compile it for performance.
Open Application.mk in your application’s jni folder at %NDK_DIR%\samples\hello-jni\jni\.
To switch to the release mode, add the following line:
APP_OPTIM=release
To target a specific processor, for example, to build application to run on the Intel® Atom™ processor, add the following line:
APP_CFLAGS:=-xATOM_SSSE3
To enable advanced optimizations of Intel® C++ Compiler, for example, to increase the optimization level, add the following line:
APP_CFLAGS:=-xATOM_SSSE3 –O3
To enable interprocedural optimizations, add:
APP_CFLAGS:=-xATOM_SSSE3 –O3 –ipo
Build the application.
Note
The APP_OPTIM and APP_CFLAGS can be given as arguments in building from the command line. Here is an example:
>>ndk-build V=1 -B APP_ABI=x86 NDK_TOOLCHAIN:=x86-icc APP_OPTIM=release APP_CFLAGS=”-xATOM_SSSE3 –O3 -ipo”