Makefile revision 38d7f02c50aae9b1578b575cf6dd12d73249368a
1# Put some miscellaneous rules here 2 3# Pick a reasonable string to use to identify files. 4ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" 5 # BUILD_NUMBER has a timestamp in it, which means that 6 # it will change every time. Pick a stable value. 7 FILE_NAME_TAG := eng.$(USER) 8else 9 FILE_NAME_TAG := $(BUILD_NUMBER) 10endif 11 12# ----------------------------------------------------------------- 13# Define rules to copy PRODUCT_COPY_FILES defined by the product. 14# PRODUCT_COPY_FILES contains words like <source file>:<dest file>. 15# <dest file> is relative to $(PRODUCT_OUT), so it should look like, 16# e.g., "system/etc/file.xml". 17# The filter part means "only eval the copy-one-file rule if this 18# src:dest pair is the first one to match %:dest" 19$(foreach cf,$(PRODUCT_COPY_FILES), \ 20 $(eval _src := $(call word-colon,1,$(cf))) \ 21 $(eval _dest := $(call word-colon,2,$(cf))) \ 22 $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \ 23 $(if $(filter $(_src):$(_dest),$(firstword $(filter %:$(_dest),$(PRODUCT_COPY_FILES)))), \ 24 $(eval $(call copy-one-file,$(_src),$(_fulldest))),) \ 25 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \ 26 ) 27 28# ----------------------------------------------------------------- 29# docs/index.html 30gen := $(OUT_DOCS)/index.html 31ALL_DOCS += $(gen) 32$(gen): frameworks/base/docs/docs-redirect-index.html 33 @mkdir -p $(dir $@) 34 @cp -f $< $@ 35 36# ----------------------------------------------------------------- 37# default.prop 38INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop 39ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET) 40ADDITIONAL_DEFAULT_PROPERTIES := \ 41 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) 42 43$(INSTALLED_DEFAULT_PROP_TARGET): 44 @echo Target buildinfo: $@ 45 @mkdir -p $(dir $@) 46 $(hide) echo "#" > $@; \ 47 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \ 48 echo "#" >> $@; 49 $(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \ 50 echo "$(line)" >> $@;) 51 52# ----------------------------------------------------------------- 53# build.prop 54INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop 55ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET) 56ADDITIONAL_BUILD_PROPERTIES := \ 57 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES)) 58 59# A list of arbitrary tags describing the build configuration. 60# Force ":=" so we can use += 61BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS) 62ifeq ($(TARGET_BUILD_TYPE),debug) 63 BUILD_VERSION_TAGS += debug 64endif 65# Apps are always signed with test keys, and may be re-signed in a post-build 66# step. If that happens, the "test-keys" tag will be removed by that step. 67BUILD_VERSION_TAGS += test-keys 68BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) 69 70# A human-readable string that descibes this build in detail. 71build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS) 72$(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc) 73 74# The string used to uniquely identify this build; used by the OTA server. 75ifeq (,$(strip $(BUILD_FINGERPRINT))) 76 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE)/$(TARGET_BOOTLOADER_BOARD_NAME):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) 77endif 78ifneq ($(words $(BUILD_FINGERPRINT)),1) 79 $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") 80endif 81 82# Display parameters shown under Settings -> About Phone 83ifeq ($(TARGET_BUILD_VARIANT),user) 84 # User builds should show: 85 # release build number or branch.buld_number non-release builds 86 87 # Dev. branches should have DISPLAY_BUILD_NUMBER set 88 ifeq "true" "$(DISPLAY_BUILD_NUMBER)" 89 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER) 90 else 91 BUILD_DISPLAY_ID := $(BUILD_ID) 92 endif 93else 94 # Non-user builds should show detailed build information 95 BUILD_DISPLAY_ID := $(build_desc) 96endif 97 98# Whether there is default locale set in PRODUCT_PROPERTY_OVERRIDES 99product_property_override_locale_language := $(strip \ 100 $(patsubst ro.product.locale.language=%,%,\ 101 $(filter ro.product.locale.language=%,$(PRODUCT_PROPERTY_OVERRIDES)))) 102product_property_overrides_locale_region := $(strip \ 103 $(patsubst ro.product.locale.region=%,%,\ 104 $(filter ro.product.locale.region=%,$(PRODUCT_PROPERTY_OVERRIDES)))) 105 106# Selects the first locale in the list given as the argument, 107# and splits it into language and region, which each may be 108# empty. 109define default-locale 110$(subst _, , $(firstword $(1))) 111endef 112 113# Selects the first locale in the list given as the argument 114# and returns the language (or the region), if it's not set in PRODUCT_PROPERTY_OVERRIDES; 115# Return empty string if it's already set in PRODUCT_PROPERTY_OVERRIDES. 116define default-locale-language 117$(if $(product_property_override_locale_language),,$(word 1, $(call default-locale, $(1)))) 118endef 119define default-locale-region 120$(if $(product_property_overrides_locale_region),,$(word 2, $(call default-locale, $(1)))) 121endef 122 123BUILDINFO_SH := build/tools/buildinfo.sh 124$(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(wildcard $(TARGET_DEVICE_DIR)/system.prop) 125 @echo Target buildinfo: $@ 126 @mkdir -p $(dir $@) 127 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ 128 TARGET_DEVICE="$(TARGET_DEVICE)" \ 129 PRODUCT_NAME="$(TARGET_PRODUCT)" \ 130 PRODUCT_BRAND="$(PRODUCT_BRAND)" \ 131 PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \ 132 PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \ 133 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \ 134 PRODUCT_MODEL="$(PRODUCT_MODEL)" \ 135 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \ 136 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \ 137 BUILD_ID="$(BUILD_ID)" \ 138 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \ 139 BUILD_NUMBER="$(BUILD_NUMBER)" \ 140 PLATFORM_VERSION="$(PLATFORM_VERSION)" \ 141 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ 142 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ 143 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ 144 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \ 145 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \ 146 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \ 147 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \ 148 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \ 149 bash $(BUILDINFO_SH) > $@ 150 $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \ 151 cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \ 152 fi 153 $(if $(ADDITIONAL_BUILD_PROPERTIES), \ 154 $(hide) echo >> $@; \ 155 echo "#" >> $@; \ 156 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \ 157 echo "#" >> $@; ) 158 $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \ 159 echo "$(line)" >> $@;) 160 161build_desc := 162 163# ----------------------------------------------------------------- 164# sdk-build.prop 165# 166# There are certain things in build.prop that we don't want to 167# ship with the sdk; remove them. 168 169# This must be a list of entire property keys followed by 170# "=" characters, without any internal spaces. 171sdk_build_prop_remove := \ 172 ro.build.user= \ 173 ro.build.host= \ 174 ro.product.brand= \ 175 ro.product.manufacturer= \ 176 ro.product.device= 177# TODO: Remove this soon-to-be obsolete property 178sdk_build_prop_remove += ro.build.product= 179INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop 180$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET) 181 @echo SDK buildinfo: $@ 182 @mkdir -p $(dir $@) 183 $(hide) grep -v "$(subst $(space),\|,$(strip \ 184 $(sdk_build_prop_remove)))" $< > $@.tmp 185 $(hide) for x in $(sdk_build_prop_remove); do \ 186 echo "$$x"generic >> $@.tmp; done 187 $(hide) mv $@.tmp $@ 188 189# ----------------------------------------------------------------- 190# package stats 191PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt 192PACKAGES_TO_STAT := \ 193 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \ 194 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES)))) 195$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT) 196 @echo Package stats: $@ 197 @mkdir -p $(dir $@) 198 $(hide) rm -f $@ 199 $(hide) build/tools/dump-package-stats $^ > $@ 200 201.PHONY: package-stats 202package-stats: $(PACKAGE_STATS_FILE) 203 204# ----------------------------------------------------------------- 205# Cert-to-package mapping. Used by the post-build signing tools. 206name := $(TARGET_PRODUCT) 207ifeq ($(TARGET_BUILD_TYPE),debug) 208 name := $(name)_debug 209endif 210name := $(name)-apkcerts-$(FILE_NAME_TAG) 211intermediates := \ 212 $(call intermediates-dir-for,PACKAGING,apkcerts) 213APKCERTS_FILE := $(intermediates)/$(name).txt 214# Depending on the built packages isn't exactly right, 215# but it should guarantee that the apkcerts file is rebuilt 216# if any packages change which certs they're signed with. 217all_built_packages := $(foreach p,$(PACKAGES),$(ALL_MODULES.$(p).BUILT)) 218$(APKCERTS_FILE): $(all_built_packages) 219 @echo APK certs list: $@ 220 @mkdir -p $(dir $@) 221 @rm -f $@ 222 $(hide) $(foreach p,$(PACKAGES),\ 223 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\ 224 echo 'name="$(p).apk" certificate="EXTERNAL" \ 225 private_key=""' >> $@;,\ 226 echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \ 227 private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;)) 228 229.PHONY: apkcerts-list 230apkcerts-list: $(APKCERTS_FILE) 231 232# ----------------------------------------------------------------- 233# module info file 234ifdef CREATE_MODULE_INFO_FILE 235 MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt 236 $(info Generating $(MODULE_INFO_FILE)...) 237 $(shell rm -f $(MODULE_INFO_FILE)) 238 $(foreach m,$(ALL_MODULES), \ 239 $(shell echo "NAME=\"$(m)\"" \ 240 "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \ 241 "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \ 242 "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \ 243 "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE))) 244endif 245 246# ----------------------------------------------------------------- 247 248# The test key is used to sign this package, and as the key required 249# for future OTA packages installed by this system. Actual product 250# deliverables will be re-signed by hand. We expect this file to 251# exist with the suffixes ".x509.pem" and ".pk8". 252DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey 253 254 255# Rules that need to be present for the simulator, even 256# if they don't do anything. 257.PHONY: systemimage 258systemimage: 259 260# ----------------------------------------------------------------- 261 262.PHONY: event-log-tags 263 264# Produce an event logs tag file for everything we know about, in order 265# to properly allocate numbers. Then produce a file that's filtered 266# for what's going to be installed. 267 268all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt 269 270# Include tags from all packages that we know about 271all_event_log_tags_src := \ 272 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS))) 273 274$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src) 275$(all_event_log_tags_file): $(all_event_log_tags_src) 276 $(hide) mkdir -p $(dir $@) 277 $(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES) 278 279 280event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags 281 282# Include tags from all packages included in this product. 283event_log_tags_src := \ 284 $(sort $(foreach m,\ 285 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \ 286 $(call module-names-for-tag-list,user), \ 287 $(ALL_MODULES.$(m).EVENT_LOG_TAGS))) 288 289$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) 290$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file) 291$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file) 292 $(hide) mkdir -p $(dir $@) 293 $(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES) 294 295event-log-tags: $(event_log_tags_file) 296 297ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file) 298 299 300ifneq ($(TARGET_SIMULATOR),true) 301 302# ################################################################# 303# Targets for boot/OS images 304# ################################################################# 305 306# ----------------------------------------------------------------- 307# the ramdisk 308INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \ 309 $(ALL_PREBUILT) \ 310 $(ALL_COPIED_HEADERS) \ 311 $(ALL_GENERATED_SOURCES) \ 312 $(ALL_DEFAULT_INSTALLED_MODULES)) 313 314BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img 315 316# We just build this directly to the install location. 317INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET) 318$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP) 319 $(call pretty,"Target ram disk: $@") 320 $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@ 321 322 323ifneq ($(strip $(TARGET_NO_KERNEL)),true) 324 325# ----------------------------------------------------------------- 326# the boot image, which is a collection of other images. 327INTERNAL_BOOTIMAGE_ARGS := \ 328 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ 329 --kernel $(INSTALLED_KERNEL_TARGET) \ 330 --ramdisk $(INSTALLED_RAMDISK_TARGET) 331 332INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS)) 333 334BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE)) 335ifdef BOARD_KERNEL_CMDLINE 336 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" 337endif 338 339BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE)) 340ifdef BOARD_KERNEL_BASE 341 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) 342endif 343 344INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img 345 346ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true) 347tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg 348INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image) 349INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG) 350$(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES) 351 $(call pretty,"Target boot image: $@") 352 $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@ 353 354else # TARGET_BOOTIMAGE_USE_EXT2 != true 355 356$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) 357 $(call pretty,"Target boot image: $@") 358 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@ 359 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw) 360endif # TARGET_BOOTIMAGE_USE_EXT2 361 362else # TARGET_NO_KERNEL 363# HACK: The top-level targets depend on the bootimage. Not all targets 364# can produce a bootimage, though, and emulator targets need the ramdisk 365# instead. Fake it out by calling the ramdisk the bootimage. 366# TODO: make the emulator use bootimages, and make mkbootimg accept 367# kernel-less inputs. 368INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET) 369endif 370 371# ----------------------------------------------------------------- 372# NOTICE files 373# 374# This needs to be before the systemimage rules, because it adds to 375# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files 376# go into the systemimage. 377 378.PHONY: notice_files 379 380# Create the rule to combine the files into text and html forms 381# $(1) - Plain text output file 382# $(2) - HTML output file 383# $(3) - File title 384# $(4) - Directory to use. Notice files are all $(4)/src. Other 385# directories in there will be used for scratch 386# $(5) - Dependencies for the output files 387# 388# The algorithm here is that we go collect a hash for each of the notice 389# files and write the names of the files that match that hash. Then 390# to generate the real files, we go print out all of the files and their 391# hashes. 392# 393# These rules are fairly complex, so they depend on this makefile so if 394# it changes, they'll run again. 395# 396# TODO: We could clean this up so that we just record the locations of the 397# original notice files instead of making rules to copy them somwehere. 398# Then we could traverse that without quite as much bash drama. 399define combine-notice-files 400$(1) $(2): PRIVATE_MESSAGE := $(3) 401$(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4) 402$(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile 403 @echo Finding NOTICE files: $$@ 404 $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash 405 $$(hide) mkdir -p $$(PRIVATE_DIR)/hash 406 $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \ 407 hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \ 408 hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \ 409 echo $$$$file >> $$$$hashfile; \ 410 done 411 $$(hide) touch $$@ 412$(1): $(4)/hash-timestamp 413 @echo Combining NOTICE files: $$@ 414 $$(hide) mkdir -p $$(dir $$@) 415 $$(hide) echo $$(PRIVATE_MESSAGE) > $$@ 416 $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \ 417 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> $$@ 418 $$(hide) echo >> $$@ 419 $$(hide) echo >> $$@ 420 $$(hide) echo >> $$@ 421 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \ 422 echo "============================================================"\ 423 >> $$@; \ 424 echo "Notices for file(s):" >> $$@; \ 425 cat $$$$hashfile | sort | \ 426 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> \ 427 $$@; \ 428 echo "------------------------------------------------------------"\ 429 >> $$@; \ 430 echo >> $$@; \ 431 orig=$$$$(head -n 1 $$$$hashfile); \ 432 cat $$$$orig >> $$@; \ 433 echo >> $$@; \ 434 echo >> $$@; \ 435 echo >> $$@; \ 436 done 437$(2): $(4)/hash-timestamp 438 @echo Combining NOTICE files: $$@ 439 $$(hide) mkdir -p $$(dir $$@) 440 $$(hide) echo "<html><head>" > $$@ 441 $$(hide) echo "<style type=\"text/css\">" >> $$@ 442 $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@ 443 $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@ 444 $$(hide) echo ".label { font-weight: bold; }" >> $$@ 445 $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@ 446 $$(hide) echo "</style>" >> $$@ 447 $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@ 448 $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \ 449 >> $$@ 450 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \ 451 cat $$$$hashfile | sort | \ 452 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: <a name=\"\1\"></a>:" >> \ 453 $$@; \ 454 echo "<tr><td class=\"same-license\">" >> $$@; \ 455 echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \ 456 echo "<div class=\"file-list\">" >> $$@; \ 457 cat $$$$hashfile | sort | \ 458 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1<br/>:" >> $$@; \ 459 echo "</div><!-- file-list -->" >> $$@; \ 460 echo >> $$@; \ 461 orig=$$$$(head -n 1 $$$$hashfile); \ 462 echo "<pre class=\"license-text\">" >> $$@; \ 463 cat $$$$orig | sed -e "s/\&/\&/g" | sed -e "s/</\</g" \ 464 | sed -e "s/>/\>/g" >> $$@; \ 465 echo "</pre><!-- license-text -->" >> $$@; \ 466 echo "</td></tr><!-- same-license -->" >> $$@; \ 467 echo >> $$@; \ 468 echo >> $$@; \ 469 echo >> $$@; \ 470 done 471 $$(hide) echo "</table>" >> $$@ 472 $$(hide) echo "</body></html>" >> $$@ 473notice_files: $(1) $(2) 474endef 475 476# TODO These intermediate NOTICE.txt/NOTICE.html files should go into 477# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from 478# the src subdirectory. 479 480target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt 481target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html 482target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz 483tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt 484tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html 485 486kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt 487 488$(eval $(call combine-notice-files, \ 489 $(target_notice_file_txt), \ 490 $(target_notice_file_html), \ 491 "Notices for files contained in the filesystem images in this directory:", \ 492 $(TARGET_OUT_NOTICE_FILES), \ 493 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file))) 494 495$(eval $(call combine-notice-files, \ 496 $(tools_notice_file_txt), \ 497 $(tools_notice_file_html), \ 498 "Notices for files contained in the tools directory:", \ 499 $(HOST_OUT_NOTICE_FILES), \ 500 $(ALL_DEFAULT_INSTALLED_MODULES))) 501 502# Install the html file at /system/etc/NOTICE.html.gz. 503# This is not ideal, but this is very late in the game, after a lot of 504# the module processing has already been done -- in fact, we used the 505# fact that all that has been done to get the list of modules that we 506# need notice files for. 507$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP) 508 $(hide) $(MINIGZIP) -9 < $< > $@ 509installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz 510$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP) 511 $(copy-file-to-target) 512 513# if we've been run my mm, mmm, etc, don't reinstall this every time 514ifeq ($(ONE_SHOT_MAKEFILE),) 515ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz) 516endif 517 518# The kernel isn't really a module, so to get its module file in there, we 519# make the target NOTICE files depend on this particular file too, which will 520# then be in the right directory for the find in combine-notice-files to work. 521$(kernel_notice_file): \ 522 prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \ 523 | $(ACP) 524 @echo Copying: $@ 525 $(hide) mkdir -p $(dir $@) 526 $(hide) $(ACP) $< $@ 527 528 529# ----------------------------------------------------------------- 530# Build a keystore with the authorized keys in it, used to verify the 531# authenticity of downloaded OTA packages. 532# 533# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come 534# before the rules that use that variable to build the image. 535ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip 536$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) 537$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR)) 538 $(hide) rm -f $@ 539 $(hide) mkdir -p $(dir $@) 540 $(hide) zip -qj $@ $< 541 542.PHONY: otacerts 543otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip 544 545 546# ################################################################# 547# Targets for user images 548# ################################################################# 549 550INTERNAL_USERIMAGES_EXT_VARIANT := 551ifeq ($(TARGET_USERIMAGES_USE_EXT2),true) 552INTERNAL_USERIMAGES_USE_EXT := true 553INTERNAL_USERIMAGES_EXT_VARIANT := ext2 554else 555ifeq ($(TARGET_USERIMAGES_USE_EXT3),true) 556INTERNAL_USERIMAGES_USE_EXT := true 557INTERNAL_USERIMAGES_EXT_VARIANT := ext3 558else 559ifeq ($(TARGET_USERIMAGES_USE_EXT4),true) 560INTERNAL_USERIMAGES_USE_EXT := true 561INTERNAL_USERIMAGES_EXT_VARIANT := ext4 562endif 563endif 564endif 565 566ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) 567INTERNAL_USERIMAGES_DEPS := $(MKEXT2USERIMG) $(MKEXT2IMG) $(TUNE2FS) $(E2FSCK) 568INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS))) 569 570# $(1): src directory 571# $(2): output file 572# $(3): label (if any) 573# $(4): ext variant (ext2, ext3, ext4) 574define build-userimage-ext-target 575 @mkdir -p $(dir $(2)) 576 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$(PATH) \ 577 $(MKEXT2USERIMG) $(1) $(2) $(4) $(3) 578endef 579else 580INTERNAL_USERIMAGES_DEPS := $(MKYAFFS2) 581endif 582 583# ----------------------------------------------------------------- 584# Recovery image 585 586# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true 587ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID))) 588 589INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img 590 591recovery_initrc := $(call include-path-for, recovery)/etc/init.rc 592recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system 593recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img 594recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET) 595recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery 596recovery_resources_common := $(call include-path-for, recovery)/res 597recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)) 598recovery_resource_deps := $(shell find $(recovery_resources_common) \ 599 $(recovery_resources_private) -type f) 600 601ifeq ($(recovery_resources_private),) 602 $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE)) 603endif 604 605INTERNAL_RECOVERYIMAGE_ARGS := \ 606 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ 607 --kernel $(recovery_kernel) \ 608 --ramdisk $(recovery_ramdisk) 609 610# Assumes this has already been stripped 611ifdef BOARD_KERNEL_CMDLINE 612 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" 613endif 614ifdef BOARD_KERNEL_BASE 615 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) 616endif 617 618# Keys authorized to sign OTA packages this build will accept. The 619# build always uses test-keys for this; release packaging tools will 620# substitute other keys for this one. 621OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem 622 623# Generate a file containing the keys that will be read by the 624# recovery binary. 625RECOVERY_INSTALL_OTA_KEYS := \ 626 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys 627DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar 628$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS) 629$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) 630 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)" 631 @rm -rf $@ 632 @mkdir -p $(dir $@) 633 java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@ 634 635$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ 636 $(INSTALLED_RAMDISK_TARGET) \ 637 $(INSTALLED_BOOTIMAGE_TARGET) \ 638 $(recovery_binary) \ 639 $(recovery_initrc) $(recovery_kernel) \ 640 $(INSTALLED_2NDBOOTLOADER_TARGET) \ 641 $(recovery_build_prop) $(recovery_resource_deps) \ 642 $(RECOVERY_INSTALL_OTA_KEYS) 643 @echo ----- Making recovery image ------ 644 rm -rf $(TARGET_RECOVERY_OUT) 645 mkdir -p $(TARGET_RECOVERY_OUT) 646 mkdir -p $(TARGET_RECOVERY_ROOT_OUT) 647 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc 648 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp 649 echo Copying baseline ramdisk... 650 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) 651 rm $(TARGET_RECOVERY_ROOT_OUT)/init*.rc 652 echo Modifying ramdisk contents... 653 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/ 654 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/ 655 cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/ 656 $(foreach item,$(recovery_resources_private), \ 657 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/) 658 cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys 659 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \ 660 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop 661 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk) 662 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@ 663 @echo ----- Made recovery image -------- $@ 664 $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw) 665 666else 667INSTALLED_RECOVERYIMAGE_TARGET := 668endif 669 670.PHONY: recoveryimage 671recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) 672 673ifneq ($(BOARD_NAND_PAGE_SIZE),) 674mkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE) 675else 676mkyaffs2_extra_flags := 677endif 678 679 680# ----------------------------------------------------------------- 681# system yaffs image 682# 683# First, the "unoptimized" image, which contains .apk/.jar files 684# that contain regular, unoptimized/unverified .dex entries. 685# 686systemimage_unopt_intermediates := \ 687 $(call intermediates-dir-for,PACKAGING,systemimage_unopt) 688BUILT_SYSTEMIMAGE_UNOPT := $(systemimage_unopt_intermediates)/system.img 689 690INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \ 691 $(ALL_PREBUILT) \ 692 $(ALL_COPIED_HEADERS) \ 693 $(ALL_GENERATED_SOURCES) \ 694 $(ALL_DEFAULT_INSTALLED_MODULES)) 695 696ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) 697## generate an ext image 698# $(1): output file 699define build-systemimage-target 700 @echo "Target system fs image: $(1)" 701 $(call build-userimage-ext-target,$(TARGET_OUT),$(1),system,$(INTERNAL_USERIMAGES_EXT_VARIANT)) 702endef 703 704else # INTERNAL_USERIMAGES_USE_EXT != true 705 706## generate a yaffs2 image 707# $(1): output file 708define build-systemimage-target 709 @echo "Target system fs image: $(1)" 710 @mkdir -p $(dir $(1)) 711 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1) 712endef 713endif # INTERNAL_USERIMAGES_USE_EXT 714 715$(BUILT_SYSTEMIMAGE_UNOPT): $(INTERNAL_SYSTEMIMAGE_FILES) \ 716 $(INTERNAL_USERIMAGES_DEPS) 717 $(call build-systemimage-target,$@) 718 719# The installed image, which may be optimized or unoptimized. 720# 721INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img 722 723ifdef WITH_DEXPREOPT 724 ifndef DISABLE_DEXPREOPT 725 with_dexpreopt := true 726 endif 727endif 728ifdef with_dexpreopt 729 # This file will set BUILT_SYSTEMIMAGE and SYSTEMIMAGE_SOURCE_DIR 730 include build/tools/dexpreopt/Config.mk 731else 732 BUILT_SYSTEMIMAGE := $(BUILT_SYSTEMIMAGE_UNOPT) 733 SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) 734endif 735 736# The system partition needs room for the recovery image as well. We 737# now store the recovery image as a binary patch using the boot image 738# as the source (since they are very similar). Generate the patch so 739# we can see how big it's going to be, and include that in the system 740# image size check calculation. 741ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) 742intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch) 743RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p 744$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \ 745 $(INSTALLED_BOOTIMAGE_TARGET) \ 746 $(HOST_OUT_EXECUTABLES)/imgdiff \ 747 $(HOST_OUT_EXECUTABLES)/bsdiff 748 @echo "Construct recovery from boot" 749 mkdir -p $(dir $@) 750 PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@ 751endif 752 753 754$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP) 755 @echo "Install system fs image: $@" 756 $(copy-file-to-target) 757 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs) 758 759systemimage: $(INSTALLED_SYSTEMIMAGE) 760 761.PHONY: systemimage-nodeps snod 762systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \ 763 | $(INTERNAL_USERIMAGES_DEPS) 764 @echo "make $@: ignoring dependencies" 765 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE)) 766 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs) 767 768####### 769## system tarball 770define build-systemtarball-target 771 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)") 772 $(MKTARBALL) $(FS_GET_STATS) \ 773 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \ 774 $(INSTALLED_SYSTEMTARBALL_TARGET) 775endef 776 777ifndef SYSTEM_TARBALL_FORMAT 778 SYSTEM_TARBALL_FORMAT := bz2 779endif 780 781system_tar := $(PRODUCT_OUT)/system.tar 782INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT) 783$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar) 784$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES) 785 $(build-systemtarball-target) 786 787.PHONY: systemtarball-nodeps 788systemtarball-nodeps: $(FS_GET_STATS) \ 789 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS)) 790 $(build-systemtarball-target) 791 792.PHONY: stnod 793stnod: systemtarball-nodeps 794 795 796####### 797## boot tarball 798define build-boottarball-target 799 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)" 800 $(hide) mkdir -p $(PRODUCT_OUT)/boot 801 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/. 802 $(hide) echo $(BOARD_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline 803 $(hide) $(MKTARBALL) $(FS_GET_STATS) \ 804 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \ 805 $(INSTALLED_BOOTTARBALL_TARGET) 806endef 807 808ifndef BOOT_TARBALL_FORMAT 809 BOOT_TARBALL_FORMAT := bz2 810endif 811 812boot_tar := $(PRODUCT_OUT)/boot.tar 813INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT) 814$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar) 815$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES) 816 $(build-boottarball-target) 817 818.PHONY: boottarball-nodeps btnod 819boottarball-nodeps btnod: $(FS_GET_STATS) \ 820 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS)) 821 $(build-boottarball-target) 822 823 824# ----------------------------------------------------------------- 825# data partition image 826INTERNAL_USERDATAIMAGE_FILES := \ 827 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) 828 829ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) 830## Generate an ext2 image 831define build-userdataimage-target 832 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") 833 @mkdir -p $(TARGET_OUT_DATA) 834 $(call build-userimage-ext-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),userdata,$(INTERNAL_USERIMAGES_EXT_VARIANT)) 835 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs) 836endef 837 838else # INTERNAL_USERIMAGES_USE_EXT != true 839 840## Generate a yaffs2 image 841define build-userdataimage-target 842 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") 843 @mkdir -p $(TARGET_OUT_DATA) 844 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET) 845 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs) 846endef 847endif # INTERNAL_USERIMAGES_USE_EXT 848 849BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img 850 851# We just build this directly to the install location. 852INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET) 853$(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) \ 854 $(INTERNAL_USERDATAIMAGE_FILES) 855 $(build-userdataimage-target) 856 857.PHONY: userdataimage-nodeps 858userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) 859 $(build-userdataimage-target) 860 861####### 862## data partition tarball 863define build-userdatatarball-target 864 $(call pretty,"Target userdata fs tarball: " \ 865 "$(INSTALLED_USERDATATARBALL_TARGET)") 866 $(MKTARBALL) $(FS_GET_STATS) \ 867 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \ 868 $(INSTALLED_USERDATATARBALL_TARGET) 869endef 870 871userdata_tar := $(PRODUCT_OUT)/userdata.tar 872INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2 873$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar) 874$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES) 875 $(build-userdatatarball-target) 876 877.PHONY: userdatatarball-nodeps 878userdatatarball-nodeps: $(FS_GET_STATS) 879 $(build-userdatatarball-target) 880 881 882# ----------------------------------------------------------------- 883# bring in the installer image generation defines if necessary 884ifeq ($(TARGET_USE_DISKINSTALLER),true) 885include bootable/diskinstaller/config.mk 886endif 887 888# ----------------------------------------------------------------- 889# host tools needed to build OTA packages 890 891OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \ 892 $(HOST_OUT_EXECUTABLES)/mkbootfs \ 893 $(HOST_OUT_EXECUTABLES)/mkbootimg \ 894 $(HOST_OUT_EXECUTABLES)/fs_config \ 895 $(HOST_OUT_EXECUTABLES)/mkyaffs2image \ 896 $(HOST_OUT_EXECUTABLES)/zipalign \ 897 $(HOST_OUT_EXECUTABLES)/aapt \ 898 $(HOST_OUT_EXECUTABLES)/bsdiff \ 899 $(HOST_OUT_EXECUTABLES)/imgdiff \ 900 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \ 901 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \ 902 $(HOST_OUT_EXECUTABLES)/mkuserimg.sh \ 903 $(HOST_OUT_EXECUTABLES)/genext2fs \ 904 $(HOST_OUT_EXECUTABLES)/tune2fs \ 905 $(HOST_OUT_EXECUTABLES)/e2fsck 906 907 908.PHONY: otatools 909otatools: $(OTATOOLS) 910 911# ----------------------------------------------------------------- 912# A zip of the directories that map to the target filesystem. 913# This zip can be used to create an OTA package or filesystem image 914# as a post-build step. 915# 916name := $(TARGET_PRODUCT) 917ifeq ($(TARGET_BUILD_TYPE),debug) 918 name := $(name)_debug 919endif 920name := $(name)-target_files-$(FILE_NAME_TAG) 921 922intermediates := $(call intermediates-dir-for,PACKAGING,target_files) 923BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip 924$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates) 925$(BUILT_TARGET_FILES_PACKAGE): \ 926 zip_root := $(intermediates)/$(name) 927 928# $(1): Directory to copy 929# $(2): Location to copy it to 930# The "ls -A" is to prevent "acp s/* d" from failing if s is empty. 931define package_files-copy-root 932 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \ 933 mkdir -p $(2) && \ 934 $(ACP) -rd $(strip $(1))/* $(2); \ 935 fi 936endef 937 938built_ota_tools := \ 939 $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \ 940 $(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \ 941 $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \ 942 $(call intermediates-dir-for,EXECUTABLES,updater)/updater 943$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools) 944 945$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION) 946 947ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),) 948# default to common dir for device vendor 949$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common 950else 951$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) 952endif 953 954# Depending on the various images guarantees that the underlying 955# directories are up-to-date. 956$(BUILT_TARGET_FILES_PACKAGE): \ 957 $(INSTALLED_BOOTIMAGE_TARGET) \ 958 $(INSTALLED_RADIOIMAGE_TARGET) \ 959 $(INSTALLED_RECOVERYIMAGE_TARGET) \ 960 $(INSTALLED_SYSTEMIMAGE) \ 961 $(INSTALLED_USERDATAIMAGE_TARGET) \ 962 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ 963 $(built_ota_tools) \ 964 $(APKCERTS_FILE) \ 965 $(HOST_OUT_EXECUTABLES)/fs_config \ 966 | $(ACP) 967 @echo "Package target files: $@" 968 $(hide) rm -rf $@ $(zip_root) 969 $(hide) mkdir -p $(dir $@) $(zip_root) 970 @# Components of the recovery image 971 $(hide) mkdir -p $(zip_root)/RECOVERY 972 $(hide) $(call package_files-copy-root, \ 973 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK) 974ifdef INSTALLED_KERNEL_TARGET 975 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel 976endif 977ifdef INSTALLED_2NDBOOTLOADER_TARGET 978 $(hide) $(ACP) \ 979 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second 980endif 981ifdef BOARD_KERNEL_CMDLINE 982 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline 983endif 984ifdef BOARD_KERNEL_BASE 985 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base 986endif 987 @# Components of the boot image 988 $(hide) mkdir -p $(zip_root)/BOOT 989 $(hide) $(call package_files-copy-root, \ 990 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK) 991ifdef INSTALLED_KERNEL_TARGET 992 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel 993endif 994ifdef INSTALLED_2NDBOOTLOADER_TARGET 995 $(hide) $(ACP) \ 996 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second 997endif 998ifdef BOARD_KERNEL_CMDLINE 999 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline 1000endif 1001ifdef BOARD_KERNEL_BASE 1002 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base 1003endif 1004 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\ 1005 mkdir -p $(zip_root)/RADIO; \ 1006 $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));) 1007 @# Contents of the system image 1008 $(hide) $(call package_files-copy-root, \ 1009 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM) 1010 @# Contents of the data image 1011 $(hide) $(call package_files-copy-root, \ 1012 $(TARGET_OUT_DATA),$(zip_root)/DATA) 1013 @# Extra contents of the OTA package 1014 $(hide) mkdir -p $(zip_root)/OTA/bin 1015 $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/ 1016 $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/ 1017 @# Files that do not end up in any images, but are necessary to 1018 @# build them. 1019 $(hide) mkdir -p $(zip_root)/META 1020 $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt 1021 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt 1022 $(hide) echo "$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/recovery-api-version.txt 1023ifdef BOARD_FLASH_BLOCK_SIZE 1024 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" > $(zip_root)/META/misc_info.txt 1025endif 1026ifdef BOARD_BOOTIMAGE_PARTITION_SIZE 1027 $(hide) echo "boot_size=$(call image-size-from-data-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/misc_info.txt 1028endif 1029ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE 1030 $(hide) echo "recovery_size=$(call image-size-from-data-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/misc_info.txt 1031endif 1032ifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE 1033 $(hide) echo "system_size=$(call image-size-from-data-size,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/misc_info.txt 1034endif 1035ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE 1036 $(hide) echo "userdata_size=$(call image-size-from-data-size,$(BOARD_USERDATAIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/misc_info.txt 1037endif 1038ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) 1039 $(hide) echo "fs_type=ext4" >> $(zip_root)/META/misc_info.txt 1040 $(hide) echo "partition_type=EMMC" >> $(zip_root)/META/misc_info.txt 1041 @# TODO: where is the right place to get this path from? BoardConfig.mk? 1042 $(hide) echo "partition_path=/dev/block/platform/sdhci-tegra.3/by-name/" >> $(zip_root)/META/misc_info.txt 1043else 1044 $(hide) echo "fs_type=yaffs2" >> $(zip_root)/META/misc_info.txt 1045 $(hide) echo "partition_type=MTD" >> $(zip_root)/META/misc_info.txt 1046endif 1047 $(hide) echo "$(tool_extensions)" > $(zip_root)/META/tool-extensions.txt 1048 @# Zip everything up, preserving symlinks 1049 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) 1050 @# Run fs_config on all the system files in the zip, and save the output 1051 $(hide) zipinfo -1 $@ | awk -F/ 'BEGIN { OFS="/" } /^SYSTEM\// {$$1 = "system"; print}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt 1052 $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/filesystem_config.txt) 1053 1054 1055target-files-package: $(BUILT_TARGET_FILES_PACKAGE) 1056 1057# ----------------------------------------------------------------- 1058# OTA update package 1059 1060ifneq ($(TARGET_SIMULATOR),true) 1061ifneq ($(TARGET_PRODUCT),sdk) 1062ifneq ($(TARGET_DEVICE),generic) 1063 1064name := $(TARGET_PRODUCT) 1065ifeq ($(TARGET_BUILD_TYPE),debug) 1066 name := $(name)_debug 1067endif 1068name := $(name)-ota-$(FILE_NAME_TAG) 1069 1070INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip 1071 1072$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) 1073 1074$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS) 1075 @echo "Package OTA: $@" 1076 $(hide) ./build/tools/releasetools/ota_from_target_files \ 1077 -p $(HOST_OUT) \ 1078 -k $(KEY_CERT_PAIR) \ 1079 $(BUILT_TARGET_FILES_PACKAGE) $@ 1080 1081.PHONY: otapackage 1082otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) 1083 1084endif # TARGET_DEVICE != generic 1085endif # TARGET_PRODUCT != sdk 1086endif # TARGET_SIMULATOR != true 1087 1088# ----------------------------------------------------------------- 1089# installed file list 1090# Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it 1091# gets the DexOpt one if we're doing that. 1092INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt 1093$(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE) 1094 @echo Installed file list: $@ 1095 @mkdir -p $(dir $@) 1096 @rm -f $@ 1097 $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@ 1098 1099.PHONY: installed-file-list 1100installed-file-list: $(INSTALLED_FILES_FILE) 1101ifneq ($(filter sdk,$(MAKECMDGOALS)),) 1102$(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE)) 1103endif 1104ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),) 1105$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE)) 1106endif 1107 1108# ----------------------------------------------------------------- 1109# A zip of the tests that are built when running "make tests". 1110# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we 1111# only grab SYSTEM and DATA, and it's called "*-tests-*.zip". 1112# 1113name := $(TARGET_PRODUCT) 1114ifeq ($(TARGET_BUILD_TYPE),debug) 1115 name := $(name)_debug 1116endif 1117name := $(name)-tests-$(FILE_NAME_TAG) 1118 1119intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip) 1120BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip 1121$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates) 1122$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name) 1123 1124# Depending on the images guarantees that the underlying 1125# directories are up-to-date. 1126$(BUILT_TESTS_ZIP_PACKAGE): \ 1127 $(BUILT_SYSTEMIMAGE) \ 1128 $(INSTALLED_USERDATAIMAGE_TARGET) \ 1129 | $(ACP) 1130 @echo "Package test files: $@" 1131 $(hide) rm -rf $@ $(zip_root) 1132 $(hide) mkdir -p $(dir $@) $(zip_root) 1133 @# Some parts of the system image 1134 $(hide) $(call package_files-copy-root, \ 1135 $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin) 1136 $(hide) $(call package_files-copy-root, \ 1137 $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib) 1138 $(hide) $(call package_files-copy-root, \ 1139 $(SYSTEMIMAGE_SOURCE_DIR)/framework, \ 1140 $(zip_root)/SYSTEM/framework) 1141 $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM 1142 @# Contents of the data image 1143 $(hide) $(call package_files-copy-root, \ 1144 $(TARGET_OUT_DATA),$(zip_root)/DATA) 1145 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) 1146 1147tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE) 1148 1149# ----------------------------------------------------------------- 1150# A zip of the symbols directory. Keep the full paths to make it 1151# more obvious where these files came from. 1152# 1153name := $(TARGET_PRODUCT) 1154ifeq ($(TARGET_BUILD_TYPE),debug) 1155 name := $(name)_debug 1156endif 1157name := $(name)-symbols-$(FILE_NAME_TAG) 1158 1159SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip 1160$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET) 1161 @echo "Package symbols: $@" 1162 $(hide) rm -rf $@ 1163 $(hide) mkdir -p $(dir $@) 1164 $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED) 1165 1166# ----------------------------------------------------------------- 1167# A zip of the Android Apps. Not keeping full path so that we don't 1168# include product names when distributing 1169# 1170name := $(TARGET_PRODUCT) 1171ifeq ($(TARGET_BUILD_TYPE),debug) 1172 name := $(name)_debug 1173endif 1174name := $(name)-apps-$(FILE_NAME_TAG) 1175 1176APPS_ZIP := $(PRODUCT_OUT)/$(name).zip 1177$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE) 1178 @echo "Package apps: $@" 1179 $(hide) rm -rf $@ 1180 $(hide) mkdir -p $(dir $@) 1181 $(hide) zip -qj $@ $(TARGET_OUT_APPS)/* 1182 1183 1184#------------------------------------------------------------------ 1185# A zip of emma code coverage meta files. Generated for fully emma 1186# instrumented build. 1187# 1188EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip 1189$(EMMA_META_ZIP): $(INSTALLED_SYSTEMIMAGE) 1190 @echo "Collecting Emma coverage meta files." 1191 $(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \ 1192 zip -@ -q $@ 1193 1194endif # TARGET_SIMULATOR != true 1195 1196# ----------------------------------------------------------------- 1197# dalvik something 1198.PHONY: dalvikfiles 1199dalvikfiles: $(INTERNAL_DALVIK_MODULES) 1200 1201# ----------------------------------------------------------------- 1202# The update package 1203 1204ifneq ($(TARGET_SIMULATOR),true) 1205ifneq ($(TARGET_PRODUCT),sdk) 1206 1207name := $(TARGET_PRODUCT) 1208ifeq ($(TARGET_BUILD_TYPE),debug) 1209 name := $(name)_debug 1210endif 1211name := $(name)-img-$(FILE_NAME_TAG) 1212 1213INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip 1214 1215ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),) 1216# default to common dir for device vendor 1217$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common 1218else 1219$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) 1220endif 1221 1222$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS) 1223 @echo "Package: $@" 1224 $(hide) ./build/tools/releasetools/img_from_target_files \ 1225 -s $(extensions) \ 1226 -p $(HOST_OUT) \ 1227 $(addprefix --fs_type ,$(INTERNAL_USERIMAGES_EXT_VARIANT)) \ 1228 $(BUILT_TARGET_FILES_PACKAGE) $@ 1229 1230.PHONY: updatepackage 1231updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET) 1232 1233endif # TARGET_PRODUCT != sdk 1234endif # TARGET_SIMULATOR != true 1235 1236# ----------------------------------------------------------------- 1237# The emulator package 1238 1239ifneq ($(TARGET_SIMULATOR),true) 1240 1241INTERNAL_EMULATOR_PACKAGE_FILES += \ 1242 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \ 1243 prebuilt/android-arm/kernel/kernel-qemu \ 1244 $(INSTALLED_RAMDISK_TARGET) \ 1245 $(INSTALLED_SYSTEMIMAGE) \ 1246 $(INSTALLED_USERDATAIMAGE_TARGET) 1247 1248name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG) 1249 1250INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip 1251 1252$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES) 1253 @echo "Package: $@" 1254 $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES) 1255 1256endif 1257 1258# ----------------------------------------------------------------- 1259# The pdk package (Platform Development Kit) 1260 1261ifneq (,$(filter pdk,$(MAKECMDGOALS))) 1262 include development/pdk/Pdk.mk 1263endif 1264 1265# ----------------------------------------------------------------- 1266# The SDK 1267 1268ifneq ($(TARGET_SIMULATOR),true) 1269 1270# The SDK includes host-specific components, so it belongs under HOST_OUT. 1271sdk_dir := $(HOST_OUT)/sdk 1272 1273# Build a name that looks like: 1274# 1275# linux-x86 --> android-sdk_12345_linux-x86 1276# darwin-x86 --> android-sdk_12345_mac-x86 1277# windows-x86 --> android-sdk_12345_windows 1278# 1279sdk_name := android-sdk_$(FILE_NAME_TAG) 1280ifeq ($(HOST_OS),darwin) 1281 INTERNAL_SDK_HOST_OS_NAME := mac 1282else 1283 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS) 1284endif 1285ifneq ($(HOST_OS),windows) 1286 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH) 1287endif 1288sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME) 1289 1290sdk_dep_file := $(sdk_dir)/sdk_deps.mk 1291 1292ATREE_FILES := 1293-include $(sdk_dep_file) 1294 1295# if we don't have a real list, then use "everything" 1296ifeq ($(strip $(ATREE_FILES)),) 1297ATREE_FILES := \ 1298 $(ALL_PREBUILT) \ 1299 $(ALL_COPIED_HEADERS) \ 1300 $(ALL_GENERATED_SOURCES) \ 1301 $(ALL_DEFAULT_INSTALLED_MODULES) \ 1302 $(INSTALLED_RAMDISK_TARGET) \ 1303 $(ALL_DOCS) \ 1304 $(ALL_SDK_FILES) 1305endif 1306 1307atree_dir := development/build 1308 1309sdk_atree_files := \ 1310 $(atree_dir)/sdk.exclude.atree \ 1311 $(atree_dir)/sdk.atree \ 1312 $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree 1313 1314deps := \ 1315 $(target_notice_file_txt) \ 1316 $(tools_notice_file_txt) \ 1317 $(OUT_DOCS)/offline-sdk-timestamp \ 1318 $(SYMBOLS_ZIP) \ 1319 $(INSTALLED_SYSTEMIMAGE) \ 1320 $(INSTALLED_USERDATAIMAGE_TARGET) \ 1321 $(INSTALLED_RAMDISK_TARGET) \ 1322 $(INSTALLED_SDK_BUILD_PROP_TARGET) \ 1323 $(INSTALLED_BUILD_PROP_TARGET) \ 1324 $(ATREE_FILES) \ 1325 $(atree_dir)/sdk.atree \ 1326 $(HOST_OUT_EXECUTABLES)/atree \ 1327 $(HOST_OUT_EXECUTABLES)/line_endings 1328 1329INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip 1330$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name) 1331$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name) 1332$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file) 1333$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files) 1334 1335# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built. 1336# 1337#SDK_GNU_ERROR := true 1338 1339$(INTERNAL_SDK_TARGET): $(deps) 1340 @echo "Package SDK: $@" 1341 $(hide) rm -rf $(PRIVATE_DIR) $@ 1342 $(hide) for f in $(target_gnu_MODULES); do \ 1343 if [ -f $$f ]; then \ 1344 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \ 1345 including GNU target $$f >&2; \ 1346 FAIL=$(SDK_GNU_ERROR); \ 1347 fi; \ 1348 done; \ 1349 if [ $$FAIL ]; then exit 1; fi 1350 $(hide) ( \ 1351 $(HOST_OUT_EXECUTABLES)/atree \ 1352 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \ 1353 -m $(PRIVATE_DEP_FILE) \ 1354 -I . \ 1355 -I $(PRODUCT_OUT) \ 1356 -I $(HOST_OUT) \ 1357 -I $(TARGET_COMMON_OUT_ROOT) \ 1358 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \ 1359 -o $(PRIVATE_DIR) && \ 1360 cp -f $(target_notice_file_txt) \ 1361 $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \ 1362 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \ 1363 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \ 1364 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \ 1365 chmod -R ug+rwX $(PRIVATE_DIR) && \ 1366 cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \ 1367 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 ) 1368 1369 1370# Is a Windows SDK requested? If so, we need some definitions from here 1371# in order to find the Linux SDK used to create the Windows one. 1372ifneq ($(filter win_sdk,$(MAKECMDGOALS)),) 1373LINUX_SDK_NAME := $(sdk_name) 1374LINUX_SDK_DIR := $(sdk_dir) 1375include $(TOPDIR)development/build/tools/windows_sdk.mk 1376endif 1377 1378endif # !simulator 1379 1380# ----------------------------------------------------------------- 1381# Findbugs 1382INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml 1383INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html 1384$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES) 1385 @echo UnionBugs: $@ 1386 $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \ 1387 > $@ 1388$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET) 1389 @echo ConvertXmlToText: $@ 1390 $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \ 1391 $(INTERNAL_FINDBUGS_XML_TARGET) > $@ 1392 1393# ----------------------------------------------------------------- 1394# Findbugs 1395 1396# ----------------------------------------------------------------- 1397# These are some additional build tasks that need to be run. 1398include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk)) 1399