Android编译,模块的编译和CLEAN

来源:互联网 发布:物流软件的基本功能 编辑:程序博客网 时间:2024/05/20 00:15

在Android源代码目录下的build目录下,有个脚本文件envsetup.sh;
$ . build/envsetup.sh
注:该命令的前面的逗点(.),相当于source
执行这个脚本文件后,就可以获得一些有用的工具:
- 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.
我们只关注mmm命令,也就是可以用它来编译指定的模块。
$ mmm hardware/libhardware/modules/slmo/
详见:http://blog.csdn.net/luoshengyang/article/details/6566662


对三星SDMK4x12来说,上述方法编译报错,需要选择菜单后再编:
$ source build/envsetup.sh
$ lunch
(弹出选项菜单)
$ 7 (选择full_smdk4x12-eng)
然后,可以使用mmm编译单独的模块了。

使用lunch-7选择过菜单项之前,使用命令:
$ echo $TARGET_PRODUCT
查询不到TARGET_PRODUCT的值,而设置后就可以了:
$ echo $TARGET_PRODUCT
full_smdk4x12
(目标产品)
除了TARGET_PRODUCT外,还设置了如下两个值:
$ echo $TARGET_BUILD_VARIANT
eng
(工程测试版本)
$ echo $TARGET_BUILD_TYPE
release
(发布版本)

然后,就可以使用如下命令,进行打包system.img了:
$ make snod (snod: System NO Dependent)

如果要清理该模块,可以使用如下的命令:
$ make clean-SlmoTestApp (clean-模块名)

如果要清理所有,可以使用如下的命令:
$ make clean
该命令,会删除整个out文件夹!

原创粉丝点击