导入单独编译模块的mmm命令
参考链接:https://book.51cto.com/art/201601/503373.htm?pc
1.6 单独编译和打包Android应用程序模块
下载好Android源代码之后,我们在源代码根目录中执行make命令来对它进行编译。经过漫长的等待之后,最终就得到Android系统镜像文件system.img。如果以后修改了Android源代码工程中的某个模块或者在Android源代码工程中新增了一个模块,是否还需要执行make命令呢?
答案是否定的,Android源代码工程提供了一个mmm命令来单独编译某一个模块,并提供了一个make snod命令来纯粹执行打包Android系统镜像文件system.img的操作。这样我们就可以只编译Android源代码目录中发生过修改的模块,提高编译速度。接下来,我们就介绍mmm和make snod两个命令的使用方法。
1.6.1 导入单独编译模块的mmm命令
在默认情况下,在Android源代码工程环境中,mmm命令是不可用的。我们需要在当前终端中执行Android源代码目录下的build/envsetup.sh脚本文件,然后才可以使用mmm命令。
- USER@MACHINE:~/Android$ source ./build/envsetup.sh
执行完成这个命令之后,除了获得单独编译某个模块的mmm命令之外,还有其他一些命令可以使用,如下所示。
- - 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.
我们可以通过指定-help选项来运行这些命令,以便可以查看它们的具体使用方法。例如,执行下面的命令就可以看到mmm命令的用法。
- USER@MACHINE:~/Android$ mmm -help
- Usage: make [options] [target] ...
- Options:
- . . . . . .
mmm命令的用法比较丰富,但是一般情况下,我们只要在该命令后面加上要编译的模块所在的目录就可以了。