Android.mk 参数函数查询
2015-06-11 16:04
489 查看
查询地址:http://android.cloudchou.com/build/core/base_rules.php#LOCAL_INSTALLED_MODULE
目标类型:主机上的可执行程序,设备上的可执行程序,apk程序,Java运行库,动态链接库等等
Android编译系统里每一种目标的生成方式对应一个makefile,
示例:如果某个模块需要编译成手机上的二进制程序,它需要include $(BUILD_EXECUTABLE)
而BUILD_EXECUTABLE指向的是$(BUILD_SYSTEM)/executable.mk
所有生成方式对应的makefile都将包含base_rules.mk
LOCAL_MODULE将在每个模块的makefile里定义,如果未定义,编译系统会报错
注意现在模块现在不能使用user作为模块的Tag,
以前如果使用user做为tag,那么这个模块将被自动安装,
如果想定义自动安装的模块,需要在PRODUCT_PACKAGES变量里添加该模块,
该变量在build/target/product/base.mk和build/target/product/core.mk里有赋值,这是所有产品都将继承的基础配置
另外每个设备可在自己的产品配置文件device_*.mk里设置该变量,添加更多的模块
如果当前目录或者父目录有*_GPL*的文件,那么将自动添加gnu的tag
LOCAL_MODULE_CLASS在定义目标生成方式的makefile文件里定义,
比如executable.mk里定义LOCAL_MODULE_CLASS := EXECUTABLES
在recovery模块的Android.mk里定义的LOCAL_MODULE_CLASS有:
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES
其它的LOCAL_MODULE_CLASS有
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_CLASS := FAKE
LOCAL_MODULE_CLASS := J***A_LIBRARIES
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_CLASS := APPS
对应 Cyanogenmod/target/product/m7ul/obj 的目录
比如说若 LOCAL_MODULE_CLASS := ETC
那么该模块编译的中间文件将存放于
Cyanogenmod/target/product/m7ul/obj/ETC
否则如果是安装到系统的模块,那么partition_tag将为空(test模块生成的目标只安装至data目录)
否则partition_tag:=_DATA
recovery模块的Android.mk里有
LOCAL_MODULE := nandroid-md5.sh
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
说明:nandroid-md5.sh 将存放于out/Cyanogenmod/target/product/m7ul/recovery/root/sbin
如果模块的Android.mk里未定义LOCAL_MODULE_PATH
那么LOCAL_MODULE_PATH := $($(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS))
在recovery模块里recovery可执行文件相关变量如下:
比如my_prefix为TARGET_,partition_tag为空,LOCAL_MODULE_CLASS为EXECUTABLES
那么LOCAL_MODULE_PATH为$(TARGET_OUT_EXECUTABLES),
值应该为
out/Cyanogenmod/target/product/m7ul/system/bin
module_id := MODULE.$(if \
$(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(LOCAL_MODULE)
如果$(module_id)已经定义过,那会提示用户出错
recovery模块的Android.mk里针对recovery可执行文件:
module_id := MODULE.TARGET.EXECUTABLES.RECOVERY
$(MODULE.TARGET.EXECUTABLES.RECOVERY)=$(LOCAL_PATH)
即当前模块路径
例: recovery模块Android.mk里编译Recovery可执行文件:
out/target/product/find5/obj/EXECUTABLES/recovery_intermediates
例: recovery模块Android.mk里编译Recovery可执行文件:
out/target/common/obj/EXECUTABLES/recovery_intermediates
LOCAL_MODULE_STEM := $(strip $(LOCAL_MODULE_STEM))
ifeq ($(LOCAL_MODULE_STEM),)
LOCAL_MODULE_STEM := $(LOCAL_MODULE)
endif
例:
recovery模块编译recovery可执行文件:
LOCAL_MODULE_STEM:=recovery
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX)
例:
recovery模块编译recovery可执行文件:
LOCAL_INSTALLED_MODULE_STEM:=recovery
LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
ifeq ($(LOCAL_BUILT_MODULE_STEM),)
LOCAL_BUILT_MODULE_STEM := $(LOCAL_INSTALLED_MODULE_STEM)
endif
例:
recovery模块编译recovery可执行文件:
LOCAL_INSTALLED_MODULE_STEM:=recovery
OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
ifdef OVERRIDE_BUILT_MODULE_PATH
ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
endif
built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
else
built_module_path := $(intermediates)
endif
LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
比如recovery:
LOCAL_BUILT_MODULE 路径;
out/Cyanogenmod/target/product/m7ul/obj/EXECUTABLES/recovery_intermediates/recovery
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
endif
示例:
out/Cyanogenmod/target/product/m7ul/system/bin/recovery
LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
LOCAL_INTERMEDIATE_TARGETS += $(proto_java_sources_file_stamp)
aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
如果想编译aidl,只需将aidl加入LOCAL_SRC_FILES即可,
frameworks/base/Android.mk里有将aidl文件加入LOCAL_SRC_FILES变量
LOCAL_SRC_FILES += \
core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl \
core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl \
core/java/android/accounts/IAccountManager.aidl \
core/java/android/accounts/IAccountManagerResponse.aidl \
core/java/android/accounts/IAccountAuthenticator.aidl \
如果没有定义 TARGET_BUILD_APPS 变量,说明要编译framework.jar,那么将
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_J***A_SRC_DIRS)
在base_rules里定义了如何将aidl文件编译成java文件的方式,包括文件依赖
frameworks/base/Android.mk里有将logtas文件加入LOCAL_SRC_FILES变量
LOCAL_SRC_FILES += \
core/java/android/content/EventLogTags.logtags \
core/java/android/speech/tts/EventLogTags.logtags \
core/java/android/webkit/EventLogTags.logtags \
在base_rules里定义了如何将logtag文件编译成java文件的方式,包括文件依赖
logtags文件最终会被logcat程序使用到
在definitions里定义了all-proto-files-under方法添加所有proto文件
在./hardware/ril/mock-ril/Android.mk里有调用该方法
在base_rules里定义了如何将.proto文件编译成java文件的方式,包括文件依赖
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
例:out/target/common/obj/EXECUTABLES/recovery_intermediates/src
Compile .java files to .class
示例:
inputmethods/LatinIME/tools/maketext/Android.mk:20:LOCAL_JAR_MANIFEST := etc/manifest.txt
inputmethods/LatinIME/tools/dicttool/Android.mk:29:LOCAL_JAR_MANIFEST := etc/manifest.txt
如果在编译时用mka clean-recovery,将清除编译recovery时产生的文件,
包括编译中间文件和编译目标文件
ifndef LOCAL_CHECKED_MODULE
ifndef LOCAL_SDK_VERSION
LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE)
endif
endif
ifdef LOCAL_DONT_CHECK_MODULE
LOCAL_CHECKED_MODULE :=
endif
ALL_MODULES += $(LOCAL_MODULE)
这样可以得到所有模块的所有CLASS
ALL_MODULES.$(LOCAL_MODULE).CLASS := \
$(ALL_MODULES.$(LOCAL_MODULE).CLASS) $(LOCAL_MODULE_CLASS)
示例:
ALL_MODULES.recovery.CLASS = EXECECUTABLE
一个模块可能既编译为手机上的可执行程序,又编译为电脑上的可执行程序
故此ALL_MODULES.recovery.CLASS 可能由多个CLASS组合
ALL_MODULES.$(LOCAL_MODULE).PATH := \
$(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH)
示例:
ALL_MODULES.recovery.PATH bootable/recovery
ALL_MODULES.$(LOCAL_MODULE).TAGS := \
$(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS)
示例:
ALL_MODULES.recovery.TAGS eng
ALL_MODULES.$(LOCAL_MODULE).CHECKED := \
$(ALL_MODULES.$(LOCAL_MODULE).CHECKED) $(LOCAL_CHECKED_MODULE)
示例:
ALL_MODULES.recovery.CHECKED
out/Cyanogenmod/target/product/m7ul/obj/EXECUTABLES/recovery_intermediates/recovery
ALL_MODULES.$(LOCAL_MODULE).BUILT := \
$(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
示例:
out/Cyanogenmod/target/product/m7ul/obj/EXECUTABLES/recovery_intermediates/recovery
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
$(strip $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE))
示例:
out/Cyanogenmod/target/product/m7ul/system/bin/recovery
ALL_MODULES.$(LOCAL_MODULE).REQUIRED := \
$(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES)
binary.mk:
LOCAL_REQUIRED_MODULES += $(installed_shared_library_module_names)
ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \
$(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags)
event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \
$(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
ALL_MODULES.$(LOCAL_MODULE).MAKEFILE := \
$(ALL_MODULES.$(LOCAL_MODULE).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
举例:
bootable/recovery/Android.mk
ifdef LOCAL_MODULE_OWNER
ALL_MODULES.$(LOCAL_MODULE).OWNER := \
$(sort $(ALL_MODULES.$(LOCAL_MODULE).OWNER) $(LOCAL_MODULE_OWNER))
endif
三星glaxsy2有定义LOCAL_MODULE_OWNER变量
./vendor/samsung/galaxys2-common/proprietary/Android.mk:21:LOCAL_MODULE_OWNER := samsung
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE)
例子:
INSTALLABLE_FILES.out/Cyanogenmod/target/product/m7ul/system/bin/recovery.MODULE:=recovery
ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(LOCAL_MODULE_TAGS))
例:
ALL_MODULE_TAGS debug eng tests optional samples shell_ash shell_mksh
$(foreach tag,$(LOCAL_MODULE_TAGS),\
$(eval ALL_MODULE_TAGS.$(tag) := \
$(ALL_MODULE_TAGS.$(tag)) \
$(LOCAL_INSTALLED_MODULE)))
$(foreach tag,$(LOCAL_MODULE_TAGS),\
$(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE)))
还定义了很多命令用来编译各种各样的目标,
其它地方用来构建最终目标,build/core/main.mk,build/core/Makefile将用到这些变量
ALL_DOCS的赋值在droiddoc.mk里:
ALL_DOCS += $(full_target)
full_target := $(call doc-timestamp-for,$(LOCAL_MODULE))
ALL_DOCS示例:out/target/common/docs/api-stubs-timestamp out/target/common/docs/hidden-timestamp
如果某个模块要编译出文档,需要使用命令
include $(BUILD_DROIDDOC)
而BUILD_DROID_DOC变量的值是droiddoc.mk
编译系统还为每一个模块还定义了其它两个变量
ALL_MODULES.$(LOCAL_MODULE).BUILT 所有模块的生成路径
ALL_MODULES.$(LOCAL_MODULE).INSTALLED 所有模块的各自安装路径
例如:手机中将安装在system/bin/recovery,那么ALL_MODULES.recovery.INSTALLED为out/target/product/find5/system/bin/recovery
每个模块都会定义该模块生成的目标类型,可能生成二进制文件,也可能生成java静态库
这是由这个模块include $(BUILD_)决定的
比如build type若是EXCECUTABLE,,那么将include $(BUILD_EXECUTABLE),那么将include build/core/executable.mk
而该makefile对应生成的目标类型是在手机上的可执行程序
executable.mk里包含了binary.mk,而binary.mk包含了base_rules.mk
base_rules.mk里为变量ALL_MODULES,ALL_MODULES.$(target).BUILT,ALL_MODULES.$(target).INSTALLED赋值
代码:
ALL_MODULES += $(LOCAL_MODULE)
ALL_MODULES.$(LOCAL_MODULE).BUILT := \
$(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
$(strip $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE))
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
endif
LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
ifeq ($(LOCAL_MODULE_PATH),)
LOCAL_MODULE_PATH := $($(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS))
ifeq ($(strip $(LOCAL_MODULE_PATH)),)
$(error $(LOCAL_PATH): unhandled LOCAL_MODULE_CLASS "$(LOCAL_MODULE_CLASS)")
endif
endif
LOCAL_MODULE_PATH:表示要安装的位置,可由编译系统推算,也可由某个模块显示指定
示例:
ALL_MODULES:recvery applypatch applypatch_static imgdiff
对应的
$(built_module_path) : out/target/product/find5/obj/EXECUTABLES/recovery_intermediates
$(LOCAL_BUILT_MODULE_STEM) : recovery
$(LOCAL_MODULE_PATH): out/target/product/find5/system/bin
$(LOCAL_INSTALLED_MODULE_STEM): recovery
$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS):TARGET_OUT_EXECUTABLES
$(ALL_MODULES.recovery.BUILT) :out/target/product/find5/obj/EXECUTABLES/recovery_intermediates/recovery
$(ALL_MODULES.recovery.INSTALLED):out/target/product/find5/system/bin/recovery
Full paths to targets that should be added to the "make droid" set of installed targets.
droid目标将安装的所有模块的集合
每一个tag对应一个ALL_MODULE_TAGS.变量
例:
在recovery的Android.mk里定义了;
LOCAL_MODULE := recovery
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE := nandroid-md5.sh
LOCAL_MODULE_TAGS := optional
那么:ALL_MODULE_TAGS 将包含 eng,optional,
ALL_MODULE_TAGS.eng:out/target/product/find5/system/bin/recovery
ALL_MODULE_TAGS.optional: out/target/product/find5/recovery/root/sbin/nandroid-md5.sh
例:
包含bootable/recovery/Android.mk后,
ALL_MODULE_NAME_TAGS.eng: recovery libbmlutils libdedupe utility_dedupe libcrecovery libmmcutils updater libapplypatch applypatch_static su.recovery
ALL_MODULE_NAME_TAGS.optional: nandroid-md5.sh killrecovery.sh dedupe libflashutils flash_image dump_image erase_image libflash_image libdump_image liberase_image
utility_dump_image utility_flash_image utility_erase_image libminui libminelf libminzip libminadbd libmtdutils edify libedify applypatch
imgdiff parted sdparted libminizip libmake_ext4fs install-su.sh run-su-daemon.sh
例:
包含bootable/recovery/Android.mk后,
ALL_HOST_INSTALLED_FILES: /home/cloud/android/Cyanogenmod/out/host/linux-x86/bin/dedupe
/home/cloud/android/Cyanogenmod/out/host/linux-x86/bin/edify
/home/cloud/android/Cyanogenmod/out/host/linux-x86/bin/imgdiff
Full paths to all prebuilt files that will be copied (used to make the dependency on acp)
在system/core/Android.mk里大量使用了ALL_PREBUILT
ALL_PREBUILT += $(file)
ALL_PREBUILT += $(DIRS)
示例:
ALL_PREBUILT: out/target/product/find5/system/etc/dbus.conf out/target/product/find5/system/etc/hosts out/target/product/find5/system/etc/init.goldfish.sh
Full path to all files that are made by some tool
./build/core/binary.mk:273:ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES)
./bionic/libc/Android.mk:735:ALL_GENERATED_SOURCES += $(GEN)
例:
ALL_GENERATED_SOURCES: out/target/product/find5/obj/SHARED_LIBRARIES/libRS_intermediates/rsgApiStructs.h
out/target/product/find5/obj/SHARED_LIBRARIES/libRS_intermediates/rsgApiFuncDecl.h
out/target/product/find5/obj/SHARED_LIBRARIES/libbt-vendor_intermediates/vnd_buildcfg.h
这些都对拷贝的头文件有一个按序的依赖关系
The list of dynamic binaries that haven't been stripped/compressed/etc
dynamic_binary.mk: ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
例:
ALL_ORIGINAL_DYNAMIC_BINARIES:out/target/product/find5/obj/EXECUTABLES/vold_intermediates/LINKED/vold
out/target/product/find5/obj/SHARED_LIBRARIES/libkeystore_intermediates/LINKED/libkeystore.so
These files go into the SDK
主要赋值:development/build/Android.mk
Files for dalvik. This is often build without building the rest of the OS
在dalvik/dx/src/Android.mk dalvik/dx/Android.mk中有赋值
build/core/java.mk:400:ALL_FINDBUGS_FILES += $(findbugs_xml)
All findbugs xml files
GPL 模块的 许可文件
在build/core/base_rules.mk里有赋值
gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL*)
ifneq ($(gpl_license_file),)
LOCAL_MODULE_TAGS += gnu
ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file))
endif
ANDROID_RESOURCE_GENERATED_CLASSES := 'R.class' 'R$$*.class' 'Manifest.class' 'Manifest$$*.class'
在build/core/static_java_library.mk中有用到,用于排除某些文件,使其不被打包至lib文件
用于打印变量的值
$(1): variable name list, not variable values
$(1) 要测试的变量
$(1):需要提取Android.mk的目录
$(1):要搜索的目录
$(1): List of directories to look for under this directory
$(1) 指定子目录
使用范例:SRC_FILES := $(call all-java-files-under,src tests)
使用范例: SRC_FILES := $(call all-subdir-java-files)
Find all of the c files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-c-files-under,src tests)
$1: 指定子目录名称
Find all of the c files from here. Meant to be used like:
SRC_FILES := $(call all-subdir-c-files)
Find all files named "I*.aidl" under the named directories,
which must be relative to $(LOCAL_PATH). The returned list
is relative to $(LOCAL_PATH).
$1: 指定子目录名称
Find all of the "I*.aidl" files under $(LOCAL_PATH).
Find all of the logtags files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-logtags-files-under,src)
查找.logtag文件
$1:指定子目录名称
Find all of the .proto files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-proto-files-under,src)
查找.proto文件
$1:指定子目录名称
Find all of the RenderScript files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-renderscript-files-under,src)
查找.rs .fs文件
$1:指定子目录名称
Find all of the html files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-html-files-under,src tests)
查找.html文件
$1:指定子目录名称
Find all of the html files from here. Meant to be used like:
SRC_FILES := $(call all-subdir-html-files)
Find all of the files matching pattern
SRC_FILES := $(call find-subdir-files, )
$1 find命令的匹配规则
find the files in the subdirectory $1 of LOCAL_DIR
matching pattern $2, filtering out files $3
e.g.
SRC_FILES += $(call find-subdir-subdir-files, \
css, *.cpp, DontWantThis.cpp)
$1 LOCAL_DIR的子目录
$2 find命令的匹配规则
$3 过滤的文件
SRC_FILES := $(call find-subdir-assets)
$1 要进入并查找的目录
$1 find命令的匹配规则
$1 find命令的匹配规则
Scan through each directory of $(1) looking for files
that match $(2) using $(wildcard). Useful for seeing if
a given directory or one of its parents contains
a particular file. Returns the first match found,
starting furthest from the root.
$1 要查找的目录集合
$2 要查找的文件
Function we can evaluate to introduce a dynamic dependency
$1 需要依赖其它东东的目标
$2 被依赖的东东
$(call add-prebuilt-file, srcfile, [targetclass])
$(1): srcfile
$(2): target class
$(calltargetclass,files...)
$(1)targetclass
$(2)srcfiles
使用举例:
gdbserver/Android.mk:$(calladd-prebuilt-files,EXECUTABLES,$(prebuilt_files))
The intermediates directory. Where object files go for
a given target. We could technically get away without
the "_intermediates" suffix on the directory, but it's
nice to be able to grep for that string to find out if
anyone's abusing the system.
# $(1): target class, like "APPS"
# $(2): target name, like "NotePad"
# $(3): if non-empty, this is a HOST target.
# $(4): if non-empty, force the intermediates to be COMMON 如果是host的common,则是out/host/common,如果是target的common,则是out/target/common
使用举例:
./development/build/Android.mk framework_res_package := $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
./frameworks/base/core/res/Android.mk:37:framework_GENERATED_SOURCE_DIR := $(call intermediates-dir-for,J***A_LIBRARIES,framework,,COMMON)/src
值: out/target/product/find5/obj/STATIC_LIBRARIES/libstdc++_intermediates
out/target/common/obj/J***A_LIBRARIES/core_intermediates
out/target/common/obj/APPS/framework-res_intermediates
out/target/common/obj/J***A_LIBRARIES/framework_intermediates
$(1): if non-empty, force the intermediates to be COMMON
例: LOCAL_MODULE_CLASS:EXECUTABLES
LOCAL_MODULE: recovery
LOCAL_IS_HOST_MODULE empty
$1 为空
那么返回out/target/product/find5/obj/EXECUTABLES/recovery_intermediates
Convert "path/to/libXXX.so" to "-lXXX".
Any "path/to/libXXX.a" elements pass through unchanged.
Convert a list of short module names (e.g., "framework", "Browser")
into the list of files that are built for those modules.
NOTE: this won't return reliable results until after all
sub-makefiles have been included.
$(1): target list
Convert a list of short modules names (e.g., "framework", "Browser")
into the list of files that are installed for those modules.
NOTE: this won't return reliable results until after all
sub-makefiles have been included.
$(1): target list
Convert a list of short modules names (e.g., "framework", "Browser")
into the list of files that should be used when linking
against that module as a public API.
TODO: Allow this for more than J***A_LIBRARIES modules
NOTE: this won't return reliable results until after all
sub-makefiles have been included.
$(1): target list
define module-stubs-files
$(foreach module,$(1),$(ALL_MODULES.$(module).STUBS))
endef
Evaluates to the timestamp file for a doc module, which
is the dependency that should be used.
$(1): doc module
out/target/common/J***A_LIBRARIES/libname_indeterminates/classes.jar
out/host/common/J***A_LIBRARIES/libname_indeterminates/classes.jar
$(1): library name list
$(2): Non-empty if IS_HOST_MODULE
$(1): library name list
$(2): Non-empty if IS_HOST_MODULE
$(1): the string. Must be one line.
the empty string if they are not equal.
This has the same behavior as the built-in function
$(word n,str).
The individual words may not contain spaces.
将用":"分隔的字符串转化为词数组
$(1): 1 based index
$(2): value of the form a:b:c...
$(1): list to collapse
$(2): if set, separator word; usually "=", ":", or ":="
Defaults to "=" if not set.
first components, keep only the first pair.
$(1): list of pairs
$(2): the separator word, such as ":", "=", etc.
first components, keep only the first pair.
$(1): list of pairs
$(2): the separator word, such as ":", "=", etc.
ALL_MODULE_TAGS.eng:out/target/product/find5/system/bin/recovery
any of those tags.
$(1): tag list
ALL_MODULE_NAME_TAGS.eng: recovery libbmlutils libdedupe utility_dedupe libcrecovery libmmcutils updater libapplypatch applypatch_static su.recovery
any of them are rejected, the target is rejected.
Reject overrides accept.
$(1): list of tags to accept
$(2): list of tags to reject
base paths ending in /.
$(1): base path
$(2): leaf path
#Givenalistofinstalledmodules(shortorlongnames)
#returnalistofthepackages(yes,.apkpackages,not
#modulesingeneral)thatareoverriddenbythislistand,
#therefore,shouldnotbeinstalled.
#$(1):mixedlistofinstalledmodules
#TODO:Thisisfragile;findareliablewaytogetthisinformation.
如果编译时传递了添加了showcommands参数,调用pretty会打印正在执行的命令
如果没有传递showcommand参数,则不会打印正在执行的命令
打印编译时的一些参数
主要是一些PRIVATE变量,例如PRIVATE_YACCFLAGS
$(1):theinput.dfile
$(2):theoutput.Pfile
举例:
ifneq ($(strip $(lex_cpps)),)
$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.l
$(transform-l-to-cpp)
Because the extension of c++ files can change, the
extension must be specified in $1.
E.g, "$(call transform-y-to-cpp,.cpp)"
# $(1): extra flags
# $(1): extra flags
$(1): extra flags
# $(1): extra flags 编译参数
$(1): extra flags,编译参数
This should never happen for target builds but this
will error at build time.
$(1): extra flags,编译参数
编译cpp文件,目标代码将在主机上运行
$(1): extra flags
编译c代码或者汇编代码,目标代码将在主机上运行,无依赖的编译
$(1): extra flags
编译c代码,目标代码将在主机上运行,无依赖的编译
$(1): extra flags
$(1): extra flags
$(1): extra flags
$(1): extra flags
编译object c代码,目标代码将在主机上运行,无依赖编译
$(1): extra flags
编译object c代码,目标代码将在主机上运行,
$(1): extra flags
Call the command at least once even if there are no arguments, as otherwise
the output file won't be created.
$(1): the command without arguments
$(2): the arguments
try to add to an existing archive.
将目标代码打包成静态库
$(1): the full path of the source static library.
静态库将在主机上运行
静态库将在主机上运行
ld just seems to be so finicky with command order that we allow
it to be overriden en-masse see combo/linux-arm.make for an example.
将目标代码打包成在主机上运行的动态库或者包
ld just seems to be so finicky with command order that we allow
it to be overriden en-masse see combo/linux-arm.make for an example.
将目标代码打包成在目标机上运行的动态库
编译成可执行文件
executable.Inpractice,weonlyusethisonarm,so
theotherplatformsdon'thavethe
transform-o-to-static-executabledefined
@echo"Sourceintermediatesdir:$(PRIVATE_SOURCE_INTERMEDIATES_DIR)"
@echo"Sourceintermediates:$$(find$(PRIVATE_SOURCE_INTERMEDIATES_DIR)-name'*.java')"
ThisrulecreatestheR.javaandManifest.javafiles,bothofwhich
arePRODUCT-neutral.Don'tpassPRIVATE_PRODUCT_AAPT_CONFIGtothisinvocation.
but make sure that no META-INF files come along for the ride.
$(1): files to unzip
$(2): destination directory
Some historical notes:
- below we write the list of java files to java-source-list to avoid argument
list length problems with Cygwin
- we filter out duplicate java file names because eclipse's compiler
doesn't like them.
$(1): javac
$(2): bootclasspath
The MacOS jar tool doesn't like creating empty jar files,
so we need to give it something.
different configurations, then combine them later (or something).
Per-locale, etc.
A list of dynamic and static parameters;build layers for
dynamic params that lay over the static ones.
TODO: update the manifest to point to the package file
Note that the version numbers are given to aapt as simple default
values; applications can override these by explicitly stating
them in their manifest.
将资源文件打包到package
to make them easier to mmap.
newprebuiltrulestowork,weshouldchangethistocopythe
resourcestotheoutdirectoryandthencopytheresources.
Note:weintentionallydon'tcleanPRIVATE_CLASS_INTERMEDIATES_DIR
intransform-java-to-classesforthesakeofvm-tests.
PRIVATE_KEEP_FILE is a file containing a list of classes
PRIVATE_INTERMEDIATES_DIR is a directory we can use for temporary files
The module using this must depend on
$(HOST_OUT_J***A_LIBRARIES)/proguard-4.0.1.jar
混淆代码
Define a rule to copy a header. Used via $(eval) by copy_headers.make.
$(1): source header
$(2): destination header
$(1): source file
$(2): destination file
$(1): The files to copy. Each entry is a ':' separated src:dst pair
Evaluates to the list of the dst files (ie suitable for a dependency list)
$(1): source file
$(2): destination file, must end with .xml.
required for OSX. OSX has a ridiculous restriction
where it's an error for a .a file's modification time
to disagree with an internal timestamp, and this
macro is used to install .a files (among other things).
Copy a single file from one place to another,
preserving permissions and overwriting any existing
file.
We disable the "-t" option for acp cannot handle
high resolution timestamp correctly on file systems like ext4.
Therefore copy-file-to-target is the same as copy-file-to-new-target.
cp command instead of acp.
comments (for config files and such).
the old modification time.
cp command instead of acp.
library,ranlibmustberuntoupdateaninternal
timestamp!?!?!
Command to copy the file with acp, if proguard is disabled.
Convert a partition data size (eg, as reported in /proc/mtd) to the
size of the image used to flash that partition (which includes a
spare area for each page).
$(1): the partition data size
$(1): The file(s) to check (often $@)
$(2): The maximum total image size, in decimal bytes
$(3): the type of filesystem "yaffs" or "raw"
If $(2) is empty, evaluates to "true"
Reserve bad blocks. Make sure that MAX(1% of partition size, 2 blocks)
is left over after the image has been flashed. Round the 1% up to the
next whole flash block size.
Like assert-max-file-size, but the second argument is a partition
size, which we'll convert to a max image size before checking it
against the files.
$(1): The file(s) to check (often $@)
$(2): The partition size.
Define device-specific radio files
Copy a radio image file to the output location, and add it to
INSTALLED_RADIOIMAGE_TARGET.
$(1): filename
file to be checked against the contents of
$(TARGET_BOARD_INFO_FILE).
$(1): filename
$(2): name of version variable in board-info (eg, "version-baseband")
variables listed below differently.
$(1): The makefile to override (relative to the source
tree root)
$(2): Old LOCAL_PACKAGE_NAME value.
$(3): New LOCAL_PACKAGE_NAME value.
$(4): New LOCAL_MANIFEST_PACKAGE_NAME value.
$(5): New LOCAL_CERTIFICATE value.
$(6): New LOCAL_INSTRUMENTATION_FOR value.
$(7): New LOCAL_MANIFEST_INSTRUMENTATION_FOR value.
Note that LOCAL_PACKAGE_OVERRIDES is NOT cleared in
clear_vars.mk.
Evalutes to true if the package was overridden
$(1): The variable name that holds the initial module name list.
the variable will be modified to hold the expanded results.
$(2): The initial module name list.
Returns empty string (maybe with some whitespaces).
eval this to define a rule that runs apicheck.
Args:
$(1) target
$(2) stable api file
$(3) api file to be tested
$(4) arguments for apicheck
$(5) command to run if apicheck failed
$(6) target dependent on this api check
$(7) additional dependencies
查询地址:http://android.cloudchou.com/build/core/base_rules.php#LOCAL_INSTALLED_MODULE
build/core/base_rules.mk
base_rules.mk里定义了生成某种目标的方式目标类型:主机上的可执行程序,设备上的可执行程序,apk程序,Java运行库,动态链接库等等
Android编译系统里每一种目标的生成方式对应一个makefile,
示例:如果某个模块需要编译成手机上的二进制程序,它需要include $(BUILD_EXECUTABLE)
而BUILD_EXECUTABLE指向的是$(BUILD_SYSTEM)/executable.mk
所有生成方式对应的makefile都将包含base_rules.mk
LOCAL_PATH
每个模块都在Android.mk里定义,表示模块所在目录LOCAL_MODULE
LOCAL_MODULE表示模块的名称LOCAL_MODULE将在每个模块的makefile里定义,如果未定义,编译系统会报错
LOCAL_IS_HOST_MODULE
表示该模块生成的目标是否在主机上运行,my_prefix
若定义了 LOCAL_IS_HOST_MODULE 为true,那么my_prefix:=HOST_,否则 my_prefix:=TARGET_my_host
若定义了 LOCAL_IS_HOST_MODULE 为true,那么 my_host:=host-,否则 my_host:=LOCAL_UNINSTALLABLE_MODULE
表示该模块是否安装至手机,像sdk文档模块不会被安装至手机,因此LOCAL_UNINSTALLABLE_MODULE为trueLOCAL_MODULE_TAGS
模块的tag,为debug eng tests optional samples shell_ash shell_mksh等tag的组合,一个模块可有多个Tag,注意现在模块现在不能使用user作为模块的Tag,
以前如果使用user做为tag,那么这个模块将被自动安装,
如果想定义自动安装的模块,需要在PRODUCT_PACKAGES变量里添加该模块,
该变量在build/target/product/base.mk和build/target/product/core.mk里有赋值,这是所有产品都将继承的基础配置
另外每个设备可在自己的产品配置文件device_*.mk里设置该变量,添加更多的模块
如果当前目录或者父目录有*_GPL*的文件,那么将自动添加gnu的tag
LOCAL_MODULE_CLASS
将用于决定编译时的中间文件存放的位置LOCAL_MODULE_CLASS在定义目标生成方式的makefile文件里定义,
比如executable.mk里定义LOCAL_MODULE_CLASS := EXECUTABLES
在recovery模块的Android.mk里定义的LOCAL_MODULE_CLASS有:
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES
其它的LOCAL_MODULE_CLASS有
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_CLASS := FAKE
LOCAL_MODULE_CLASS := J***A_LIBRARIES
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_CLASS := APPS
对应 Cyanogenmod/target/product/m7ul/obj 的目录
比如说若 LOCAL_MODULE_CLASS := ETC
那么该模块编译的中间文件将存放于
Cyanogenmod/target/product/m7ul/obj/ETC
partition_tag
如果是主机模块,partition_tag将为空,否则如果是设备专有模块,partition_tag:=_VENDOR否则如果是安装到系统的模块,那么partition_tag将为空(test模块生成的目标只安装至data目录)
否则partition_tag:=_DATA
LOCAL_PROPRIETARY_MODULE
是否是设备专有模块LOCAL_MODULE_PATH
表示模块生成的目标将最终存放的目录recovery模块的Android.mk里有
LOCAL_MODULE := nandroid-md5.sh
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
说明:nandroid-md5.sh 将存放于out/Cyanogenmod/target/product/m7ul/recovery/root/sbin
如果模块的Android.mk里未定义LOCAL_MODULE_PATH
那么LOCAL_MODULE_PATH := $($(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS))
在recovery模块里recovery可执行文件相关变量如下:
比如my_prefix为TARGET_,partition_tag为空,LOCAL_MODULE_CLASS为EXECUTABLES
那么LOCAL_MODULE_PATH为$(TARGET_OUT_EXECUTABLES),
值应该为
out/Cyanogenmod/target/product/m7ul/system/bin
module_id
用于确保每个模块都是唯一的module_id := MODULE.$(if \
$(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(LOCAL_MODULE)
如果$(module_id)已经定义过,那会提示用户出错
recovery模块的Android.mk里针对recovery可执行文件:
module_id := MODULE.TARGET.EXECUTABLES.RECOVERY
$(MODULE.TARGET.EXECUTABLES.RECOVERY)=$(LOCAL_PATH)
即当前模块路径
intermediates
intermediates := $(call local-intermediates-dir)例: recovery模块Android.mk里编译Recovery可执行文件:
out/target/product/find5/obj/EXECUTABLES/recovery_intermediates
intermediates.COMMON
intermediates.COMMON := $(call local-intermediates-dir,COMMON)例: recovery模块Android.mk里编译Recovery可执行文件:
out/target/common/obj/EXECUTABLES/recovery_intermediates
LOCAL_MODULE_STEM
表示编译链接后的目标文件的文件名,不带后缀LOCAL_MODULE_STEM := $(strip $(LOCAL_MODULE_STEM))
ifeq ($(LOCAL_MODULE_STEM),)
LOCAL_MODULE_STEM := $(LOCAL_MODULE)
endif
例:
recovery模块编译recovery可执行文件:
LOCAL_MODULE_STEM:=recovery
LOCAL_MODULE_SUFFIX
表示编译链接后的目标文件的后缀LOCAL_INSTALLED_MODULE_STEM
表示要安装的目标文件的文件名,带后缀LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX)
例:
recovery模块编译recovery可执行文件:
LOCAL_INSTALLED_MODULE_STEM:=recovery
LOCAL_BUILT_MODULE_STEM
表示编译链接后的目标文件的文件名,带后缀LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
ifeq ($(LOCAL_BUILT_MODULE_STEM),)
LOCAL_BUILT_MODULE_STEM := $(LOCAL_INSTALLED_MODULE_STEM)
endif
例:
recovery模块编译recovery可执行文件:
LOCAL_INSTALLED_MODULE_STEM:=recovery
OVERRIDE_BUILT_MODULE_PATH
只有内部动态链接库模块可以使用OVERRIDE_BUILT_MODULE_PATHOVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
ifdef OVERRIDE_BUILT_MODULE_PATH
ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
endif
built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
else
built_module_path := $(intermediates)
endif
built_module_path
参见OVERRIDE_BUILT_MODULE_PATHLOCAL_BUILT_MODULE
表示编译链接后的目标文件(文件路径+文件名)LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
比如recovery:
LOCAL_BUILT_MODULE 路径;
out/Cyanogenmod/target/product/m7ul/obj/EXECUTABLES/recovery_intermediates/recovery
LOCAL_INSTALLED_MODULE
表示模块的安装路径+文件名ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
endif
示例:
out/Cyanogenmod/target/product/m7ul/system/bin/recovery
LOCAL_INTERMEDIATE_TARGETS
Assemble the list of targets to create PRIVATE_ variables for.LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
LOCAL_INTERMEDIATE_TARGETS
将所有目标添加到变量LOCAL_INTERMEDIATE_TARGETS里LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
LOCAL_INTERMEDIATE_TARGETS += $(proto_java_sources_file_stamp)
aidl_sources
表示所有源代码中的aidl文件aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
如果想编译aidl,只需将aidl加入LOCAL_SRC_FILES即可,
frameworks/base/Android.mk里有将aidl文件加入LOCAL_SRC_FILES变量
LOCAL_SRC_FILES += \
core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl \
core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl \
core/java/android/accounts/IAccountManager.aidl \
core/java/android/accounts/IAccountManagerResponse.aidl \
core/java/android/accounts/IAccountAuthenticator.aidl \
如果没有定义 TARGET_BUILD_APPS 变量,说明要编译framework.jar,那么将
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_J***A_SRC_DIRS)
在base_rules里定义了如何将aidl文件编译成java文件的方式,包括文件依赖
logtags_sources
表示源代码中的logtags文件frameworks/base/Android.mk里有将logtas文件加入LOCAL_SRC_FILES变量
LOCAL_SRC_FILES += \
core/java/android/content/EventLogTags.logtags \
core/java/android/speech/tts/EventLogTags.logtags \
core/java/android/webkit/EventLogTags.logtags \
在base_rules里定义了如何将logtag文件编译成java文件的方式,包括文件依赖
logtags文件最终会被logcat程序使用到
proto_sources
表示源代码中的proto文件在definitions里定义了all-proto-files-under方法添加所有proto文件
在./hardware/ril/mock-ril/Android.mk里有调用该方法
在base_rules里定义了如何将.proto文件编译成java文件的方式,包括文件依赖
LOCAL_INTERMEDIATE_SOURCE_DIR
表示编译生成的源文件存放目录LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
例:out/target/common/obj/EXECUTABLES/recovery_intermediates/src
LOCAL_J***A_RESOURCE_DIRS
java资源文件所在目录all_java_sources
所有Java源代码Compile .java files to .class
LOCAL_JAR_MANIFEST
java库用的manifest示例:
inputmethods/LatinIME/tools/maketext/Android.mk:20:LOCAL_JAR_MANIFEST := etc/manifest.txt
inputmethods/LatinIME/tools/dicttool/Android.mk:29:LOCAL_JAR_MANIFEST := etc/manifest.txt
full_static_java_libs
编译为java静态库Target: clean-$(LOCAL_MODULE)
定义一个模块的清除目标,如:recovery模块,有对应的clean-recovery如果在编译时用mka clean-recovery,将清除编译recovery时产生的文件,
包括编译中间文件和编译目标文件
LOCAL_CHECKED_MODULE
需要检查的模块ifndef LOCAL_CHECKED_MODULE
ifndef LOCAL_SDK_VERSION
LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE)
endif
endif
LOCAL_DONT_CHECK_MODULE
如果定义了该变量,那么模块将不被检查ifdef LOCAL_DONT_CHECK_MODULE
LOCAL_CHECKED_MODULE :=
endif
ALL_MODULES
所有的(LOCAL_MODULE)都会被加入ALL_MODULES变量ALL_MODULES += $(LOCAL_MODULE)
ALL_MODULES.$(LOCAL_MODULE).CLASS
将LOCAL_MODULE_CLASS加入到ALL_MODULES.$(LOCAL_MODULE).CLASS管理,这样可以得到所有模块的所有CLASS
ALL_MODULES.$(LOCAL_MODULE).CLASS := \
$(ALL_MODULES.$(LOCAL_MODULE).CLASS) $(LOCAL_MODULE_CLASS)
示例:
ALL_MODULES.recovery.CLASS = EXECECUTABLE
一个模块可能既编译为手机上的可执行程序,又编译为电脑上的可执行程序
故此ALL_MODULES.recovery.CLASS 可能由多个CLASS组合
ALL_MODULES.$(LOCAL_MODULE).PATH
所有模块路径ALL_MODULES.$(LOCAL_MODULE).PATH := \
$(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH)
示例:
ALL_MODULES.recovery.PATH bootable/recovery
ALL_MODULES.$(LOCAL_MODULE).TAGS
所有模块的所有TAGSALL_MODULES.$(LOCAL_MODULE).TAGS := \
$(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS)
示例:
ALL_MODULES.recovery.TAGS eng
ALL_MODULES.$(LOCAL_MODULE).CHECKED
所有模块的所有是否被检查属性ALL_MODULES.$(LOCAL_MODULE).CHECKED := \
$(ALL_MODULES.$(LOCAL_MODULE).CHECKED) $(LOCAL_CHECKED_MODULE)
示例:
ALL_MODULES.recovery.CHECKED
out/Cyanogenmod/target/product/m7ul/obj/EXECUTABLES/recovery_intermediates/recovery
ALL_MODULES.$(LOCAL_MODULE).BUILT
所有模块的所有生成路径ALL_MODULES.$(LOCAL_MODULE).BUILT := \
$(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
示例:
out/Cyanogenmod/target/product/m7ul/obj/EXECUTABLES/recovery_intermediates/recovery
ALL_MODULES.$(LOCAL_MODULE).INSTALLED
所有模块的各自安装路径ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
$(strip $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE))
示例:
out/Cyanogenmod/target/product/m7ul/system/bin/recovery
ALL_MODULES.$(LOCAL_MODULE).REQUIRED
所有模块的各自依赖模块ALL_MODULES.$(LOCAL_MODULE).REQUIRED := \
$(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES)
binary.mk:
LOCAL_REQUIRED_MODULES += $(installed_shared_library_module_names)
ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS
所有模块的EVENT_LOG_TAGSALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \
$(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags)
event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR
所有模块的生成代码的目录集合ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \
$(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
ALL_MODULES.$(LOCAL_MODULE).MAKEFILE
所有模块各自的makefile集合ALL_MODULES.$(LOCAL_MODULE).MAKEFILE := \
$(ALL_MODULES.$(LOCAL_MODULE).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
举例:
bootable/recovery/Android.mk
ALL_MODULES.$(LOCAL_MODULE).OWNER
所有模块各自的OWNERifdef LOCAL_MODULE_OWNER
ALL_MODULES.$(LOCAL_MODULE).OWNER := \
$(sort $(ALL_MODULES.$(LOCAL_MODULE).OWNER) $(LOCAL_MODULE_OWNER))
endif
三星glaxsy2有定义LOCAL_MODULE_OWNER变量
./vendor/samsung/galaxys2-common/proprietary/Android.mk:21:LOCAL_MODULE_OWNER := samsung
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE
所有模块各自安装的名字INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE)
例子:
INSTALLABLE_FILES.out/Cyanogenmod/target/product/m7ul/system/bin/recovery.MODULE:=recovery
ALL_MODULE_TAGS
所有模块的所有TAGSALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(LOCAL_MODULE_TAGS))
例:
ALL_MODULE_TAGS debug eng tests optional samples shell_ash shell_mksh
ALL_MODULE_TAGS.$(tag)
每个Tag对应的模块安装路径集合$(foreach tag,$(LOCAL_MODULE_TAGS),\
$(eval ALL_MODULE_TAGS.$(tag) := \
$(ALL_MODULE_TAGS.$(tag)) \
$(LOCAL_INSTALLED_MODULE)))
ALL_MODULE_NAME_TAGS.$(tag)
每个TAG对应的模块集合$(foreach tag,$(LOCAL_MODULE_TAGS),\
$(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE)))
build/core/definitions.mk
定义了公共的编译系统变量ALL_*,还定义了很多命令用来编译各种各样的目标,
其它地方用来构建最终目标,build/core/main.mk,build/core/Makefile将用到这些变量
ALL_DOCS
所有文档的全路径ALL_DOCS的赋值在droiddoc.mk里:
ALL_DOCS += $(full_target)
full_target := $(call doc-timestamp-for,$(LOCAL_MODULE))
ALL_DOCS示例:out/target/common/docs/api-stubs-timestamp out/target/common/docs/hidden-timestamp
如果某个模块要编译出文档,需要使用命令
include $(BUILD_DROIDDOC)
而BUILD_DROID_DOC变量的值是droiddoc.mk
ALL_MODULES
系统的所有模块的简单名字集合编译系统还为每一个模块还定义了其它两个变量
ALL_MODULES.$(LOCAL_MODULE).BUILT 所有模块的生成路径
ALL_MODULES.$(LOCAL_MODULE).INSTALLED 所有模块的各自安装路径
例如:手机中将安装在system/bin/recovery,那么ALL_MODULES.recovery.INSTALLED为out/target/product/find5/system/bin/recovery
每个模块都会定义该模块生成的目标类型,可能生成二进制文件,也可能生成java静态库
这是由这个模块include $(BUILD_)决定的
比如build type若是EXCECUTABLE,,那么将include $(BUILD_EXECUTABLE),那么将include build/core/executable.mk
而该makefile对应生成的目标类型是在手机上的可执行程序
executable.mk里包含了binary.mk,而binary.mk包含了base_rules.mk
base_rules.mk里为变量ALL_MODULES,ALL_MODULES.$(target).BUILT,ALL_MODULES.$(target).INSTALLED赋值
代码:
ALL_MODULES += $(LOCAL_MODULE)
ALL_MODULES.$(LOCAL_MODULE).BUILT := \
$(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
$(strip $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE))
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
endif
LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
ifeq ($(LOCAL_MODULE_PATH),)
LOCAL_MODULE_PATH := $($(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS))
ifeq ($(strip $(LOCAL_MODULE_PATH)),)
$(error $(LOCAL_PATH): unhandled LOCAL_MODULE_CLASS "$(LOCAL_MODULE_CLASS)")
endif
endif
LOCAL_MODULE_PATH:表示要安装的位置,可由编译系统推算,也可由某个模块显示指定
示例:
ALL_MODULES:recvery applypatch applypatch_static imgdiff
对应的
$(built_module_path) : out/target/product/find5/obj/EXECUTABLES/recovery_intermediates
$(LOCAL_BUILT_MODULE_STEM) : recovery
$(LOCAL_MODULE_PATH): out/target/product/find5/system/bin
$(LOCAL_INSTALLED_MODULE_STEM): recovery
$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS):TARGET_OUT_EXECUTABLES
$(ALL_MODULES.recovery.BUILT) :out/target/product/find5/obj/EXECUTABLES/recovery_intermediates/recovery
$(ALL_MODULES.recovery.INSTALLED):out/target/product/find5/system/bin/recovery
ALL_DEFAULT_INSTALLED_MODULES
所有默认要安装的模块,在build/core/main.mk和build/core/makfile里设置Full paths to targets that should be added to the "make droid" set of installed targets.
droid目标将安装的所有模块的集合
ALL_MODULE_TAGS
使用LOCAL_MODULE_TAGS定义的所有tag集合每一个tag对应一个ALL_MODULE_TAGS.变量
例:
在recovery的Android.mk里定义了;
LOCAL_MODULE := recovery
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE := nandroid-md5.sh
LOCAL_MODULE_TAGS := optional
那么:ALL_MODULE_TAGS 将包含 eng,optional,
ALL_MODULE_TAGS.eng:out/target/product/find5/system/bin/recovery
ALL_MODULE_TAGS.optional: out/target/product/find5/recovery/root/sbin/nandroid-md5.sh
ALL_MODULE_NAME_TAGS
类似于ALL_MODULE_TAGS,但是它的值是 某个tag的所有模块的名称例:
包含bootable/recovery/Android.mk后,
ALL_MODULE_NAME_TAGS.eng: recovery libbmlutils libdedupe utility_dedupe libcrecovery libmmcutils updater libapplypatch applypatch_static su.recovery
ALL_MODULE_NAME_TAGS.optional: nandroid-md5.sh killrecovery.sh dedupe libflashutils flash_image dump_image erase_image libflash_image libdump_image liberase_image
utility_dump_image utility_flash_image utility_erase_image libminui libminelf libminzip libminadbd libmtdutils edify libedify applypatch
imgdiff parted sdparted libminizip libmake_ext4fs install-su.sh run-su-daemon.sh
ALL_HOST_INSTALLED_FILES
安装在pc上的程序集合例:
包含bootable/recovery/Android.mk后,
ALL_HOST_INSTALLED_FILES: /home/cloud/android/Cyanogenmod/out/host/linux-x86/bin/dedupe
/home/cloud/android/Cyanogenmod/out/host/linux-x86/bin/edify
/home/cloud/android/Cyanogenmod/out/host/linux-x86/bin/imgdiff
ALL_PREBUILT
将会被拷贝的预编译文件的安装全路径的集合Full paths to all prebuilt files that will be copied (used to make the dependency on acp)
在system/core/Android.mk里大量使用了ALL_PREBUILT
ALL_PREBUILT += $(file)
ALL_PREBUILT += $(DIRS)
示例:
ALL_PREBUILT: out/target/product/find5/system/etc/dbus.conf out/target/product/find5/system/etc/hosts out/target/product/find5/system/etc/init.goldfish.sh
ALL_GENERATED_SOURCES
某些工具生成的源代码文件的集合,比如aidl会生成java源代码文件Full path to all files that are made by some tool
./build/core/binary.mk:273:ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES)
./bionic/libc/Android.mk:735:ALL_GENERATED_SOURCES += $(GEN)
例:
ALL_GENERATED_SOURCES: out/target/product/find5/obj/SHARED_LIBRARIES/libRS_intermediates/rsgApiStructs.h
out/target/product/find5/obj/SHARED_LIBRARIES/libRS_intermediates/rsgApiFuncDecl.h
out/target/product/find5/obj/SHARED_LIBRARIES/libbt-vendor_intermediates/vnd_buildcfg.h
ALL_C_CPP_ETC_OBJECTS
所有asm,c,c++,以及lex和yacc生成的c代码文件的全路径这些都对拷贝的头文件有一个按序的依赖关系
ALL_ORIGINAL_DYNAMIC_BINARIES
没有被优化,也没有被压缩的动态链接库The list of dynamic binaries that haven't been stripped/compressed/etc
dynamic_binary.mk: ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
例:
ALL_ORIGINAL_DYNAMIC_BINARIES:out/target/product/find5/obj/EXECUTABLES/vold_intermediates/LINKED/vold
out/target/product/find5/obj/SHARED_LIBRARIES/libkeystore_intermediates/LINKED/libkeystore.so
ALL_SDK_FILES
将会放在sdk的文件These files go into the SDK
主要赋值:development/build/Android.mk
INTERNAL_DALVIK_MODULES
dalvik虚拟机需要的文件Files for dalvik. This is often build without building the rest of the OS
在dalvik/dx/src/Android.mk dalvik/dx/Android.mk中有赋值
ALL_FINDBUGS_FILES
所有findbugs程序用的xml文件build/core/java.mk:400:ALL_FINDBUGS_FILES += $(findbugs_xml)
All findbugs xml files
ALL_GPL_MODULE_LICENSE_FILES
GPL module license filesGPL 模块的 许可文件
在build/core/base_rules.mk里有赋值
gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL*)
ifneq ($(gpl_license_file),)
LOCAL_MODULE_TAGS += gnu
ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file))
endif
ANDROID_RESOURCE_GENERATED_CLASSES
Android 资源文件生成的java代码编译后的类的类型ANDROID_RESOURCE_GENERATED_CLASSES := 'R.class' 'R$$*.class' 'Manifest.class' 'Manifest$$*.class'
在build/core/static_java_library.mk中有用到,用于排除某些文件,使其不被打包至lib文件
Function: print-vars
Debugging; prints a variable list to stdout用于打印变量的值
$(1): variable name list, not variable values
Function: true-or-empty
如果参数含有true,则返回true,否则返回空$(1) 要测试的变量
Function: my-dir
返回当前makefile所在目录Function: all-makefiles-under
获取某个目录下及子目录的所有Android.mk$(1):需要提取Android.mk的目录
Function: first-makefiles-under
在某个目录下的所有子目录中查找Android.mk,不包括当前目录$(1):要搜索的目录
Function: all-subdir-makefiles
查找当前目录及子目录下的所有Android.mkFunction: all-named-subdir-makefiles
在当前目录下的一组子目录下查找Android.mk$(1): List of directories to look for under this directory
Function: all-java-files-under
找出当前makefile所在目录的指定子目录里的所有java文件$(1) 指定子目录
使用范例:SRC_FILES := $(call all-java-files-under,src tests)
Function: all-subdir-java-files
从当前目录查找所有java文件使用范例: SRC_FILES := $(call all-subdir-java-files)
Function: all-c-files-under
在指定子目录下找C代码Find all of the c files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-c-files-under,src tests)
$1: 指定子目录名称
Function: all-subdir-c-files
查找当前目录所有子目录的c代码文件Find all of the c files from here. Meant to be used like:
SRC_FILES := $(call all-subdir-c-files)
Function: all-Iaidl-files-under
在指定子目录下查找所有类似I*.aidl代码文件Find all files named "I*.aidl" under the named directories,
which must be relative to $(LOCAL_PATH). The returned list
is relative to $(LOCAL_PATH).
$1: 指定子目录名称
Function: all-subdir-Iaidl-files
在$(LOCAL_PATH)下查找所有I*.aidl代码文件Find all of the "I*.aidl" files under $(LOCAL_PATH).
Function: all-logtags-files-under
在指定子目录下查找所有logtags文件Find all of the logtags files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-logtags-files-under,src)
查找.logtag文件
$1:指定子目录名称
Function: all-proto-files-under
在指定子目录下查找所有.proto文件Find all of the .proto files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-proto-files-under,src)
查找.proto文件
$1:指定子目录名称
Function: all-renderscript-files-under
在指定子目录下查找所有.rs或者.fs文件Find all of the RenderScript files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-renderscript-files-under,src)
查找.rs .fs文件
$1:指定子目录名称
Function: all-html-files-under
在指定子目录下查找所有html文件Find all of the html files under the named directories.
Meant to be used like:
SRC_FILES := $(call all-html-files-under,src tests)
查找.html文件
$1:指定子目录名称
Function: all-subdir-html-files
在当前目录的子目录里查找所有html文件Find all of the html files from here. Meant to be used like:
SRC_FILES := $(call all-subdir-html-files)
Function: find-subdir-files
根据find命令的规则查找所有文件Find all of the files matching pattern
SRC_FILES := $(call find-subdir-files, )
$1 find命令的匹配规则
Function: find-subdir-subdir-files
在指定子目录下根据find命令的规则查找文件find the files in the subdirectory $1 of LOCAL_DIR
matching pattern $2, filtering out files $3
e.g.
SRC_FILES += $(call find-subdir-subdir-files, \
css, *.cpp, DontWantThis.cpp)
$1 LOCAL_DIR的子目录
$2 find命令的匹配规则
$3 过滤的文件
Function: find-subdir-assets
查找所有不是软链且文件名不带后缀的文件SRC_FILES := $(call find-subdir-assets)
$1 要进入并查找的目录
Function: find-other-java-files
在$(LOCAL_PATH)里根据find命令的匹配规则查找java文件$1 find命令的匹配规则
Function: find-other-html-files
在$(LOCAL_PATH)里根据find命令的匹配规则查找html文件$1 find命令的匹配规则
Function: find-parent-file
在$1给出的目录及这个目录的父目录里查找$2,若找到返回该路径Scan through each directory of $(1) looking for files
that match $(2) using $(wildcard). Useful for seeing if
a given directory or one of its parents contains
a particular file. Returns the first match found,
starting furthest from the root.
$1 要查找的目录集合
$2 要查找的文件
Function: add-dependency
添加依赖关系Function we can evaluate to introduce a dynamic dependency
$1 需要依赖其它东东的目标
$2 被依赖的东东
Function: add-prebuilt-file
Set up the dependencies for a prebuilt target$(call add-prebuilt-file, srcfile, [targetclass])
$(1): srcfile
$(2): target class
Function: add-prebuilt-files
domultipleprebuilts$(calltargetclass,files...)
$(1)targetclass
$(2)srcfiles
使用举例:
gdbserver/Android.mk:$(calladd-prebuilt-files,EXECUTABLES,$(prebuilt_files))
Function: intermediates-dir-for
查找中间目录并返回The intermediates directory. Where object files go for
a given target. We could technically get away without
the "_intermediates" suffix on the directory, but it's
nice to be able to grep for that string to find out if
anyone's abusing the system.
# $(1): target class, like "APPS"
# $(2): target name, like "NotePad"
# $(3): if non-empty, this is a HOST target.
# $(4): if non-empty, force the intermediates to be COMMON 如果是host的common,则是out/host/common,如果是target的common,则是out/target/common
使用举例:
./development/build/Android.mk framework_res_package := $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
./frameworks/base/core/res/Android.mk:37:framework_GENERATED_SOURCE_DIR := $(call intermediates-dir-for,J***A_LIBRARIES,framework,,COMMON)/src
值: out/target/product/find5/obj/STATIC_LIBRARIES/libstdc++_intermediates
out/target/common/obj/J***A_LIBRARIES/core_intermediates
out/target/common/obj/APPS/framework-res_intermediates
out/target/common/obj/J***A_LIBRARIES/framework_intermediates
Function: local-intermediates-dir
利用LOCAL_MODULE_CLASS, LOCAL_MODULE, and LOCAL_IS_HOST_MODULE决定中间目录$(1): if non-empty, force the intermediates to be COMMON
例: LOCAL_MODULE_CLASS:EXECUTABLES
LOCAL_MODULE: recovery
LOCAL_IS_HOST_MODULE empty
$1 为空
那么返回out/target/product/find5/obj/EXECUTABLES/recovery_intermediates
Function: normalize-libraries
将"path/to/libXXX.so"转为 -lXXXConvert "path/to/libXXX.so" to "-lXXX".
Any "path/to/libXXX.a" elements pass through unchanged.
Function: normalize-host-libraries
参见normalize-libraries,和之类似Function: normalize-target-libraries
参见normalize-libraries,和之类似Function: module-built-files
将模块名字转为它们对应的编译生成路径Convert a list of short module names (e.g., "framework", "Browser")
into the list of files that are built for those modules.
NOTE: this won't return reliable results until after all
sub-makefiles have been included.
$(1): target list
Function: module-installed-files
将模块名字转为它们对应的安装路径Convert a list of short modules names (e.g., "framework", "Browser")
into the list of files that are installed for those modules.
NOTE: this won't return reliable results until after all
sub-makefiles have been included.
$(1): target list
Function: module-stubs-files
将模块名字转为它们要作为公共API时链接的文件路径Convert a list of short modules names (e.g., "framework", "Browser")
into the list of files that should be used when linking
against that module as a public API.
TODO: Allow this for more than J***A_LIBRARIES modules
NOTE: this won't return reliable results until after all
sub-makefiles have been included.
$(1): target list
define module-stubs-files
$(foreach module,$(1),$(ALL_MODULES.$(module).STUBS))
endef
Function: doc-timestamp-for
为文档模块转为timestamp为文件,这个文件是添加依赖时会用到的Evaluates to the timestamp file for a doc module, which
is the dependency that should be used.
$(1): doc module
Function: java-lib-files
Convert "core ext framework" to "out/.../javalib.jar ..."out/target/common/J***A_LIBRARIES/libname_indeterminates/classes.jar
out/host/common/J***A_LIBRARIES/libname_indeterminates/classes.jar
$(1): library name list
$(2): Non-empty if IS_HOST_MODULE
Function: java-lib-deps
多个javalib.jar$(1): library name list
$(2): Non-empty if IS_HOST_MODULE
Function: rot13
Run rot13 on a string rot13 是一种简易的置换暗码$(1): the string. Must be one line.
Function: streq
Returns true if $(1) and $(2) are equal. Returnsthe empty string if they are not equal.
Function: normalize-path-list
Convert "a b c" into "a:b:c"Function: word-colon
Read the word out of a colon-separated list of words.This has the same behavior as the built-in function
$(word n,str).
The individual words may not contain spaces.
将用":"分隔的字符串转化为词数组
$(1): 1 based index
$(2): value of the form a:b:c...
Function: collapse-pairs
Convert "a=b c= d e = f" into "a=b c=d e=f" ,注意空格$(1): list to collapse
$(2): if set, separator word; usually "=", ":", or ":="
Defaults to "=" if not set.
Function: uniq-pairs-by-first-component
Given a list of pairs, if multiple pairs have the samefirst components, keep only the first pair.
$(1): list of pairs
$(2): the separator word, such as ":", "=", etc.
Function: modules-for-tag-list
Given a list of pairs, if multiple pairs have the samefirst components, keep only the first pair.
$(1): list of pairs
$(2): the separator word, such as ":", "=", etc.
ALL_MODULE_TAGS.eng:out/target/product/find5/system/bin/recovery
Function: module-names-for-tag-list
Given a list of tags, return the targets that specifyany of those tags.
$(1): tag list
ALL_MODULE_NAME_TAGS.eng: recovery libbmlutils libdedupe utility_dedupe libcrecovery libmmcutils updater libapplypatch applypatch_static su.recovery
Function: get-tagged-modules
Given an accept and reject list, find the matching set of targets. If a target has multiple tags andany of them are rejected, the target is rejected.
Reject overrides accept.
$(1): list of tags to accept
$(2): list of tags to reject
Function: append-path
Append a leaf to a base path. Properly deals withbase paths ending in /.
$(1): base path
$(2): leaf path
Function: get-package-overrides
Packagefiltering#Givenalistofinstalledmodules(shortorlongnames)
#returnalistofthepackages(yes,.apkpackages,not
#modulesingeneral)thatareoverriddenbythislistand,
#therefore,shouldnotbeinstalled.
#$(1):mixedlistofinstalledmodules
#TODO:Thisisfragile;findareliablewaytogetthisinformation.
Function: pretty
Output the command lines, or not如果编译时传递了添加了showcommands参数,调用pretty会打印正在执行的命令
如果没有传递showcommand参数,则不会打印正在执行的命令
Function: dump-module-variables
Dump the variables that are associated with targets打印编译时的一些参数
主要是一些PRIVATE变量,例如PRIVATE_YACCFLAGS
Function: transform-variables
Commands for using sed to replace given variable valuesFunction: transform-d-to-p-args
CommandsformungingthedependencyfilesGCCgenerates$(1):theinput.dfile
$(2):theoutput.Pfile
Function: transform-d-to-p
参见 transform-d-to-p-argsFunction: transform-l-to-cpp
Commands for running lex举例:
ifneq ($(strip $(lex_cpps)),)
$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.l
$(transform-l-to-cpp)
Function: transform-y-to-cpp
Commands for running yaccBecause the extension of c++ files can change, the
extension must be specified in $1.
E.g, "$(call transform-y-to-cpp,.cpp)"
Function: transform-renderscripts-to-java-and-bc
Commands to compile RenderScriptFunction: transform-aidl-to-java
Commands for running aidlFunction: transform-logtags-to-java
Commands for running java-event-log-tags.pyFunction: transform-proto-to-java
Commands for running protoc to compile .proto into .javaFunction: transform-proto-to-cc
Commands for running protoc to compile .proto into .pb.cc and .pb.hFunction: transform-cpp-to-o
Commands for running gcc to compile a C++ fileFunction: transform-c-or-s-to-o-no-deps
Commands for running gcc to compile a C file# $(1): extra flags
Function: transform-c-to-o-no-deps
编译c文件至目标文件,无依赖的编译# $(1): extra flags
Function: transform-s-to-o-no-deps
编译汇编文件至目标文件,无依赖的编译$(1): extra flags
Function: transform-c-to-o
编译c文件至目标文件# $(1): extra flags 编译参数
Function: transform-s-to-o
编译汇编文件至目标文件$(1): extra flags,编译参数
Function: transform-m-to-o-no-deps
Commands for running gcc to compile an Objective-C fileThis should never happen for target builds but this
will error at build time.
Function: transform-m-to-o
编译objet c文件至目标文件$(1): extra flags,编译参数
Function: transform-host-cpp-to-o
Commands for running gcc to compile a host C++ file编译cpp文件,目标代码将在主机上运行
$(1): extra flags
Function: transform-host-c-or-s-to-o-no-deps
Commands for running gcc to compile a host C file编译c代码或者汇编代码,目标代码将在主机上运行,无依赖的编译
$(1): extra flags
Function: transform-host-c-to-o-no-deps
Commands for running gcc to compile a host C file编译c代码,目标代码将在主机上运行,无依赖的编译
$(1): extra flags
Function: transform-host-s-to-o-no-deps
编译汇编代码,目标代码将在主机上运行,无依赖的编译$(1): extra flags
Function: transform-host-c-to-o
编译c代码,目标代码将在主机上运行$(1): extra flags
Function: transform-host-s-to-o
编译汇编代码,目标代码将在主机上运行$(1): extra flags
Function: transform-host-m-to-o-no-deps
Commands for running gcc to compile a host Objective-C file编译object c代码,目标代码将在主机上运行,无依赖编译
$(1): extra flags
Function: transform-host-m-to-o
Commands for running gcc to compile a host Objective-C file编译object c代码,目标代码将在主机上运行,
$(1): extra flags
Function: _concat-if-arg2-not-empty
Commands for running arFunction: split-long-arguments
Split long argument list into smaller groups and call the command repeatedlyCall the command at least once even if there are no arguments, as otherwise
the output file won't be created.
$(1): the command without arguments
$(2): the arguments
Function: extract-and-include-target-whole-static-libs
$(1): the full path of the source static library.Function: transform-o-to-static-lib
Explicitly delete the archive first so that ar doesn'ttry to add to an existing archive.
将目标代码打包成静态库
Function: extract-and-include-host-whole-static-libs
Commands for running host ar$(1): the full path of the source static library.
静态库将在主机上运行
Function: transform-host-o-to-static-lib
将目标代码打包成在主机上运行的静态库静态库将在主机上运行
Function: transform-host-o-to-shared-lib-inner
Commands for running gcc to link a shared library or packageld just seems to be so finicky with command order that we allow
it to be overriden en-masse see combo/linux-arm.make for an example.
将目标代码打包成在主机上运行的动态库或者包
Function: transform-host-o-to-shared-lib
参见transform-host-o-to-shared-lib-innerFunction: transform-host-o-to-package
参见transform-host-o-to-shared-lib-innerFunction: transform-o-to-shared-lib-inner
Commands for running gcc to link a shared library or packageld just seems to be so finicky with command order that we allow
it to be overriden en-masse see combo/linux-arm.make for an example.
将目标代码打包成在目标机上运行的动态库
Function: transform-o-to-shared-lib
参见transform-o-to-shared-lib-innerFunction: transform-o-to-package
参见transform-o-to-shared-lib-innerFunction: transform-to-stripped
Commands for filtering a target executable or libraryFunction: transform-o-to-executable-inner
Commandsforrunninggcctolinkanexecutable编译成可执行文件
Function: transform-o-to-executable
参见transform-o-to-executable-innerFunction: transform-o-to-static-executable-inner
Commandsforrunninggcctolinkastaticallylinkedexecutable.Inpractice,weonlyusethisonarm,so
theotherplatformsdon'thavethe
transform-o-to-static-executabledefined
Function: transform-o-to-static-executable
参见transform-o-to-static-executable-innerFunction: transform-host-o-to-executable-inner
Commands for running gcc to link a host executableFunction: transform-host-o-to-executable
参见transform-host-o-to-executable-innerFunction: create-resource-java-files
Commandsforrunningjavactomake.classfiles@echo"Sourceintermediatesdir:$(PRIVATE_SOURCE_INTERMEDIATES_DIR)"
@echo"Sourceintermediates:$$(find$(PRIVATE_SOURCE_INTERMEDIATES_DIR)-name'*.java')"
ThisrulecreatestheR.javaandManifest.javafiles,bothofwhich
arePRODUCT-neutral.Don'tpassPRIVATE_PRODUCT_AAPT_CONFIGtothisinvocation.
Function: emit-line
emit-line,,Function: dump-words-to-file
dump-words-to-file,,Function: unzip-jar-files
For a list of jar files, unzip them to a specified directory,but make sure that no META-INF files come along for the ride.
$(1): files to unzip
$(2): destination directory
Function: compile-java
Common definition to invoke javac on the host and target.Some historical notes:
- below we write the list of java files to java-source-list to avoid argument
list length problems with Cygwin
- we filter out duplicate java file names because eclipse's compiler
doesn't like them.
$(1): javac
$(2): bootclasspath
Function: transform-java-to-classes.jar
将java编译并打包成classes.jarFunction: transform-classes.jar-to-emma
emma代码覆盖率测试Function: transform-classes.jar-to-dex
将classes.jar转化为dexFunction: create-empty-package
Create a mostly-empty .jar file that we'll add to later.The MacOS jar tool doesn't like creating empty jar files,
so we need to give it something.
Function: add-assets-to-package
TODO: we kinda want to build different asset packages fordifferent configurations, then combine them later (or something).
Per-locale, etc.
A list of dynamic and static parameters;build layers for
dynamic params that lay over the static ones.
TODO: update the manifest to point to the package file
Note that the version numbers are given to aapt as simple default
values; applications can override these by explicitly stating
them in their manifest.
将资源文件打包到package
Function: add-jni-shared-libs-to-package
将jni 动态库打包到packageFunction: add-dex-to-package
将dex打包到packageFunction: add-java-resources-to-package
Add java resources added by the current module.Function: add-carried-java-resources
Add java resources carried by static Java libraries.Function: sign-package
Sign a package using the specified key/cert.Function: align-package
Align STORED entries of a package on 4-byte boundariesto make them easier to mmap.
Function: install-dex-debug
安装debug版本的dex文件Function: transform-host-java-to-package
TODO(joeo):Ifwecaneverupgradetopost3.81makeandgetthenewprebuiltrulestowork,weshouldchangethistocopythe
resourcestotheoutdirectoryandthencopytheresources.
Note:weintentionallydon'tcleanPRIVATE_CLASS_INTERMEDIATES_DIR
intransform-java-to-classesforthesakeofvm-tests.
Function: obfuscate-jar
Obfuscate a jar filePRIVATE_KEEP_FILE is a file containing a list of classes
PRIVATE_INTERMEDIATES_DIR is a directory we can use for temporary files
The module using this must depend on
$(HOST_OUT_J***A_LIBRARIES)/proguard-4.0.1.jar
混淆代码
Function: copy-one-header
Commands for copying filesDefine a rule to copy a header. Used via $(eval) by copy_headers.make.
$(1): source header
$(2): destination header
Function: copy-one-file
Define a rule to copy a file. For use via $(eval).$(1): source file
$(2): destination file
Function: copy-many-files
Copies many files.$(1): The files to copy. Each entry is a ':' separated src:dst pair
Evaluates to the list of the dst files (ie suitable for a dependency list)
Function: copy-xml-file-checked
Copy the file only if it's a well-formed xml file. For use via $(eval).$(1): source file
$(2): destination file, must end with .xml.
Function: copy-file-to-target
The -t option to acp and the -p option to cp isrequired for OSX. OSX has a ridiculous restriction
where it's an error for a .a file's modification time
to disagree with an internal timestamp, and this
macro is used to install .a files (among other things).
Copy a single file from one place to another,
preserving permissions and overwriting any existing
file.
We disable the "-t" option for acp cannot handle
high resolution timestamp correctly on file systems like ext4.
Therefore copy-file-to-target is the same as copy-file-to-new-target.
Function: copy-file-to-target-with-cp
The same as copy-file-to-target, but use the localcp command instead of acp.
Function: copy-file-to-target-with-zipalign
The same as copy-file-to-target, but use the zipalign tool to do so.Function: copy-file-to-target-strip-comments
The same as copy-file-to-target, but strip out "# comment"-stylecomments (for config files and such).
Function: copy-file-to-new-target
The same as copy-file-to-target, but don't preservethe old modification time.
Function: copy-file-to-new-target-with-cp
The same as copy-file-to-new-target, but use the localcp command instead of acp.
Function: transform-prebuilt-to-target
Copy a prebuilt file to a target location.Function: transform-prebuilt-to-target-with-zipalign
Copyaprebuiltfiletoatargetlocation,usingzipalignonit.Function: transform-prebuilt-to-target-strip-comments
Copy a prebuilt file to a target location, stripping "# comment" comments.Function: transform-host-ranlib-copy-hack
Onsomeplatforms(MacOS),aftercopyingastaticlibrary,ranlibmustberuntoupdateaninternal
timestamp!?!?!
Function: proguard-disabled-commands
Commands to call ProguardCommand to copy the file with acp, if proguard is disabled.
Function: proguard-enabled-commands
Command to copy the file with acp, if proguard is disabled.Function: get-instrumentation-proguard-flags
Figure out the proguard dictionary file of the module that is instrumentationed for.Function: transform-jar-to-proguard
将jar混淆Function: transform-generated-source
Stuffsourcegeneratedfromone-offtoolsFunction: image-size-from-data-size
将data分区大小(在/proc/mtd里存储)转为能够刷入该分区的img文件大小Convert a partition data size (eg, as reported in /proc/mtd) to the
size of the image used to flash that partition (which includes a
spare area for each page).
$(1): the partition data size
Function: assert-max-file-size
确保文件大小不超过某个数值$(1): The file(s) to check (often $@)
$(2): The maximum total image size, in decimal bytes
$(3): the type of filesystem "yaffs" or "raw"
If $(2) is empty, evaluates to "true"
Reserve bad blocks. Make sure that MAX(1% of partition size, 2 blocks)
is left over after the image has been flashed. Round the 1% up to the
next whole flash block size.
Function: assert-max-image-size
确保image大小不超过某个数值Like assert-max-file-size, but the second argument is a partition
size, which we'll convert to a max image size before checking it
against the files.
$(1): The file(s) to check (often $@)
$(2): The partition size.
Function: add-radio-file
添加radio包Define device-specific radio files
Copy a radio image file to the output location, and add it to
INSTALLED_RADIOIMAGE_TARGET.
$(1): filename
Function: add-radio-file-checked
Version of add-radio-file that also arranges for the version of thefile to be checked against the contents of
$(TARGET_BOARD_INFO_FILE).
$(1): filename
$(2): name of version variable in board-info (eg, "version-baseband")
Function: inherit-package
Override the package defined in $(1), setting thevariables listed below differently.
$(1): The makefile to override (relative to the source
tree root)
$(2): Old LOCAL_PACKAGE_NAME value.
$(3): New LOCAL_PACKAGE_NAME value.
$(4): New LOCAL_MANIFEST_PACKAGE_NAME value.
$(5): New LOCAL_CERTIFICATE value.
$(6): New LOCAL_INSTRUMENTATION_FOR value.
$(7): New LOCAL_MANIFEST_INSTRUMENTATION_FOR value.
Note that LOCAL_PACKAGE_OVERRIDES is NOT cleared in
clear_vars.mk.
Function: set-inherited-package-variables
To be used with inherit-package aboveEvalutes to true if the package was overridden
Function: keep-or-override
参见inherit-packageFunction: expand-required-modules
Expand a module name list with REQUIRED modules$(1): The variable name that holds the initial module name list.
the variable will be modified to hold the expanded results.
$(2): The initial module name list.
Returns empty string (maybe with some whitespaces).
Function: check-api
API Checkeval this to define a rule that runs apicheck.
Args:
$(1) target
$(2) stable api file
$(3) api file to be tested
$(4) arguments for apicheck
$(5) command to run if apicheck failed
$(6) target dependent on this api check
$(7) additional dependencies
相关文章推荐
- com.android.camera.Camera.java,主要的实现Activity,继承于ActivityBase
- com.android.camera.Camera.java,主要的实现Activity,继承于ActivityBase
- android使用红杏代理更新sdk
- android 截取验证码的两种实现方式
- 关于Android 选择相册图片裁剪的坑
- Android 命名规范 (提高代码可以读性)
- Android Studio如何修改快捷键
- Android Service完全解析,关于服务你所需知道的一切
- Android主界面连续两次点击物理返回键退出应用功能实现
- 创建Android启动界面
- android 计算所在周所在月的前后日期
- 【Android】ListView淡入动画效果的实现
- android开发中遇到的问题解决之RelativeLayout执行measure(w,h)方法时,出现NullPointerException的异常情况
- Android-Universal-Image-Loader 参数
- android 清除缓存功能
- Android中的Handler机制
- Android 高手进阶,自定义圆形进度条
- 定时器,Handler,Thread,Runnable的使用简介
- Android Contacts (android通讯录读取)-content provider
- Android获取电话号码的实例