build环境配置:
可以通过设定环境变量进行配置,也可以通过修改build/buildspec.mk配置,参考build/buildspec.mk.default
CUSTOM_MODULES
可以安装的MODULES,被安装在/system
## user/userdebug ##
if TARGET_BUILD_VARIANT == user
tags_to_install = user
if TARGET_BUILD_VARIANT == userdebug
tags_to_install = user + debug and enable_target_debugging = true
## eng ##
if TARGET_BUILD_VARIANT == eng
tags_to_install = user + debug + eng
## tests ##
if TARGET_BUILD_VARIANT == tests
tags_to_install = user + debug + eng + tests
## sdk ##
Build sdk:
if MAKECMDGOALS == sdk or win_sdk or sdk_addon
is_sdk_build = true
if is_sdk_build == true
tags_to_install = user + debug + eng
# build the full stagefright library
ifneq ($(strip BUILD_WITH_FULL_STAGEFRIGHT),)
BUILD_WITH_FULL_STAGEFRIGHT := true
endif
# If we're on an eng or tests build, but not on the sdk, and we have a better one, use that instead.
apns_to_use := $(wildcard vendor/google/etc/apns-conf.xml)
PRODUCT_COPY_FILES
# For most goals, anything not tagged with the "tests" tag should be installed in /system.
# For the sdk goal, anything with the "samples" tag should be installed in /data even if that module also has "eng"/"debug"/"user".
# If they only used the modifier goals (showcommands, checkbuild), we'll actually build the default target.
# Build sdk
if MAKECMDGOALS == clean or clobber or dataclean or installclean
dont_bother = true
if dont_bother != true
# Bring in all modules that need to be built.
if HOST_OS == windows or HOST_OS-HOST_ARCH == darwin-ppc
SDK_ONLY = true
if SDK_ONLY == true
# ----- SDK for Windows ------(Cygwin)
subdirs
else
if BUILD_TINY_ANDROID == true
# TINY_ANDROID is a super-minimal build configuration, handy for board bringup and very low level debugging
else
subdirs := $(TOP)
FULL_BUILD := true
# FULL_BUILD #
if FULL_BUILD == true
Only include this during a full build, otherwise we can't be guaranteed that any policies were included.
-include frameworks/policies/base/PolicyConfig.mk
# ALL_MODULES #
# CUSTOM_MODULES #
# Use tags to get the non-APPS user modules. Use the product
# definition files to get the APPS user modules.
user_MODULES := $(sort $(call get-tagged-modules,user))
user_MODULES := $(user_MODULES) $(user_PACKAGES)
eng_MODULES := $(sort $(call get-tagged-modules,eng))
debug_MODULES := $(sort $(call get-tagged-modules,debug))
tests_MODULES := $(sort $(call get-tagged-modules,tests))
# Some packages may override others using LOCAL_OVERRIDES_PACKAGES. Filter out (do not install) any overridden packages.
# Don't include any GNU targets in the SDK. It's ok (and necessary) to build the host tools, but nothing that's going to be installed on the target (including static libraries).
# build/core/Makefile contains extra stuff that we don't want to pollute this top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES contains everything that's built during the current make, but it also furtherextends ALL_DEFAULT_INSTALLED_MODULES.
Makefile method:
prebuilt
all_copied_headers
# An internal target that depends on all copied headers (see copy_headers.make). Other targets that need the headers to be copied first can depend on this target.
files
# All the droid stuff, in directories
checkbuild
ramdisk
systemtarball
userdataimage
bootimage
droidcore
# Build files and then package it into the rom formats
dist_libraries
# dist_libraries only for putting your library into the dist directory with a full build.
apps_only
droid tests
all_modules
# phony target that include any targets in $(ALL_MODULES)
docs
sdk
findbugs
clean
clobber
# The rules for dataclean and installclean are defined in cleanbuild.mk.
modules
#xxx scrape this from ALL_MODULE_NAME_TAGS
showcommands
modules_to_install