Detailed description of the Application. mk file for NDK development, ndkapplication. mk

Source: Internet
Author: User

Detailed description of the Application. mk file for NDK development, ndkapplication. mk

Those who have developed NDK should know that there is an Application. mk file, which is an optional build file used by the android NDK build system. It aims to describe the modules required by the application and defines some common variables of all modules. There are mainly the following variables.

APP_MODULESBy default, ndk builds all modules declared in the android. xk file. However, this variable overwrites the above behavior.
Assume that the android. mk file is as follows:

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)

The application. mk file is as follows:

APP_MODULES := jni1

The system will only generate the libjni1.so file, instead of the libjni2.so file. To generate libjni2.so, we can do this:

APP_MODULES := jni1 jni2

APP_OPTIM:This variable can be set to release or debug, which can change the optimization level of the generated binary file. The default mode is release. The generated binary file is highly optimized. If debugging is required, we 'd better set it to debug mode.

APP_CLAGS:This variable lists some compiler flags that are passed to the compiler when compiling C or C ++ code of any module.

APP_CPPFLAGS:This variable lists some compiler flags that are passed to the compiler when compiling the C ++ code of any module.

APP_ABI:By default, the ndk build system is armeabi, which generates a binary file. This variable can change the above behavior:

APP_ABI := armeabi armeabi-v7a x86

To generate a binary file for all supported ABI files:

APP_ABI := all

APP_STL:By default, the ndk build system uses the smallest stl Runtime Library, also known as the system library. This variable can change the above behavior.

APP_GUNSTL_FORCE_CPP_FEATURES:It indicates that all modules depend 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 when there are a large number of source files. Similar to LOCAL_SHORT_COMMANDS.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger. I am very grateful if you have any mistakes.

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.