Android compilation system-continued

Source: Internet
Author: User

 

The last translation of the official Android compilation system manual (http://blog.csdn.net/a345017062/archive/2010/12/24/6096795.aspx), the original is relatively simple, after the original translation, the actual use of a more in-depth understanding, Here detailed record, what to remember.

 

Local_module_tags

It may have four values: User, Eng, tests, and optional. This value determines the mode in which the module will be compiled.

When compiling a module (whether C/C ++ or Java), if you want it to be compiled only in one of the three modes of user/eng/tests, take one of the three values. If you want it to be compiled in any mode, set its value to optional.

If optional is used, you need to add the module name in/build/target/product/CORE. mk.

 

Local_c_inludes

Add a search directory to the header file in include. In this way, you only need to specify the file name in include. For example, the skcanvas referenced in flyingsurface. cpp

 

Local_prelink_module

Whether the dynamic library is prelink. If you compile an android SDK without the. So library, you must add this attribute. For a detailed explanation of this attribute, let's take a look at this document. It should be clear soon.

For more detailed mechanisms on prelink, refer to this document http://www.eefocus.com/article/09-04/71629s.html

 

Supplement: 2011.5.26

Here is an article that compares cflags, ldflags, and cppflags and provides optimization suggestions:

 

Http://blog.csdn.net/eroswang/archive/2007/12/25/1966640.aspx

 

Supplement: 2011.5.27

 

 

When working on android2.3.1, we found that local_module_tags had changed.

You can also use one of the four modules in the old version of the system: User, Eng, tests, and optional. However, only one of the five modules in the new version can be optional, debug, tests, Eng, and samples.

 

 

Supplemented by 2011.6.9

 

 

Local_system_shared_libraries

If this option is not provided during compilation, some libraries will be linked by default during system compilation, generally libc libstdc ++ libm, see the value of the default_system_shared_libraries variable in/build/CORE/Combo/TARGET_linux-x86.mk.

If this option is provided during compilation and the value is not none or empty, the system will not link the default libraries during compilation. For example, when compiling libc itself. For more information about this logic, see/build/CORE/binary. mk.

 

 

 

Link the compiled third-party library,

Local_prebuilt_libs: = LIBA. So libb. So

Include $ (build_multi_prebuilt)

Put LIBA. So and libb. So in the same directory as Android. mk. during compilation, they will be installed in the/system/lib directory.

Refer to here:

How to add a third-party dynamic link library file to Android Compilation

Http://zhuwenhao.com/824/%E6%8A%80%E6%9C%AF/%E8%87%AA%E7%94%B1%E8%BD%AF%E4%BB%B6%E7%A4%BE%E5%8C%BA/android/android%E7%BC%96%E8%AF%91%E5%8A%A0%E5%85%A5%E7%AC%AC%E4%B8%89%E6%96%B9%E5%8A%A8%E6%80%81%E9%93%BE%E6%8E%A5%E5%BA%93%E6%96%87%E4%BB%B6%E7%9A%84%E6%96%B9%E6%B3%95/

 

Supplemented by 2011.6.21:

 

Local_cflags

-D to add a global macro definition.

Local_cflags: =-duse_jsc

It is equivalent to adding

# Define use_jsc

Local_cflags: =-duse_copy_bit = 1

It is equivalent to adding

# Define use_copy_bit 1

 

Others, such as-W, are passed for compilation.

 

Supplement:

Some common problems encountered during ndk Compilation

Q:
Android ndk: Host 'awk' tool is outdated. Please define host_awk to point to gawk or nawk!
A:
The main reason is that the/android-ndk-r7/prebuilt/linux-x86/bin/awk under the ndk directory is a 64-bit version. Here we can copy the awk in a 32-bit System (My Ubuntu is gawk) to/android-ndk-r7/prebuilt/linux-x86/bin/directory under
Reference URL:

Http://stackoverflow.com/questions/8116113/problems-with-android-ndk-7-and-awk

Q:
Android ndk: cocould not find application project directory!
Android ndk: Please define the ndk_project_path variable to point to it.
A:
The source code and Android. mk are not stored in the JNI directory.

Q:
Use the wildcard function in local_src_files
A:
My_files: = $ (wildcard $ (local_path)/Foo/*. c)
My_files: = $ (my_files: $ (local_path)/% = %)
Local_src_files + = $ (my_files)
Reference URL:

Http://www.meegozu.com/thread-1818-1-1.html

Print the compilation process
Ndk-Build-n

Use your own library
Local_shared_libraries and local_static_libraries
Use the library in the system
Add-L and-l to local_ldlibs.

Local_cflags is only used for. C, while local_cppflags is used for. C and. cpp.

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.