控制整个android系统编译的make文件。其内容如下:
### DO NOT EDIT THIS FILE
###
include build/core/main.mk
### DO NOT EDIT THIS FILE
###
可以看出,实际上控制编译的文件是:build/core/main.mk
²
make droid:等同于make命令。droid是默认的目标名称。
²
make all:make all将make所有make droid会编译的项目。同时,将编译LOCAL_MODULE_TAGS定义的不包括android
tag的模块。这将确保所有的在代码树里面同时有Android.mk文件的模块。
²
clean-$(LOCAL_MODULE)和clean-$(LOCAL_PACKAGE_NAME):
删除某个模块的目标文件。例如:clean-libutils将删除所有的libutils.so以及和它相关的中间文件;clean-Home将删除Home应用。
²
make
clean:删除本次配置所编译输出的结果文件。类似于:rm –rf ./out/
²
make
clobber:删除所有配置所编译输出的结果文件。类似于:rm –rf ./out/
²
make
dataclean:make dataclean
deletes contents of the data
directory inside the current combo directory. This is especially
useful on the simulator and emulator, where the persistent data
remains present between builds.
²
make
showcommands:在编译的时候显示脚本的命令,而不是显示编译的简报。用于调试脚本。
²
make LOCAL_MODULE:编译一个单独得模块(需要有Android.mk文件存在)。
²
make
targets:将输出所有拟可以编译的模块名称列表。
注:还有一些命令,从make文件里面应该可以找到。本文不做探讨。
config.mk文件的主要内容如下:
Ø
头文件的定义;(各种include文件夹的设定)
在定义头文件的部分,还include了pathmap.mk,如下:
include
$(BUILD_SYSTEM)/pathmap.mk
该文件设置include目录和frameworks/base下子目录等的信息。
Ø
编译系统内部mk文件的定义;
internal files>
Ø
设定通用的名称;
common values>
Ø
Include必要的子配置文件;
files>
n
buildspec.mk
n
envsetup.mk
n
BoardConfig.mk
n
/combo/select.mk
n
/combo/javac.mk
Ø
检查BUILD_ENV_SEQUENCE_NUMBER版本号;
In order to make easier for people
when the build system changes, when it is necessary to make changes
to buildspec.mk or to rerun the environment setup scripts, they
contain a version number in the variable BUILD_ENV_SEQUENCE_NUMBER.
If this variable does not match what the build system expects, it
fails printing an error message explaining what happened. If you
make a change that requires an update, you need to update two
places so this message will be printed.
·
In config/envsetup.make, increment
the CORRECT_BUILD_ENV_SEQUENCE_NUMBER definition.
·
In buildspec.mk.default, update the
BUILD_ENV_SEQUENCE_DUMBER definition to match the one in
config/envsetup.make
The scripts automatically get the
value from the build system, so they will trigger the warning as
well.
Ø
设置常用工具的常量;< Generic
tools.>
Ø
设置目标选项;< Set up final
options.>
Ø
遍历并设置SDK版本;