OSDN Git Service

am de0f30cd: am cd7ef9ce: am 8359d2c4: am b7f96375: docs: fix ::selection style to...
[android-x86/build.git] / core / pdk_config.mk
1 # This file defines the rule to fuse the platform.zip into the current PDK build.
2
3 .PHONY: pdk fusion
4 pdk fusion: $(DEFAULT_GOAL)
5
6 # What to build:
7 # pdk fusion if:
8 # 1) PDK_FUSION_PLATFORM_ZIP is passed in from the environment
9 # or
10 # 2) the platform.zip exists in the default location
11 # or
12 # 3) fusion is a command line build goal,
13 #    PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal?
14 # otherwise pdk only if:
15 # 1) pdk is a command line build goal
16 # or
17 # 2) TARGET_BUILD_PDK is passed in from the environment
18
19 # if PDK_FUSION_PLATFORM_ZIP is specified, do not override.
20 ifndef PDK_FUSION_PLATFORM_ZIP
21 _pdk_fusion_default_platform_zip := vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip
22 ifneq (,$(wildcard $(_pdk_fusion_default_platform_zip)))
23 $(info $(_pdk_fusion_default_platform_zip) found, do a PDK fusion build.)
24 PDK_FUSION_PLATFORM_ZIP := $(_pdk_fusion_default_platform_zip)
25 TARGET_BUILD_PDK := true
26 endif
27 endif # !PDK_FUSION_PLATFORM_ZIP
28
29 ifneq (,$(filter pdk fusion, $(MAKECMDGOALS)))
30 TARGET_BUILD_PDK := true
31 ifneq (,$(filter fusion, $(MAKECMDGOALS)))
32 ifndef PDK_FUSION_PLATFORM_ZIP
33   $(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.)
34 endif
35 endif  # fusion
36 endif  # pdk or fusion
37
38 ifneq (,$(filter platform-java, $(MAKECMDGOALS))$(PDK_FUSION_PLATFORM_ZIP))
39 # additional items to add to platform.zip for platform-java build
40 # For these dirs, add classes.jar and javalib.jar from the dir to platform.zip
41 # all paths under out dir
42 PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR := \
43         target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates \
44         target/common/obj/JAVA_LIBRARIES/core_intermediates \
45         target/common/obj/JAVA_LIBRARIES/core-junit_intermediates \
46         target/common/obj/JAVA_LIBRARIES/ext_intermediates \
47         target/common/obj/JAVA_LIBRARIES/framework_intermediates \
48         target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates \
49         target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \
50         target/common/obj/JAVA_LIBRARIES/voip-common_intermediates \
51         target/common/obj/JAVA_LIBRARIES/mms-common_intermediates
52 # not java libraries
53 PDK_PLATFORM_JAVA_ZIP_CONTENTS := \
54         target/common/obj/APPS/framework-res_intermediates/package-export.apk \
55         target/common/obj/APPS/framework-res_intermediates/src/R.stamp
56 PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
57     $(lib_dir)/classes.jar $(lib_dir)/javalib.jar)
58 endif # platform-java or FUSION build
59
60 # check and override java support level
61 ifneq ($(TARGET_BUILD_PDK)$(PDK_FUSION_PLATFORM_ZIP),)
62 ifneq ($(wildcard external/proguard),)
63 TARGET_BUILD_JAVA_SUPPORT_LEVEL := sdk
64 else # no proguard
65 TARGET_BUILD_JAVA_SUPPORT_LEVEL :=
66 endif
67 # platform supprot is set after checking platform.zip
68 endif # PDK
69
70 ifdef PDK_FUSION_PLATFORM_ZIP
71 TARGET_BUILD_PDK := true
72 ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP)))
73   $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).)
74 endif
75
76 _pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion)
77 _pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp
78
79 _pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) \
80     '*[^/]' -x 'target/common/*' 2>/dev/null)
81 _pdk_fusion_java_file_list := \
82         $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null)
83 _pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\
84     $(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list))
85
86 ifneq ($(_pdk_fusion_java_file_list),)
87 # This represents whether java build can use platform API or not
88 # This should not be used in Android.mk
89 TARGET_BUILD_PDK_JAVA_PLATFORM := true
90 ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),)
91 TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
92 endif
93 endif
94
95 $(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
96         @echo "Unzip $(dir $@) <- $<"
97         $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
98         $(hide) unzip -qo $< -d $(dir $@)
99         $(call split-long-arguments,-touch,$(_pdk_fusion_files))
100         $(hide) touch $@
101
102
103 $(_pdk_fusion_files) : $(_pdk_fusion_stamp)
104
105
106 # Implicit pattern rules to copy the fusion files to the system image directory.
107 # Note that if there is already explicit rule in the build system to generate a file,
108 # the pattern rule will be just ignored by make.
109 # That's desired by us: we want only absent files from the platform zip package.
110 # Copy with the last-modified time preserved, never follow symbolic links.
111 $(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% $(_pdk_fusion_stamp)
112         @mkdir -p $(dir $@)
113         $(hide) rm -rf $@
114         $(hide) cp -fpPR $< $@
115
116 ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM))
117
118 define JAVA_dependency_template
119 $(OUT_DIR)/$(strip $(1)): $(_pdk_fusion_intermediates)/$(strip $(1)) $(OUT_DIR)/$(strip $(2)) \
120   $(_pdk_fusion_stamp)
121         @mkdir -p $$(dir $$@)
122         $(hide) cp -fpPR $$< $$@
123 endef
124
125 # needs explicit dependency as package-export.apk is not explicitly pulled
126 $(eval $(call JAVA_dependency_template,\
127 target/common/obj/APPS/framework-res_intermediates/src/R.stamp,\
128 target/common/obj/APPS/framework-res_intermediates/package-export.apk))
129
130 # javalib.jar should pull classes.jar as classes.jar is not explicitly pulled.
131 $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
132 $(eval $(call JAVA_dependency_template,$(lib_dir)/javalib.jar,\
133 $(lib_dir)/classes.jar)))
134
135 # implicit rules for all others
136 $(TARGET_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/target/common/% $(_pdk_fusion_stamp)
137         @mkdir -p $(dir $@)
138         $(hide) cp -fpPR $< $@
139 endif
140
141 ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
142
143 endif # PDK_FUSION_PLATFORM_ZIP
144
145 ifeq ($(TARGET_BUILD_PDK),true)
146 $(info PDK TARGET_BUILD_JAVA_SUPPORT_LEVEL $(TARGET_BUILD_JAVA_SUPPORT_LEVEL))
147 ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
148
149 # SDK used for Java build under PDK
150 PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS))
151 $(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION))
152
153 else # PDK_JAVA
154
155 $(info PDK Build uses the current platform API)
156
157 endif # PDK_JAVA
158
159 endif # BUILD_PDK
160
161 ifneq (,$(filter platform platform-java, $(MAKECMDGOALS))$(filter true,$(TARGET_BUILD_PDK)))
162 # files under $(PRODUCT_OUT)/symbols to help debugging.
163 # Source not included to PDK due to dependency issue, so provide symbols instead.
164 PDK_SYMBOL_FILES_LIST := \
165         system/bin/app_process
166
167 ifdef PDK_FUSION_PLATFORM_ZIP
168 # symbols should be explicitly pulled for fusion build
169 $(foreach f,$(PDK_SYMBOL_FILES_LIST),\
170   $(eval $(call add-dependency,$(PRODUCT_OUT)/$(f),$(PRODUCT_OUT)/symbols/$(f))))
171 endif # PLATFORM_ZIP
172 endif # platform.zip build or PDK