An explanation of the Application.mk file developed by NDK

Source: Internet
Author: User

The students who have done the NDK development should know that there is a application.mk file, which is an optional build file used by the Android NDK build system. Its purpose is to describe which modules are required by the application and to define some common variables for all modules. There are several variables in the main.

app_modules, by default, the NDK builds all the modules declared in the Android.xk file. But this variable overrides the above behavior.
If our android.mk file is like this:

Local_path :=$(Call My-dir)include $(Clear_vars)Local_module    := Jni1Local_src_files := jni1.cinclude $(build_shared_library)include $(Clear_vars)Local_module    := Jni2Local_src_files := jni2.cinclude $(build_shared_library)

Application.mk file is:

APP_MODULES := jni1

The system will only generate the libjni1.so file, and the libjni2.so file will not be generated. If you want to generate libjni2.so, then we can do this:

APP_MODULES := jni1 jni2

App_optim: This variable can be set to release or debug, which can change the level of optimization of the generated binary files. The release mode is the default. The generated binaries are highly optimized at this point. If you need to debug, we'd better set it to debug mode.

app_clags: This variable lists compiler flags that will be passed to the compiler when compiling C or C + + code for any module.

app_cppflags: This variable lists compiler flags that will be passed to the compiler when compiling C + + code for any module.

App_abi: By default, the NDK build system generates a binary file for Armeabi,abi that can change the behavior described above:

APP_ABI := armeabi armeabi-v7a x86

If you want to generate a binary file for all supported Abi:

APP_ABI := all

app_stl: By default, the NDK build system uses the smallest STL runtime, also known as the System library, which can change the behavior described above.

app_gunstl_force_cpp_features: indicates that all modules are dependent on specific C + + features, similar to Local_cpp_extensions.

app_short_commands: This variable allows the build system to use shorter commands in the project in the case of a large number of source files. Similar to Local_short_commands.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. If there is a wrong place, I would appreciate it if I could criticize it.

An explanation of the Application.mk file developed by NDK

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.