现在的位置: 首页 > 综合 > 正文

Android 模块编译

2013年09月03日 ⁄ 综合 ⁄ 共 1296字 ⁄ 字号 评论关闭

Android是支持模块化编译的,可以单独对某一个模块:比如浏览器进行编译。

1、进入Android源码根目录,执行source build/envsetup.sh;

2、可以执行mm、mmm等模块编译命令了。如要编译audioflinger,则执行mmm frameworks/base/services/audioflinger/ -B即可。

3、make -snod重新生成system.img映像。

 

将envsetup.sh的一些注释摘下来如下:

Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- croot:   Changes directory to the top of the tree.
- m:       Makes from the top of the tree.
- mm:      Builds all of the modules in the current directory.
- mmm:     Builds all of the modules in the supplied directories.
- cgrep:   Greps on all local C/C++ files.
- jgrep:   Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir:   Go to the directory containing a file.

Android 源码编译 make命令

Makefile  

在符合GNU Makefiel惯例的Makefile中,包含了一些基本的预先定义的操作:

make

根据Makefile编译源代码,连接,生成目标文件,可执行文件。

make clean

 清除上次的make命令所产生的object文件(后缀为“.o”的文件)及可执行文件,仅仅是清除之前编译的可执行文件及配置文件。 

make distclean 要清除所有生成的文件,包括configure生成的文件,如Makefile文件。

make install

将编译成功的可执行文件安装到系统目录中,一般为/usr/local/bin目录。

make dist

产生发布软件包文件(即distributionpackage)。这个命令将会将可执行文件及相关文件打包成一个tar.gz压缩的文件用来作为发布软件的软件包。

它会在当前目录下生成一个名字类似“PACKAGE-VERSION.tar.gz”的文件。PACKAGE和VERSION,是我们在configure.in中定义的AM_INIT_AUTOMAKE(PACKAGE,VERSION)。

make distcheck

生成发布软件包并对其进行测试检查,以确定发布包的正确性。这个操作将自动把压缩包文件解开,然后执行configure命令,并且执行make,来确认编译不出现错误,最后提示你软件包已经准备好,可以发布了。

make distclean类似make clean,但同时也将configure生成的文件全部删除掉,包括Makefile。 

抱歉!评论已关闭.