The android. mk file is a required file for compiling C code using ndk. The Android. mk file describes which c files will be compiled and how to compile them. To understand how to compile Android. mk files, you can master the keywords that will be used in them. Let's take a look at a simple example. This example uses the android ndk
Example of helljni.
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := hello-jniLOCAL_SRC_FILES := hello-jni.cinclude $(BUILD_SHARED_LIBRARY)
Local_path is the root directory of all c files to be compiled. The value $ (call my-DIR) indicates that the root directory is the directory where Android. mk is located.
Include $ (clear_vars) indicates that the global variables used in the compiling environment are cleared when the ndk compilation tool is used, such as local_module and local_src_files, because android may be called multiple times during an ndk compilation process. the global variables used in the MK file may change. I have read the following complex examples for this question and may understand it.
Local_module is part of the name when the library is finally generated, and the prefix lib and suffix. So is the name libhello-jni.so of the generated shared library.
Local_src_files indicates the name of the C file to be compiled
Include $ (build_shared_library) indicates that some shared libraries will be generated during ndk compilation.
Refer:
Makefile (Android. mk) in Android Compiling System
Android makefile (Android. mk) analysis (sequence)
Android. mk usage and basics
<! -- Jiathis button begin -->
<Div id = "ckepop">
<A href = "http://www.jiathis.com/share" class = "jiathis jiathis_txt" target = "_ blank"> </a>
<A class = "jiathis_counter_style_margin: 3px 0 0 2px"> </a>
</Div>
<SCRIPT type = "text/JavaScript" src = "http://v2.jiathis.com/code_mini/jia.js" charset = "UTF-8"> </SCRIPT>
<! -- Jiathis button end --> <! -- Jiathis button begin -->
<Div id = "ckepop">
<A href = "http://www.jiathis.com/share" class = "jiathis jiathis_txt" target = "_ blank"> </a>
<A class = "jiathis_counter_style_margin: 3px 0 0 2px"> </a>
</Div>
<SCRIPT type = "text/JavaScript" src = "http://v2.jiathis.com/code_mini/jia.js" charset = "UTF-8"> </SCRIPT>
<! -- Jiathis button end -->
/**
* @ Author Zhang xingye
* Email: xy-Zhang # 163.com
* Android Development Group: 278401545
*
*/