"Android Local Development technology: compiling scripts" android.mk

Source: Internet
Author: User
<span id="Label3"></p><p><p>Guo Xiaoxing<br>Weibo: Guo Xiaoxing's Sina Weibo<br>Email:<span class="__cf_email__" data-cfemail="d5b4b9b9b0bba2b0b9b9a695e4e3e6fbb6bab8">[email protected]</span><br>Blog: Http://blog.csdn.net/allenwells<br>Github:https://github.com/allenwells</p></p>Role and characteristics of a ANDROID.MK file 1.1 android.mk file role<p><p>This file is used to describe the build system, a miniature GNU makefile fragment that is parsed one or more times by the compilation System.</p></p>1.2 android.mk file Features <ul> <ul> <li>This file is used to organize the source files into modules that contain static or dynamic Libraries. Only dynamic libraries are installed in the app package, and static libraries can be used to generate dynamic Libraries.</li> <li>A module can define a ANDROID.MK file, and multiple modules can also have a common android.mk file</li> </ul> </ul>-you do not need to android.mk in the file or other dependencies, the compilation system will automatically calculate Processing. Two android.mk file variables 2.1 LOCAL variable 2.1.1 Local_path<p><p>local_path:=$ (call My-dir)</p></p><p><p>The Android.mk file must start with the Local_path variable, which is used to locate the file in the Tree. The macro feature "my-dir" is provided by the compilation system and is used to return the current directory path (including the android.mk file itself).</p></p>2.1.2 Local_module<p><p>Local_module: =hello-jni</p></p><p><p>The local_module variable must be defined to distinguish each of the modules in a Android.mk. The file name must be unique and cannot have Spaces.</p></p><p><p><strong>Note</strong> : The compiler automatically adds some prefixes and suffixes to guarantee the uniqueness of the module Name. For example, "hello-jni" is converted to "libhellp-jni.so", and "hello-jni" is still used when loading a dynamic library in Java.</p></p>2.1.3 Local_module_filename<p><p>The variable is optional and allows the name of the generated file to be Redefined. By default, the module will always generate LIB.A or lib.so files, which is the standard UNIX Convention.</p></p>2.1.4 Local_src_files<p><p>Local_src_files: = Hello-jni.c</p></p><p><p>The local_src_files variable is required to include a list of C and C + + source files, which are compiled and aggregated into a single module.</p></p><p><p><strong>Note</strong> : There is no need to list header files and included files, the compilation system automatically calculates the relevant properties, and the list in the source code is passed directly to the Compiler.</p></p>2.1.5 Local_c_includes<p><p>The header file directory that needs to be included.</p></p>2.1.6 Local_ldlibs<p><p>Local_ldlibs: =-lz</p></p><p><p>This statement indicates that the dynamic library must be linked/system/lib/libz.so when the dynamic library is Loaded. Additional linker options are required to compile the module, indicating the system library that the module relies on at compile Time.</p></p>2.1.7 Local_shared_libraries<p><p>A list of dynamic libraries that are dependent on the runtime of the module, which is required at link time to embed the appropriate information when the file is Generated.</p></p><p><p><strong>Note</strong> : It does not attach the listed modules to the compilation diagram, which means that you need to add them in application.mk to the module that the program Requires.</p></p>2.1.8 local_static_libraries<p><p>Represents the list of static libraries required to compile the Module. This module makes sense only if the current module is a dynamic library.</p></p>2.1.9 Local_whole_static_libraries<p><p>The variable indicates that the corresponding library is used as the entire archive into the Linker.</p></p><p><p><strong>Note</strong> : It is often useful to have a cyclic dependency between several static Libraries. Note that when it comes to compiling a dynamic library, this will force you to add all the object files in the static library to the final binary file. however, This is not deterministic when generating executable programs.</p></p>2.1.10 local_java_libraries<p><p>When compiling Java applications and libraries, you specify the Java class library that is included, and there are two core and framework Types. It is generally defined in the following form:</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs fix"><span class="hljs-attribute">LOCAL_JAVA_LIBRARIES :</span>=<span class="hljs-string"> core framework</span></code></pre></pre>2.1.11 local_cpp_extension<p><p>This is an optional variable that can be defined as a source file with a C + + file extension, and the default is ". cpp", but you can change it, for example</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs avrasm"><span class="hljs-label">LOCAL_CPP_EXTENSION:</span>=<span class="hljs-preprocessor">.cxx</span></code></pre></pre>2.1.12 Local_cppflags<p><p>The option to pass to the compiler when compiling C + + code (compiling C code will not use the options here). In the last command-line option, the option specified here is followed by the option specified in Local_cflags.</p></p>2.1.13 Local_cflags<p><p>An optional compiler flag is passed when compiling A/C + + source File.</p></p><p><p><strong>Note</strong> :</p></p> <ul> <ul> <li>This approach is useful for specifying additional macro definitions or compilation Options.</li> </ul> </ul>-try not to change the optimization/debug level in android.mk, this can be handled automatically for you by setting the appropriate information in the application.mk, and will let the NDK generate useful data files for use during debugging. 2.1.14 Local_export_cflags<p><p>This variable is defined to record a collection of C + + compiler flags and is added to any other local_cflags definitions of modules in Local_static_libraries and Local_shared_libraries.</p></p><p><p><strong>Example</strong></p></p><p><p>With module "foo"</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs ruby"><span class="hljs-keyword">include</span><span class="hljs-variable">$(</span><span class="hljs-constant">CLEAR_VARS</span>)<span class="hljs-constant">LOCAL_MODULE</span><span class="hljs-symbol">:</span>=foo<span class="hljs-constant">LOCAL_SRC_FILES</span><span class="hljs-symbol">:</span>=foo/foo.c<span class="hljs-constant">LOCAL_EXPORT_CFLAGS</span><span class="hljs-symbol">:</span>=-<span class="hljs-constant">DFOO</span>=<span class="hljs-number">1</span><span class="hljs-keyword">include</span><span class="hljs-variable">$(</span><span class="hljs-constant">BUILD_STATIC_LIBRARY</span>)</code></pre></pre><p><p>Another module "bar" relies on module "foo"</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs ruby"><span class="hljs-keyword">include</span><span class="hljs-variable">$(</span><span class="hljs-constant">CLEAR_VARS</span>)<span class="hljs-constant">LOCAL_MODULE</span><span class="hljs-symbol">:</span>=bar<span class="hljs-constant">LOCAL_SRC_FILES</span><span class="hljs-symbol">:</span>=bar.c<span class="hljs-constant">LOCAL_CFLAGS</span><span class="hljs-symbol">:</span>=-<span class="hljs-constant">DBAR</span>=<span class="hljs-number">2</span><span class="hljs-constant">LOCAL_STATIC_LIBRARIES</span><span class="hljs-symbol">:</span>=foo<span class="hljs-keyword">include</span><span class="hljs-variable">$(</span><span class="hljs-constant">BUILD_SHARED_LIBRARY</span>)</code></pre></pre><p><p>When compiling bar.c, the flag "-dfoo=1-dbar=2" is passed to the compiler, and the output flags are added to the local_cflags of the module, so you can easily replicate Them. They also have transitivity: if the "zoo" relies on "bar" and "bar" depends on "foo", then "zoo" will inherit all the flags of "foo" Output. These flags are not used when compiling the output flags of the Module. When FOO/FOO.C is compiled,-dfoo=1 will not be passed to the Compiler.</p></p>2.1.15 Local_export_cppflags<p><p>Similar to local_export_cflags, but applies to C + + flags.</p></p>2.1.16 Local_export_c_includes<p><p>Similar to local_export_c_cflags, but only C can contain paths, which is useful if "bar.c" wants to include some header files provided by the "foo" Module.</p></p>2.1.17 Local_export_ldlibs<p><p>Similar to local_export_cflags, but only for link flags. Note that the introduced link flag will be appended to the Module's local_ldlibs because of how the UNIX connector works. This is useful when the module foo is a static library and the code relies on the system library. Local_export_ldlibs can be used for output dependencies,</p></p><p><p><strong>Example</strong></p></p><pre class="prettyprint"><code class=" hljs ruby"><span class="hljs-keyword"><span class="hljs-keyword">include</span></span> <span class="hljs-variable"><span class="hljs-variable">$(</span></span><span class="hljs-constant"><span class="hljs-constant">Clear_vars</span></span>)<span class="hljs-constant"><span class="hljs-constant">Local_module</span></span> <span class="hljs-symbol"><span class="hljs-symbol">:</span></span>= Foo<span class="hljs-constant"><span class="hljs-constant">Local_src_files</span></span> <span class="hljs-symbol"><span class="hljs-symbol">:</span></span>= FOO/FOO.C<span class="hljs-constant"><span class="hljs-constant">Local_export_ldlibs</span></span> <span class="hljs-symbol"><span class="hljs-symbol">:</span></span>=-llog<span class="hljs-keyword"><span class="hljs-keyword">include</span></span> <span class="hljs-variable"><span class="hljs-variable">$(</span></span><span class="hljs-constant"><span class="hljs-constant">build_static_library</span></span>)<span class="hljs-keyword"><span class="hljs-keyword">include</span></span> <span class="hljs-variable"><span class="hljs-variable">$(</span></span><span class="hljs-constant"><span class="hljs-constant">Clear_vars</span></span>)<span class="hljs-constant"><span class="hljs-constant">Local_module</span></span> <span class="hljs-symbol"><span class="hljs-symbol">:</span></span>= Bar<span class="hljs-constant"><span class="hljs-constant">Local_src_files</span></span> <span class="hljs-symbol"><span class="hljs-symbol">:</span></span>= Bar.c<span class="hljs-constant"><span class="hljs-constant">local_static_libraries</span></span> <span class="hljs-symbol"><span class="hljs-symbol">:</span></span>= Foo<span class="hljs-keyword"><span class="hljs-keyword">include</span></span> <span class="hljs-variable"><span class="hljs-variable">$(</span></span><span class="hljs-constant"><span class="hljs-constant">build_shared_library</span></span>)</code></pre><p><p>here, at the end of the connector command, libbar.so will compile with the-llog parameter to indicate that it relies on the System log library because it relies on foo.</p></p>2.1.18 Local_prelink_module<p><p>Whether to do PreLink processing. The default is to do dynamic library Optimization.</p></p>2.1.19 Local_prebuilt_executables<p>pre-compiled including<span class="MathJax_Preview"><span class="MathJax_Preview"></span></span><span class="MathJax" id="MathJax-Element-1-Frame" role="textbox" aria-readonly="true" style=""> <nobr> <span class="math" id="MathJax-Span-1" style="width: 10.25em; display: inline-block;"><span style="display: inline-block; position: relative; width: 9.448em; height: 0px; font-size: 108%;"><span style="position: absolute; clip: rect(1.176em 1000.003em 2.596em -0.429em); top: -2.157em; left: 0.003em;"><span class="mrow" id="MathJax-Span-2"><span class="mo" id="MathJax-Span-3" style="font-family: MathJax_Main;"><span class="mo" id="MathJax-Span-3" style="font-family: MathJax_Main;">(</span></span><span class="mi" id="MathJax-Span-4" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-4" style="font-family: MathJax_Math; font-style: italic;">B</span></span><span class="mi" id="MathJax-Span-5" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-5" style="font-family: MathJax_Math; font-style: italic;">U <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.065em;"></span> </span></span><span class="mi" id="MathJax-Span-6" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-6" style="font-family: MathJax_Math; font-style: italic;">I <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.065em;"></span> </span></span><span class="mi" id="MathJax-Span-7" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-7" style="font-family: MathJax_Math; font-style: italic;">L</span></span><span class="msubsup" id="MathJax-Span-8"><span class="msubsup" id="MathJax-Span-8"><span style="display: inline-block; position: relative; width: 0.991em; height: 0px;"> <span style="position: absolute; clip: rect(1.238em 1000.003em 2.287em -0.491em); top: -2.096em; left: 0.003em;"> <span class="mi" id="MathJax-Span-9" style="font-family: MathJax_Math; font-style: italic;"></span>D<span style="display: inline-block; width: 0px; height: 2.102em;"><span style="position: absolute; top: -1.972em; left: 0.497em;"></span></span></span><span class="mi" id="MathJax-Span-10" style="font-size: 70.7%; font-family: MathJax_Math; font-style: italic;">P <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.065em;"><span style="display: inline-block; width: 0px; height: 2.102em;"></span></span> </span> </span></span></span><span class="mi" id="MathJax-Span-11" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-11" style="font-family: MathJax_Math; font-style: italic;">R</span></span><span class="mi" id="MathJax-Span-12" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-12" style="font-family: MathJax_Math; font-style: italic;">E <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span> </span></span><span class="mi" id="MathJax-Span-13" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-13" style="font-family: MathJax_Math; font-style: italic;">B</span></span><span class="mi" id="MathJax-Span-14" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-14" style="font-family: MathJax_Math; font-style: italic;">U <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.065em;"></span> </span></span><span class="mi" id="MathJax-Span-15" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-15" style="font-family: MathJax_Math; font-style: italic;">I <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.065em;"></span> </span></span><span class="mi" id="MathJax-Span-16" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-16" style="font-family: MathJax_Math; font-style: italic;">L</span></span><span class="mi" id="MathJax-Span-17" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-17" style="font-family: MathJax_Math; font-style: italic;">T <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.127em;"></span> </span></span><span class="mo" id="MathJax-Span-18" style="font-family: MathJax_Main;"><span class="mo" id="MathJax-Span-18" style="font-family: MathJax_Main;">)</span></span><span class="texatom" id="MathJax-Span-19"><span class="texatom" id="MathJax-Span-19"><span class="mrow" id="MathJax-Span-20"><span class="mo" id="MathJax-Span-21"><span style="font-family: STIXGeneral, ‘Arial Unicode MS‘, serif; font-size: 93%; font-style: normal; font-weight: normal;">or</span></span></span></span></span><span class="texatom" id="MathJax-Span-22"><span class="texatom" id="MathJax-Span-22"><span class="mrow" id="MathJax-Span-23"><span class="mo" id="MathJax-Span-24"><span style="font-family: STIXGeneral, ‘Arial Unicode MS‘, serif; font-size: 93%; font-style: normal; font-weight: normal;">who</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.164em;"><span style="display: inline-block; width: 0px; height: 2.164em;"></span></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.27em; vertical-align: -0.33em;"><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.27em; vertical-align: -0.33em;"></span></span></span> </nobr></span>(build_host_prebuilt), Specify the executable file that needs to be copied.</p>2.1.20 Local_required_modules<p><p>Specifies the module on which the module is to be run (the module on which it depends will be installed synchronously when the module is mounted).</p></p>2.1.21 Local_allow_undefined_symbols<p><p>By default, any undefined references that are encountered when trying to compile a shared library can cause an "undefined symbol" (undefined symbol) Error. This can be useful for capturing bugs in your source Code. If you want to disable this check, you can set the value to True.</p></p>2.1.22 Local_arm_mode<p><p>···<br>Local_arm_mode: = ARM<br>···</p></p><p><p>By default, the arm target binary is generated in thumb mode, where each instruction is 16-bit Wide. You can define this variable as "arm" if you want to force the generation of the Module object file in "arm" mode (32-bit instruction).</p></p>2.1.23 Local_arm_neon<p><p>This variable is "true" to allow the use of ARM advanced SIMD (aka Neon) in your internal functions of the GCC of your C or C + + source files, as well as the neon instructions in the aggregation File.</p></p><p><p><strong>Note</strong> : You should define the ARMV7 instruction set that corresponds to the "armeabi-v7a" abi. Not all ARMv7 are cpu-based neon instruction set extensions, and you should run the runtime to detect the security of this code at Runtime. alternatively, You can specify a specific source file, such as a source file that supports the Neon ". neon" suffix, which can also be compiled.</p></p><p><p>···<br>Local_src_files: =foo.c.neon bar.c Zoo.c.arm.neon<br>···<br>In this example, "foo.c" will be compiled in Thumb+neon mode, "bar.c" is compiled in thumb mode and zoo.c compiled in Arm+neon mode. If you use two, the ". neon" suffix must appear after the ". arm" suffix.</p></p>2.1.24 Local_disable_no_execute<p><p>Android NDK R4 has started adding features that support the "nx bit" security Feature. It is enabled by default, and you can disable it by setting the variable to "true" if you want.</p></p><p><p><strong>Note</strong> : This feature does not modify the ABI and is only enabled on the kernel of ARMV6 and above CPU Devices.</p></p>2.1.25 Local_short_commands<pre class="prettyprint"><pre class="prettyprint"><code class=" hljs bash"><span class="hljs-literal">true</span> /flase</code></pre></pre><p><p>When there are many source files in the module, or depending on a lot of static or dynamic Libraries. This forces the compilation system to use an intermediate list file and use @$ (listfile) syntax with the library archiver or static linker.</p></p><p><p><strong>Note</strong> :</p></p> <ul> <ul> <li>This is especially useful on Windows because its command line receives up to 8,191 characters, which is obviously too small for more complex projects.</li> <li>This function is turned on when the value is set to true, and the other values revert to the default Behavior.</li> </ul> </ul>-this feature is not recommended by default because it slows down the compilation Speed. 2.1.26 local_force_static_executable<p><p>Set this value to True if the compiled executable is to be statically linked (execution is not dependent on any dynamic libraries).</p></p>2.1.27 local_filter_asm<p><p>This variable specifies a shell command to filter the assembly files that are listed in the Local_src_files or compiled by local_src_files files Listed. After the variable is defined, the following behavior is caused:</p></p> <ul> <ul> <li>All C + + source code is translated into a temporary assembly file (if You do not define local_filter_asm, the C + + source code is compiled directly as an obj File)</li> <li>These assembly files are passed to the shell command specified by local_filter_asm, and a batch of new assembly files is Obtained.</li> </ul> </ul>-(these new assembly files are then compiled into the obj file.)<p><p>In other words, if you define:</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs avrasm">LOCAL_SRC_FILES := foo<span class="hljs-preprocessor">.c</span> bar<span class="hljs-preprocessor">.S</span> </code></pre></pre><p><p>The FOO.C is first passed to the compiler (gcc) to get Foo. s.orignal, and then this foo. S.original is passed to your specified filter (local_asm_filter) to get Foo. S, and then passed to the assembler (for example, As) to get FOO.O. Bar. The S is passed directly to the filter to get bar. s.new, and then pass it on to the assembler and get BAR.O. That is, in the from <em>. S to</em> . O adds a filtering link to the compilation process. The filter must be a stand-alone shell command, the input file as its first command-line argument, the output file as the second command-line argument,</p></p><p><p>For example:</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs avrasm"> myasmfilter $OBJS_DIR/foo<span class="hljs-preprocessor">.S</span><span class="hljs-preprocessor">.original</span> $OBJS_DIR/foo<span class="hljs-preprocessor">.S</span> myasmfilter bar<span class="hljs-preprocessor">.S</span> $OBJS_DIR/bar<span class="hljs-preprocessor">.S</span> </code></pre></pre>2.2 CLEAR Variable 2.2.1 clear_vars<p><p>The Clear_vars variable is provided by the compilation system and indicates a GNU makefile file, which is defined in The/build/core/config.mk file as:</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs avrasm"><span class="hljs-label">CLEAR_VARS:</span>=$(BUILD_SYSTEM)/clear_vars<span class="hljs-preprocessor">.mk</span>)</code></pre></pre><p><p>This feature clears all content that starts with local_.</p></p>2.3 BUILD Variable 2.3.1 build_shared_library<p><p>Include $ (build_shared_library)</p></p><p><p>Build_shared_library This variable is provided by the system and assigned to the GNU Makefile script, which collects all defined "include $ (clear_vars)" variables in the beginning of the local_, and decides which ones are to be compiled, What should be done more accurately. The compilation generates a "lib.so" file, which is the generated dynamic library.</p></p>2.3.2 Build_static_library<p><p>Include $ (build_ STATIC _library)</p></p><p><p>Build_shared_library This variable is provided by the system and assigned to the GNU Makefile script, which collects all defined "include $ (clear_vars)" variables in the beginning of the local_, and decides which ones are to be compiled, What should be done more accurately. The compilation generates a "lib.a" file, which is the generated static library.</p></p>2.3.3 Build_executable<p><p>Include $ (build_executable)<br>Compiled into native C executable Program.</p></p>2.3.4 build_java_library.2.3.5 Build_static_java_library<p><p>Compile the static Java Library.</p></p>2.3.6 build_host_java_library<p><p>Compile a native Java library.</p></p>2.3.7 Build_package<p><p>Include $ (build_package)</p></p><p><p>If it is a Java file, use Build_package to indicate that it will use the System's compilation script Host_java_library.mk.</p></p>2.4 TARGET Variable 2.4.1 target_root_out<p><p>Local_module_path: =$ (target_root_out)</p></p><p><p>Root file System.</p></p>2.4.2 Target_out<p><p>System File Systems.</p></p>2.4.3 Target_out_data<p><p>Data File System</p></p>2.4.4 Target_arch<p><p>The target CPU schema name, if "arm" claims ARM compliant directives, regardless of the CPU schema Version.</p></p>2.4.5 Target_abi<p><p>A link to the target platform and the abi, where you define</p></p><p><span class="MathJax_Preview"><span class="MathJax_Preview"></span></span><span class="MathJax" id="MathJax-Element-2-Frame" role="textbox" aria-readonly="true" style=""> <nobr> <span class="math" id="MathJax-Span-25" style="width: 9.941em; display: inline-block;"><span style="display: inline-block; position: relative; width: 9.201em; height: 0px; font-size: 108%;"><span style="position: absolute; clip: rect(1.238em 1000.003em 2.596em -0.429em); top: -2.157em; left: 0.003em;"><span class="mrow" id="MathJax-Span-26"><span class="mo" id="MathJax-Span-27" style="font-family: MathJax_Main;"><span class="mo" id="MathJax-Span-27" style="font-family: MathJax_Main;">(</span></span><span class="mi" id="MathJax-Span-28" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-28" style="font-family: MathJax_Math; font-style: italic;">T <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.127em;"></span> </span></span><span class="mi" id="MathJax-Span-29" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-29" style="font-family: MathJax_Math; font-style: italic;">A</span></span><span class="mi" id="MathJax-Span-30" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-30" style="font-family: MathJax_Math; font-style: italic;">R</span></span><span class="mi" id="MathJax-Span-31" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-31" style="font-family: MathJax_Math; font-style: italic;">G</span></span><span class="mi" id="MathJax-Span-32" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="mathjax-span-32" style="font-family:mathjax_math; font-style:italic;">E<span style=" display:inline-block; overflow:hidden; height:1px; width:0.003em; "></span></span></span><span class="msubsup" id="MathJax-Span-33"><span class="msubsup" id="MathJax-Span-33"><span style="display: inline-block; position: relative; width: 1.052em; height: 0px;"> <span style="position: absolute; clip: rect(1.238em 1000.003em 2.287em -0.552em); top: -2.096em; left: 0.003em;"> <span class="mi" id="MathJax-Span-34" style="font-family: MathJax_Math; font-style: italic;">T<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.127em;"><span style="display: inline-block; width: 0px; height: 2.102em;"><span style="position: absolute; top: -1.972em; left: 0.559em;"></span></span></span></span></span><span class="mi" id="MathJax-Span-35" style="font-size: 70.7%; font-family: MathJax_Math; font-style: italic;">P <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.065em;"><span style="display: inline-block; width: 0px; height: 2.102em;"></span></span> </span> </span></span></span><span class="mi" id="MathJax-Span-36" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-36" style="font-family: MathJax_Math; font-style: italic;">L</span></span><span class="mi" id="MathJax-Span-37" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-37" style="font-family: MathJax_Math; font-style: italic;">A</span></span><span class="mi" id="MathJax-Span-38" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-38" style="font-family: MathJax_Math; font-style: italic;">T <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.127em;"></span> </span></span><span class="mi" id="MathJax-Span-39" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-39" style="font-family: MathJax_Math; font-style: italic;">F <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.127em;"></span> </span></span><span class="mi" id="MathJax-Span-40" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-40" style="font-family: MathJax_Math; font-style: italic;">O</span></span><span class="mi" id="MathJax-Span-41" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-41" style="font-family: MathJax_Math; font-style: italic;">R</span></span><span class="mi" id="MathJax-Span-42" style="font-family: MathJax_Math; font-style: italic;"><span class="mi" id="MathJax-Span-42" style="font-family: MathJax_Math; font-style: italic;">M <span style="display: inline-block; overflow: hidden; height: 1px; width: 0.065em;"></span> </span></span><span class="mo" id="MathJax-Span-43" style="font-family: MathJax_Main;"><span class="mo" id="MathJax-Span-43" style="font-family: MathJax_Main;">)</span></span><span class="mo" id="MathJax-Span-44" style="font-family: MathJax_Main; padding-left: 0.25em;"><span class="mo" id="MathJax-Span-44" style="font-family: MathJax_Main; padding-left: 0.25em;">?</span></span></span><span style="display: inline-block; width: 0px; height: 2.164em;"><span style="display: inline-block; width: 0px; height: 2.164em;"></span></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.203em; vertical-align: -0.33em;"><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.203em; vertical-align: -0.33em;"></span></span></span> </nobr></span>(target_arch_abi)</p><p><p>They are very useful, especially if you want to test the specific system image in a Real-world device Environment. By default, this is "android-3-armeabi".</p></p>2.4.6 Target_platform<p><p>The name of the target Platform.</p></p>2.4.7 Target_arch_abi<p><p>The name of the CPU and the Abi.</p></p>Three ANDROID.MK file Macro 3.1 my-dir<p><p>Include $ (call My-dir)</p></p><p><p>Returns the path to the last contained makefile, which is usually the path to the directory where the current android.mk is located, defined before Android.mk Starts.</p></p>3.2 All-subdir-makefiles<p><p>Include $ (call all-subdir-makefiles)</p></p><p><p>Returns a list of locations where a android.mk file is located, along with the path of the current My-dir.</p></p><p><p>For example, the following directory:</p></p> <ul> <ul> <li>Sources/foo/android.mk</li> <li>Sources/foo/lib1/android.mk</li> <li>Sources/foo/lib2/android.mk</li> </ul> </ul><p><p>If Sources/foo/android.mk contains the following statement:</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs lasso"><span class="hljs-literal">all</span><span class="hljs-attribute">-subdir</span><span class="hljs-attribute">-makefiles</span>)</code></pre></pre><p><p>then, it will automatically include SOURCES/FOO/LIB1/ANDROID.MK and Sources/foo/lib2/android.mk. This feature can be used to provide a deep nested source code directory for the build system Hierarchy. Please note that by default, the NDK will only look for Sources/*android.mk.</p></p>3.3 This-makefile<p><p>Returns the path to the current Makefile.</p></p>3.4 Parent-makefile<p><p>Returns the containing tree of the makefile that contains the makefile current File.</p></p>3.5 Grand-parent-makefile<p><p>Returns the path to the parent makefile of the parent makefile in the call Tree.</p></p>3.6 Import-module<p><p>$ (call Import-module,)<br>Allows you to find and include the android.mk of another module by Name.<br>This will find a directory listing of the modules referenced by the NDK_MODULE_PATH environment variable and automatically include them in the Android.mk.</p></p> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p>"Android Local Development technology: compiling scripts" android.mk</p></p></span>

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.