# 如果定义了ANDROID_BUILD_SHELL,则ANDROID_BUILD_SHELL# 否则使用默认的/bin/bashifdef ANDROID_BUILD_SHELLSHELL := $(ANDROID_BUILD_SHELL)elseSHELL := /bin/bashendif# Utility variables.empty :=space := $(empty) $(empty)comma := ,# Note that make will eat the newline just before endef.define newlineendef# 不能简单的定义\或\\backslash := \abackslash := $(patsubst %a,%,$(backslash))# python有关export PYTHONDONTWRITEBYTECODE := 1# 标准源目录SRC_DOCS:= $(TOPDIR)docs# TODO: 强制一些层,当模块连接针对特定库时仅仅添加一些头文件路径# TODO: 查看可以从这些全局列表删除的。SRC_HEADERS := \ $(TOPDIR)system/core/include \ $(TOPDIR)hardware/libhardware/include \ $(TOPDIR)hardware/libhardware_legacy/include \ $(TOPDIR)hardware/ril/include \ $(TOPDIR)libnativehelper/include \ $(TOPDIR)frameworks/native/include \ $(TOPDIR)frameworks/native/opengl/include \ $(TOPDIR)frameworks/av/include \ $(TOPDIR)frameworks/base/includeSRC_HOST_HEADERS:=$(TOPDIR)tools/includeSRC_LIBRARIES:= $(TOPDIR)libsSRC_SERVERS:= $(TOPDIR)serversSRC_TARGET_DIR := $(TOPDIR)build/targetSRC_API_DIR := $(TOPDIR)prebuilts/sdk/apiSRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api# 特定工具的路径SRC_DROIDDOC_DIR := $(TOPDIR)build/tools/droiddoc# 避免硬件解码路径被覆盖的调用pathmap.mk建立硬解映射include $(BUILD_SYSTEM)/pathmap.mk# 构建系统内部文件(写Android.mk时会调用include头文件,也就是这些makefile文件)CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mkBUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mkBUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mkBUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mkBUILD_RAW_STATIC_LIBRARY := $(BUILD_SYSTEM)/raw_static_library.mkBUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mkBUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mkBUILD_RAW_EXECUTABLE:= $(BUILD_SYSTEM)/raw_executable.mkBUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mkBUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mkBUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mkBUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mkBUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mkBUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mkBUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mkBUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mkBUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mkBUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mkBUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mkBUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mkBUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mkBUILD_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/shared_test_lib.mkBUILD_HOST_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/host_shared_test_lib.mkBUILD_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/static_test_lib.mkBUILD_HOST_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/host_static_test_lib.mkBUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mkBUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mkBUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk-include cts/build/config.mk# 解析目标修饰符,make目标包含showcommands,则打印全命令SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS))# 设置通用值# 全局变量、cflagsCOMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arithCOMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUGCOMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promoCOMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS)# 不同包使用的扩展名COMMON_PACKAGE_SUFFIX := .zipCOMMON_JAVA_PACKAGE_SUFFIX := .jarCOMMON_ANDROID_PACKAGE_SUFFIX := .apk# flag列表改变错误中的不同警告TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point# 符号压缩TARGET_COMPRESS_MODULE_SYMBOLS := false# 包含底层配置文件# -include:不是必须包含的# 包含 buildspec.mk 可以设置一些东西。# 如果文件不存在,则环境变量不会使用。如果不工作,则认为是arm buildifndef ANDROID_BUILDSPECANDROID_BUILDSPEC := $(TOPDIR)buildspec.mkendif-include $(ANDROID_BUILDSPEC)# 包含一些环境设置include $(BUILD_SYSTEM)/envsetup.mk