Android makefile (Android. mk) Analysis (2)

Source: Internet
Author: User

1.2 use makefile to build a cross-compiling environment

For more information about this section, see http://blog.csdn.net/absurd/category/228434.aspx
In the cross-compilation scenario analysis, I just want to explain the steps I have taken:

1. Download the cross-compilation environment (http://www.codesourcery.com/downloads/public/gnu_toolchain/arm-none-linux-gnueabi
) And install it. Generally, unzip the package and add the bin directory to the path of the environment variable ~ /. Add a row at the bottom of bashrc: Export Path = $ path :~ /Arm-2009q1/bin.

2. In the user's home directory (Cd ~) Create a directory named cross-compile

3. Create a file cross. env in cross-compile. The content is as follows:

Export work_dir = ~ /Cross-compile
Export rootfs_dir = $ work_dir/rootfs
Export arch = arm
Export pkg_config_path = $ rootfs_dir/usr/local/lib/pkgconfig: $ rootfs_dir/usr/x11r6/lib/pkgconfig
If [! -E "$ rootfs_dir/usr/local/include"]; then mkdir-p $ rootfs_dir/usr/local/include; FI;
If [! -E "$ rootfs_dir/usr/local/lib"]; then mkdir-p $ rootfs_dir/usr/local/LIB; FI;
If [! -E "$ rootfs_dir/usr/local/etc"]; then mkdir-p $ rootfs_dir/usr/local/etc; FI;
If [! -E "$ rootfs_dir/usr/local/bin"]; then mkdir-p $ rootfs_dir/usr/local/bin; FI;
If [! -E "$ rootfs_dir/usr/local/share"]; then mkdir-p $ rootfs_dir/usr/local/share; FI;
If [! -E "$ rootfs_dir/usr/local/Man"]; then mkdir-p $ rootfs_dir/usr/local/man; FI;
If [! -E "$ rootfs_dir/usr/include"]; then mkdir-p $ rootfs_dir/usr/include; FI;
If [! -E "$ rootfs_dir/usr/lib"]; then mkdir-p $ rootfs_dir/usr/lib; FI;
If [! -E "$ rootfs_dir/usr/etc"]; then mkdir-p $ rootfs_dir/usr/etc; FI;
If [! -E "$ rootfs_dir/usr/bin"]; then mkdir-p $ rootfs_dir/usr/bin; FI;
If [! -E "$ rootfs_dir/usr/share"]; then mkdir-p $ rootfs_dir/usr/share; FI;
If [! -E "$ rootfs_dir/usr/Man"]; then mkdir-p $ rootfs_dir/usr/man; FI;

4. Enable the command line, go to the Cross-compile directory, and run. Cross. Env.

5. copy the header files and so files generated during Linux compilation to the directory corresponding to rootfs/usr under the Cross-compile directory (the header files can be copied to PCs, so files must be copied to the arm version ).

5. Download the source code to be compiled and put it in the Cross-compile directory.

6. Follow the http://blog.csdn.net/absurd/category/228434.aspx
And put the MAKEFILE file in the Cross-compile directory.

7. Execute make-F libxml2.mk on the command line (libxml2.mk is the makefile written in the previous step ).

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.