1 # Put some miscellaneous rules here
3 # Pick a reasonable string to use to identify files.
4 ifneq "" "$(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)
9 FILE_NAME_TAG := $(BUILD_NUMBER)
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 $(foreach cf,$(PRODUCT_COPY_FILES), \
18 $(eval _w := $(subst :,$(space),$(cf))) \
19 $(eval _src := $(word 1,$(_w))) \
20 $(eval _dest := $(subst //,/,$(PRODUCT_OUT)/$(word 2,$(_w)))) \
21 $(eval $(call copy-one-file,$(_src),$(_dest))) \
22 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_dest)) \
25 # -----------------------------------------------------------------
27 gen := $(OUT_DOCS)/index.html
29 $(gen): frameworks/base/docs/docs-redirect-index.html
33 # -----------------------------------------------------------------
35 INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
36 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
37 ADDITIONAL_DEFAULT_PROPERTIES := \
38 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
40 $(INSTALLED_DEFAULT_PROP_TARGET):
41 @echo Target buildinfo: $@
43 $(hide) echo "#" > $@; \
44 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
46 $(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \
47 echo "$(line)" >> $@;)
49 # -----------------------------------------------------------------
51 INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
52 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
53 ADDITIONAL_BUILD_PROPERTIES := \
54 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
56 # A list of arbitrary tags describing the build configuration.
57 # Force ":=" so we can use +=
58 BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
59 ifeq ($(TARGET_BUILD_TYPE),debug)
60 BUILD_VERSION_TAGS += debug
62 # Apps are always signed with test keys, and may be re-signed in a post-build
63 # step. If that happens, the "test-keys" tag will be removed by that step.
64 BUILD_VERSION_TAGS += test-keys
65 ifndef INCLUDE_TEST_OTA_KEYS
66 BUILD_VERSION_TAGS += ota-rel-keys
68 BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
70 # A human-readable string that descibes this build in detail.
71 build_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)
74 # The string used to uniquely identify this build; used by the OTA server.
75 ifeq (,$(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)
78 ifneq ($(words $(BUILD_FINGERPRINT)),1)
79 $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
82 # Selects the first locale in the list given as the argument,
83 # and splits it into language and region, which each may be
86 $(subst _, , $(firstword $(1)))
89 # Selects the first locale in the list given as the argument
90 # and returns the language (or the region)
91 define default-locale-language
92 $(word 2, 2, $(call default-locale, $(1)))
94 define default-locale-region
95 $(word 3, 3, $(call default-locale, $(1)))
98 BUILDINFO_SH := build/tools/buildinfo.sh
99 $(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE)
100 @echo Target buildinfo: $@
102 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
103 TARGET_DEVICE="$(TARGET_DEVICE)" \
104 PRODUCT_NAME="$(TARGET_PRODUCT)" \
105 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
106 PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \
107 PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \
108 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
109 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
110 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
111 BUILD_ID="$(BUILD_ID)" \
112 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
113 BUILD_NUMBER="$(BUILD_NUMBER)" \
114 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
115 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
116 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
117 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
118 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
119 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
120 bash $(BUILDINFO_SH) > $@
121 $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
122 cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
124 $(if $(ADDITIONAL_BUILD_PROPERTIES), \
125 $(hide) echo >> $@; \
127 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
129 $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \
130 echo "$(line)" >> $@;)
134 # -----------------------------------------------------------------
137 # There are certain things in build.prop that we don't want to
138 # ship with the sdk; remove them.
140 # This must be a list of entire property keys followed by
141 # "=" characters, without any internal spaces.
142 sdk_build_prop_remove := \
146 ro.product.manufacturer= \
148 # TODO: Remove this soon-to-be obsolete property
149 sdk_build_prop_remove += ro.build.product=
150 INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
151 $(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
152 @echo SDK buildinfo: $@
154 $(hide) grep -v "$(subst $(space),\|,$(strip \
155 $(sdk_build_prop_remove)))" $< > $@.tmp
156 $(hide) for x in $(sdk_build_prop_remove); do \
157 echo "$$x"generic >> $@.tmp; done
160 # -----------------------------------------------------------------
162 PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
163 PACKAGES_TO_STAT := \
164 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
165 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
166 $(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
167 @echo Package stats: $@
170 $(hide) build/tools/dump-package-stats $^ > $@
172 .PHONY: package-stats
173 package-stats: $(PACKAGE_STATS_FILE)
175 # -----------------------------------------------------------------
176 # Cert-to-package mapping. Used by the post-build signing tools.
177 name := $(TARGET_PRODUCT)
178 ifeq ($(TARGET_BUILD_TYPE),debug)
179 name := $(name)_debug
181 name := $(name)-apkcerts-$(FILE_NAME_TAG)
183 $(call intermediates-dir-for,PACKAGING,apkcerts)
184 APKCERTS_FILE := $(intermediates)/$(name).txt
185 # Depending on the built packages isn't exactly right,
186 # but it should guarantee that the apkcerts file is rebuilt
187 # if any packages change which certs they're signed with.
188 all_built_packages := $(foreach p,$(PACKAGES),$(ALL_MODULES.$(p).BUILT))
189 $(APKCERTS_FILE): $(all_built_packages)
190 @echo APK certs list: $@
193 $(hide) $(foreach p,$(PACKAGES),\
194 echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
195 private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;)
197 .PHONY: apkcerts-list
198 apkcerts-list: $(APKCERTS_FILE)
200 # -----------------------------------------------------------------
202 ifdef CREATE_MODULE_INFO_FILE
203 MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt
204 $(info Generating $(MODULE_INFO_FILE)...)
205 $(shell rm -f $(MODULE_INFO_FILE))
206 $(foreach m,$(ALL_MODULES), \
207 $(shell echo "NAME=\"$(m)\"" \
208 "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \
209 "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \
210 "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \
211 "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE)))
214 # Rules that need to be present for the simulator, even
215 # if they don't do anything.
219 ifneq ($(TARGET_SIMULATOR),true)
221 # #################################################################
222 # Targets for boot/OS images
223 # #################################################################
225 # -----------------------------------------------------------------
227 INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
229 $(ALL_COPIED_HEADERS) \
230 $(ALL_GENERATED_SOURCES) \
231 $(ALL_DEFAULT_INSTALLED_MODULES))
233 INSTALLED_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
234 $(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES)
235 $(call pretty,"Target ram disk: $@")
236 $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | gzip > $@
239 ifneq ($(strip $(TARGET_NO_KERNEL)),true)
241 # -----------------------------------------------------------------
242 # the boot image, which is a collection of other images.
243 INTERNAL_BOOTIMAGE_ARGS := \
244 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
245 --kernel $(INSTALLED_KERNEL_TARGET) \
246 --ramdisk $(INSTALLED_RAMDISK_TARGET)
248 INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
250 BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
251 ifdef BOARD_KERNEL_CMDLINE
252 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
255 INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
257 ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
258 tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg
259 INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image)
260 INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG)
261 $(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES)
262 $(call pretty,"Target boot image: $@")
263 $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
265 else # TARGET_BOOTIMAGE_USE_EXT2 != true
267 $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
268 $(call pretty,"Target boot image: $@")
269 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
270 $(hide) $(call assert-max-file-size,$@,$(BOARD_BOOTIMAGE_MAX_SIZE))
271 endif # TARGET_BOOTIMAGE_USE_EXT2
273 else # TARGET_NO_KERNEL
274 # HACK: The top-level targets depend on the bootimage. Not all targets
275 # can produce a bootimage, though, and emulator targets need the ramdisk
276 # instead. Fake it out by calling the ramdisk the bootimage.
277 # TODO: make the emulator use bootimages, and make mkbootimg accept
278 # kernel-less inputs.
279 INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
282 # -----------------------------------------------------------------
285 # This needs to be before the systemimage rules, because it adds to
286 # ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
287 # go into the systemimage.
291 # Create the rule to combine the files into text and html forms
292 # $(1) - Plain text output file
293 # $(2) - HTML output file
295 # $(4) - Directory to use. Notice files are all $(4)/src. Other
296 # directories in there will be used for scratch
297 # $(5) - Dependencies for the output files
299 # The algorithm here is that we go collect a hash for each of the notice
300 # files and write the names of the files that match that hash. Then
301 # to generate the real files, we go print out all of the files and their
304 # These rules are fairly complex, so they depend on this makefile so if
305 # it changes, they'll run again.
307 # TODO: We could clean this up so that we just record the locations of the
308 # original notice files instead of making rules to copy them somwehere.
309 # Then we could traverse that without quite as much bash drama.
310 define combine-notice-files
311 $(1) $(2): PRIVATE_MESSAGE := $(3)
312 $(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
313 $(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
314 @echo Finding NOTICE files: $$@
315 $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
316 $$(hide) mkdir -p $$(PRIVATE_DIR)/hash
317 $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
318 hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
319 hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
320 echo $$$$file >> $$$$hashfile; \
323 $(1): $(4)/hash-timestamp
324 @echo Combining NOTICE files: $$@
325 $$(hide) mkdir -p $$(dir $$@)
326 $$(hide) echo $$(PRIVATE_MESSAGE) > $$@
327 $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
328 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> $$@
332 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
333 echo "============================================================"\
335 echo "Notices for file(s):" >> $$@; \
336 cat $$$$hashfile | sort | \
337 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> \
339 echo "------------------------------------------------------------"\
342 orig=$$$$(head -n 1 $$$$hashfile); \
343 cat $$$$orig >> $$@; \
348 $(2): $(4)/hash-timestamp
349 @echo Combining NOTICE files: $$@
350 $$(hide) mkdir -p $$(dir $$@)
351 $$(hide) echo "<html><head>" > $$@
352 $$(hide) echo "<style type=\"text/css\">" >> $$@
353 $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
354 $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
355 $$(hide) echo ".label { font-weight: bold; }" >> $$@
356 $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
357 $$(hide) echo "</style>" >> $$@
358 $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
359 $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
361 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
362 cat $$$$hashfile | sort | \
363 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: <a name=\"\1\"></a>:" >> \
365 echo "<tr><td class=\"same-license\">" >> $$@; \
366 echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
367 echo "<div class=\"file-list\">" >> $$@; \
368 cat $$$$hashfile | sort | \
369 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1<br/>:" >> $$@; \
370 echo "</div><!-- file-list -->" >> $$@; \
372 orig=$$$$(head -n 1 $$$$hashfile); \
373 echo "<pre class=\"license-text\">" >> $$@; \
374 cat $$$$orig | sed -e "s/\&/\&/g" | sed -e "s/</\</g" \
375 | sed -e "s/>/\>/g" >> $$@; \
376 echo "</pre><!-- license-text -->" >> $$@; \
377 echo "</td></tr><!-- same-license -->" >> $$@; \
382 $$(hide) echo "</table>" >> $$@
383 $$(hide) echo "</body></html>" >> $$@
384 notice_files: $(1) $(2)
387 # TODO These intermediate NOTICE.txt/NOTICE.html files should go into
388 # TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
389 # the src subdirectory.
391 target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
392 target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
393 target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
394 tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
395 tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
397 kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
399 $(eval $(call combine-notice-files, \
400 $(target_notice_file_txt), \
401 $(target_notice_file_html), \
402 "Notices for files contained in the filesystem images in this directory:", \
403 $(TARGET_OUT_NOTICE_FILES), \
404 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file)))
406 $(eval $(call combine-notice-files, \
407 $(tools_notice_file_txt), \
408 $(tools_notice_file_html), \
409 "Notices for files contained in the tools directory:", \
410 $(HOST_OUT_NOTICE_FILES), \
411 $(ALL_DEFAULT_INSTALLED_MODULES)))
413 # Install the html file at /system/etc/NOTICE.html.gz.
414 # This is not ideal, but this is very late in the game, after a lot of
415 # the module processing has already been done -- in fact, we used the
416 # fact that all that has been done to get the list of modules that we
417 # need notice files for.
418 $(target_notice_file_html_gz): $(target_notice_file_html)
420 installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
421 $(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
422 $(copy-file-to-target)
423 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
425 # The kernel isn't really a module, so to get its module file in there, we
426 # make the target NOTICE files depend on this particular file too, which will
427 # then be in the right directory for the find in combine-notice-files to work.
428 $(kernel_notice_file): \
429 prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \
432 $(hide) mkdir -p $(dir $@)
436 # #################################################################
437 # Targets for user images
438 # #################################################################
440 ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
441 include external/genext2fs/Config.mk
442 INTERNAL_MKUSERFS := $(MKEXT2IMG)
444 INTERNAL_MKUSERFS := $(MKYAFFS2)
447 # -----------------------------------------------------------------
450 # First, the "unoptimized" image, which contains .apk/.jar files
451 # that contain regular, unoptimized/unverified .dex entries.
453 systemimage_unopt_intermediates := \
454 $(call intermediates-dir-for,PACKAGING,systemimage_unopt)
455 BUILT_SYSTEMIMAGE_UNOPT := $(systemimage_unopt_intermediates)/system.img
457 INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
459 $(ALL_COPIED_HEADERS) \
460 $(ALL_GENERATED_SOURCES) \
461 $(ALL_DEFAULT_INSTALLED_MODULES))
463 ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
464 ## generate an ext2 image
466 define build-systemimage-target
467 @echo "Target system fs image: $(1)"
468 $(call build-userimage-ext2-target,$(TARGET_OUT),$(1),system,)
471 else # TARGET_USERIMAGES_USE_EXT2 != true
473 ## generate a yaffs2 image
475 define build-systemimage-target
476 @echo "Target system fs image: $(1)"
477 @mkdir -p $(dir $(1))
478 $(hide) $(MKYAFFS2) -f $(TARGET_OUT) $(1)
480 endif # TARGET_USERIMAGES_USE_EXT2
482 $(BUILT_SYSTEMIMAGE_UNOPT): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_MKUSERFS)
483 $(call build-systemimage-target,$@)
485 # The installed image, which may be optimized or unoptimized.
487 INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
490 ifndef DISABLE_DEXPREOPT
491 with_dexpreopt := true
495 # This file will set BUILT_SYSTEMIMAGE and SYSTEMIMAGE_SOURCE_DIR
496 include build/tools/dexpreopt/Config.mk
498 BUILT_SYSTEMIMAGE := $(BUILT_SYSTEMIMAGE_UNOPT)
499 SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
502 $(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) | $(ACP)
503 @echo "Install system fs image: $@"
504 $(copy-file-to-target)
505 $(hide) $(call assert-max-file-size,$@,$(BOARD_SYSTEMIMAGE_MAX_SIZE))
507 systemimage: $(INSTALLED_SYSTEMIMAGE)
509 .PHONY: systemimage-nodeps snod
510 systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
511 | $(INTERNAL_MKUSERFS)
512 @echo "make $@: ignoring dependencies"
513 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
514 $(hide) $(call assert-max-file-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_MAX_SIZE))
518 define build-systemtarball-target
519 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
520 $(MKTARBALL) $(FS_GET_STATS) \
521 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
522 $(INSTALLED_SYSTEMTARBALL_TARGET)
525 system_tar := $(PRODUCT_OUT)/system.tar
526 INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).bz2
527 $(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
528 $(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
529 $(build-systemtarball-target)
531 .PHONY: systemtarball-nodeps
532 systemtarball-nodeps: $(FS_GET_STATS) \
533 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
534 $(build-systemtarball-target)
537 stnod: systemtarball-nodeps
540 # -----------------------------------------------------------------
541 # data partition image
542 INTERNAL_USERDATAIMAGE_FILES := \
543 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
545 ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
546 ## Generate an ext2 image
547 define build-userdataimage-target
548 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
549 @mkdir -p $(TARGET_OUT_DATA)
550 $(call build-userimage-ext2-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),userdata,)
551 $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE))
554 else # TARGET_USERIMAGES_USE_EXT2 != true
556 ## Generate a yaffs2 image
557 define build-userdataimage-target
558 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
559 @mkdir -p $(TARGET_OUT_DATA)
560 $(hide) $(MKYAFFS2) -f $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
561 $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE))
563 endif # TARGET_USERIMAGES_USE_EXT2
565 INSTALLED_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
566 $(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_MKUSERFS) \
567 $(INTERNAL_USERDATAIMAGE_FILES)
568 $(build-userdataimage-target)
570 .PHONY: userdataimage-nodeps
571 userdataimage-nodeps: $(INTERNAL_MKUSERFS)
572 $(build-userdataimage-target)
575 ## data partition tarball
576 define build-userdatatarball-target
577 $(call pretty,"Target userdata fs tarball: " \
578 "$(INSTALLED_USERDATATARBALL_TARGET)")
579 $(MKTARBALL) $(FS_GET_STATS) \
580 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
581 $(INSTALLED_USERDATATARBALL_TARGET)
584 userdata_tar := $(PRODUCT_OUT)/userdata.tar
585 INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
586 $(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
587 $(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
588 $(build-userdatatarball-target)
590 .PHONY: userdatatarball-nodeps
591 userdatatarball-nodeps: $(FS_GET_STATS)
592 $(build-userdatatarball-target)
595 # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
596 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
598 # -----------------------------------------------------------------
600 INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
602 recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
603 recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
604 recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
605 recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
606 recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
607 recovery_resources_common := $(call include-path-for, recovery)/res
608 recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
609 recovery_resource_deps := $(shell find $(recovery_resources_common) \
610 $(recovery_resources_private) -type f)
612 ifeq ($(recovery_resources_private),)
613 $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
616 INTERNAL_RECOVERYIMAGE_ARGS := \
617 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
618 --kernel $(recovery_kernel) \
619 --ramdisk $(recovery_ramdisk)
621 # Assumes this has already been stripped
622 ifdef BOARD_KERNEL_CMDLINE
623 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
626 $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) \
627 $(INSTALLED_RAMDISK_TARGET) \
628 $(INSTALLED_BOOTIMAGE_TARGET) \
630 $(recovery_initrc) $(recovery_kernel) \
631 $(INSTALLED_2NDBOOTLOADER_TARGET) \
632 $(recovery_build_prop) $(recovery_resource_deps)
633 @echo ----- Making recovery image ------
634 rm -rf $(TARGET_RECOVERY_OUT)
635 mkdir -p $(TARGET_RECOVERY_OUT)
636 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)
637 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc
638 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
639 echo Copying baseline ramdisk...
640 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
641 echo Modifying ramdisk contents...
642 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
643 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
644 cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
645 $(foreach item,$(recovery_resources_private), \
646 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
647 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
648 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
649 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | gzip > $(recovery_ramdisk)
650 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
651 @echo ----- Made recovery image -------- $@
652 $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE))
655 INSTALLED_RECOVERYIMAGE_TARGET :=
658 .PHONY: recoveryimage
659 recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
661 # -----------------------------------------------------------------
662 # bring in the installer image generation defines if necessary
663 ifeq ($(TARGET_USE_DISKINSTALLER),true)
664 include bootable/diskinstaller/config.mk
667 # -----------------------------------------------------------------
669 name := $(TARGET_PRODUCT)
670 ifeq ($(TARGET_BUILD_TYPE),debug)
671 name := $(name)_debug
673 name := $(name)-ota-$(FILE_NAME_TAG)
675 INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
676 INTERNAL_OTA_INTERMEDIATES_DIR := $(call intermediates-dir-for,PACKAGING,ota)
678 # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
679 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
680 INTERNAL_OTA_RECOVERYIMAGE_TARGET := $(INTERNAL_OTA_INTERMEDIATES_DIR)/system/recovery.img
682 INTERNAL_OTA_RECOVERYIMAGE_TARGET :=
684 INTERNAL_OTA_SCRIPT_TARGET := $(INTERNAL_OTA_INTERMEDIATES_DIR)/META-INF/com/google/android/update-script
686 # Sign OTA packages with the test key by default.
687 # Actual product deliverables will be re-signed by hand.
688 private_key := $(SRC_TARGET_DIR)/product/security/testkey.pk8
689 certificate := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
690 $(INTERNAL_OTA_PACKAGE_TARGET): $(private_key) $(certificate) $(SIGNAPK_JAR)
691 $(INTERNAL_OTA_PACKAGE_TARGET): PRIVATE_PRIVATE_KEY := $(private_key)
692 $(INTERNAL_OTA_PACKAGE_TARGET): PRIVATE_CERTIFICATE := $(certificate)
694 # Depending on INSTALLED_SYSTEMIMAGE guarantees that SYSTEMIMAGE_SOURCE_DIR
695 # is up-to-date. We use jar instead of zip so that we can use the -C
696 # switch to avoid cd-ing all over the place.
697 # TODO: Make our own jar-creation tool to avoid all these shenanigans.
698 $(INTERNAL_OTA_PACKAGE_TARGET): \
699 $(INTERNAL_OTA_SCRIPT_TARGET) \
700 $(INTERNAL_OTA_RECOVERYIMAGE_TARGET) \
701 $(INSTALLED_BOOTIMAGE_TARGET) \
702 $(INSTALLED_RADIOIMAGE_TARGET) \
703 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
704 $(INSTALLED_SYSTEMIMAGE)
705 @echo "Package OTA: $@"
709 $(INSTALLED_BOOTIMAGE_TARGET) \
710 $(INSTALLED_RADIOIMAGE_TARGET) \
711 $(INSTALLED_ANDROID_INFO_TXT_TARGET), \
712 -C $(dir $(item)) $(notdir $(item))) \
713 -C $(INTERNAL_OTA_INTERMEDIATES_DIR) .
714 $(hide) find $(SYSTEMIMAGE_SOURCE_DIR) -type f -print | \
715 sed 's|^$(dir $(SYSTEMIMAGE_SOURCE_DIR))|-C & |' | \
717 $(hide) if jar tf $@ | egrep '.{65}' >&2; then \
718 echo "Path too long (>64 chars) for OTA update" >&2; \
723 $(INTERNAL_OTA_SCRIPT_TARGET): \
724 $(HOST_OUT_EXECUTABLES)/make-update-script \
725 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
726 $(INSTALLED_SYSTEMIMAGE)
729 @echo "Update script: $@"
730 $(hide) TARGET_DEVICE=$(TARGET_DEVICE) \
731 $< $(SYSTEMIMAGE_SOURCE_DIR) \
732 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
735 ifneq (,$(INTERNAL_OTA_RECOVERYIMAGE_TARGET))
736 # This copy is so recovery.img can be in /system within the OTA package.
737 # That way it gets installed into the system image, which in turn installs it.
738 $(INTERNAL_OTA_RECOVERYIMAGE_TARGET): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ACP)
744 otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
746 # Keys authorized to sign OTA packages this build will accept.
747 ifeq ($(INCLUDE_TEST_OTA_KEYS),true)
749 $(sort $(SRC_TARGET_DIR)/product/security/testkey.x509.pem $(OTA_PUBLIC_KEYS))
752 ifeq ($(OTA_PUBLIC_KEYS),)
753 $(error No OTA_PUBLIC_KEYS defined)
756 # Build a keystore with the authorized keys in it.
757 # java/android/android/server/checkin/UpdateVerifier.java uses this.
758 ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
759 $(TARGET_OUT_ETC)/security/otacerts.zip: $(OTA_PUBLIC_KEYS)
761 $(hide) mkdir -p $(dir $@)
762 zip -qj $@ $(OTA_PUBLIC_KEYS)
764 # The device does not support JKS.
765 # $(hide) for f in $(OTA_PUBLIC_KEYS); do \
766 # echo "keytool: $@ <= $$f" && \
767 # keytool -keystore $@ -storepass $(notdir $@) -noprompt \
768 # -import -file $$f -alias $(notdir $$f) || exit 1; \
771 ifdef RECOVERY_INSTALL_OTA_KEYS_INC
772 # Generate a C-includable file containing the keys.
773 # RECOVERY_INSTALL_OTA_KEYS_INC is defined by recovery/Android.mk.
774 # *** THIS IS A TOTAL HACK; EXECUTABLES MUST NOT CHANGE BETWEEN DIFFERENT
775 # PRODUCTS/BUILD TYPES. ***
776 # TODO: make recovery read the keys from an external file.
777 DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
778 $(RECOVERY_INSTALL_OTA_KEYS_INC): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
779 $(RECOVERY_INSTALL_OTA_KEYS_INC): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR)
780 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)"
783 $(hide) java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@
786 # -----------------------------------------------------------------
787 # A zip of the directories that map to the target filesystem.
788 # This zip can be used to create an OTA package or filesystem image
789 # as a post-build step.
791 name := $(TARGET_PRODUCT)
792 ifeq ($(TARGET_BUILD_TYPE),debug)
793 name := $(name)_debug
795 name := $(name)-target_files-$(FILE_NAME_TAG)
797 intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
798 BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
799 $(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
800 $(BUILT_TARGET_FILES_PACKAGE): \
801 zip_root := $(intermediates)/$(name)
803 # $(1): Directory to copy
804 # $(2): Location to copy it to
805 # The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
806 define package_files-copy-root
807 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
809 $(ACP) -rd $(strip $(1))/* $(2); \
814 $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
815 $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq
816 $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
818 # Depending on the various images guarantees that the underlying
819 # directories are up-to-date.
820 $(BUILT_TARGET_FILES_PACKAGE): \
821 $(INTERNAL_OTA_SCRIPT_TARGET) \
822 $(INSTALLED_BOOTIMAGE_TARGET) \
823 $(INSTALLED_RADIOIMAGE_TARGET) \
824 $(INSTALLED_RECOVERYIMAGE_TARGET) \
825 $(BUILT_SYSTEMIMAGE) \
826 $(INSTALLED_USERDATAIMAGE_TARGET) \
827 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
828 $(INTERNAL_OTA_SCRIPT_TARGET) \
832 @echo "Package target files: $@"
833 $(hide) rm -rf $@ $(zip_root)
834 $(hide) mkdir -p $(dir $@) $(zip_root)
835 @# Components of the recovery image
836 $(hide) mkdir -p $(zip_root)/RECOVERY
837 $(hide) $(call package_files-copy-root, \
838 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
839 ifdef INSTALLED_KERNEL_TARGET
840 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
842 ifdef INSTALLED_2NDBOOTLOADER_TARGET
844 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
846 ifdef BOARD_KERNEL_CMDLINE
847 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
849 @# Components of the boot image
850 $(hide) mkdir -p $(zip_root)/BOOT
851 $(hide) $(call package_files-copy-root, \
852 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
853 ifdef INSTALLED_KERNEL_TARGET
854 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
856 ifdef INSTALLED_2NDBOOTLOADER_TARGET
858 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
860 ifdef BOARD_KERNEL_CMDLINE
861 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
863 ifdef INSTALLED_RADIOIMAGE_TARGET
865 $(hide) mkdir -p $(zip_root)/RADIO
866 $(hide) $(ACP) $(INSTALLED_RADIOIMAGE_TARGET) $(zip_root)/RADIO/image
868 @# Contents of the system image
869 $(hide) $(call package_files-copy-root, \
870 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
871 @# Contents of the data image
872 $(hide) $(call package_files-copy-root, \
873 $(TARGET_OUT_DATA),$(zip_root)/DATA)
874 @# Extra contents of the OTA package
875 $(hide) mkdir -p $(zip_root)/OTA/bin
876 $(hide) $(call package_files-copy-root, \
877 $(INTERNAL_OTA_INTERMEDIATES_DIR),$(zip_root)/OTA)
878 $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
879 $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
880 @# Files that don't end up in any images, but are necessary to
882 $(hide) mkdir -p $(zip_root)/META
883 $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
884 @# Zip everything up, preserving symlinks
885 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
887 target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
889 # -----------------------------------------------------------------
890 # installed file list
891 # Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it
892 # gets the DexOpt one if we're doing that.
893 INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
894 $(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE)
895 @echo Installed file list: $@
898 $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@
900 .PHONY: installed-file-list
901 installed-file-list: $(INSTALLED_FILES_FILE)
903 # -----------------------------------------------------------------
904 # A zip of the tests that are built when running "make tests".
905 # This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
906 # only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
908 name := $(TARGET_PRODUCT)
909 ifeq ($(TARGET_BUILD_TYPE),debug)
910 name := $(name)_debug
912 name := $(name)-tests-$(FILE_NAME_TAG)
914 intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
915 BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
916 $(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
917 $(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
919 # Depending on the images guarantees that the underlying
920 # directories are up-to-date.
921 $(BUILT_TESTS_ZIP_PACKAGE): \
922 $(BUILT_SYSTEMIMAGE) \
923 $(INSTALLED_USERDATAIMAGE_TARGET) \
925 @echo "Package test files: $@"
926 $(hide) rm -rf $@ $(zip_root)
927 $(hide) mkdir -p $(dir $@) $(zip_root)
928 @# Some parts of the system image
929 $(hide) $(call package_files-copy-root, \
930 $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
931 $(hide) $(call package_files-copy-root, \
932 $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
933 $(hide) $(call package_files-copy-root, \
934 $(SYSTEMIMAGE_SOURCE_DIR)/framework, \
935 $(zip_root)/SYSTEM/framework)
936 $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
937 @# Contents of the data image
938 $(hide) $(call package_files-copy-root, \
939 $(TARGET_OUT_DATA),$(zip_root)/DATA)
940 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
942 tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
944 # -----------------------------------------------------------------
945 # A zip of the symbols directory. Keep the full paths to make it
946 # more obvious where these files came from.
948 name := $(TARGET_PRODUCT)
949 ifeq ($(TARGET_BUILD_TYPE),debug)
950 name := $(name)_debug
952 name := $(name)-symbols-$(FILE_NAME_TAG)
954 SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
955 $(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET)
956 @echo "Package symbols: $@"
958 $(hide) mkdir -p $(dir $@)
959 $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
961 # -----------------------------------------------------------------
962 # A zip of the Android Apps. Not keeping full path so that we don't
963 # include product names when distributing
965 name := $(TARGET_PRODUCT)
966 ifeq ($(TARGET_BUILD_TYPE),debug)
967 name := $(name)_debug
969 name := $(name)-apps-$(FILE_NAME_TAG)
971 APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
972 $(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
973 @echo "Package apps: $@"
975 $(hide) mkdir -p $(dir $@)
976 $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
978 endif # TARGET_SIMULATOR != true
980 # -----------------------------------------------------------------
983 dalvikfiles: $(INTERNAL_DALVIK_MODULES)
985 # -----------------------------------------------------------------
988 INTERNAL_UPDATE_PACKAGE_FILES += \
989 $(INSTALLED_BOOTIMAGE_TARGET) \
990 $(INSTALLED_RECOVERYIMAGE_TARGET) \
991 $(INSTALLED_SYSTEMIMAGE) \
992 $(INSTALLED_USERDATAIMAGE_TARGET) \
993 $(INSTALLED_ANDROID_INFO_TXT_TARGET)
995 ifneq ($(strip $(INTERNAL_UPDATE_PACKAGE_FILES)),)
997 name := $(TARGET_PRODUCT)
998 ifeq ($(TARGET_BUILD_TYPE),debug)
999 name := $(name)_debug
1001 name := $(name)-img-$(FILE_NAME_TAG)
1003 INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1005 $(INTERNAL_UPDATE_PACKAGE_TARGET): $(INTERNAL_UPDATE_PACKAGE_FILES)
1007 $(hide) zip -qj $@ $(INTERNAL_UPDATE_PACKAGE_FILES)
1010 INTERNAL_UPDATE_PACKAGE_TARGET :=
1013 # -----------------------------------------------------------------
1014 # The emulator package
1016 ifneq ($(TARGET_SIMULATOR),true)
1018 INTERNAL_EMULATOR_PACKAGE_FILES += \
1019 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
1020 prebuilt/android-arm/kernel/kernel-qemu \
1021 $(INSTALLED_RAMDISK_TARGET) \
1022 $(INSTALLED_SYSTEMIMAGE) \
1023 $(INSTALLED_USERDATAIMAGE_TARGET)
1025 name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
1027 INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1029 $(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
1031 $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
1035 # -----------------------------------------------------------------
1036 # The pdk package (Platform Development Kit)
1038 ifneq (,$(filter pdk,$(MAKECMDGOALS)))
1039 include development/pdk/Pdk.mk
1042 # -----------------------------------------------------------------
1045 ifneq ($(TARGET_SIMULATOR),true)
1047 # The SDK includes host-specific components, so it belongs under HOST_OUT.
1048 sdk_dir := $(HOST_OUT)/sdk
1050 # Build a name that looks like:
1052 # linux-x86 --> android-sdk_12345_linux-x86
1053 # darwin-x86 --> android-sdk_12345_mac-x86
1054 # windows-x86 --> android-sdk_12345_windows
1056 sdk_name := android-sdk_$(FILE_NAME_TAG)
1057 ifeq ($(HOST_OS),darwin)
1060 sdk_host_os := $(HOST_OS)
1062 ifneq ($(HOST_OS),windows)
1063 sdk_host_os := $(sdk_host_os)-$(HOST_ARCH)
1065 sdk_name := $(sdk_name)_$(sdk_host_os)
1067 sdk_dep_file := $(sdk_dir)/sdk_deps.mk
1070 -include $(sdk_dep_file)
1072 # if we don't have a real list, then use "everything"
1073 ifeq ($(strip $(ATREE_FILES)),)
1076 $(ALL_COPIED_HEADERS) \
1077 $(ALL_GENERATED_SOURCES) \
1078 $(ALL_DEFAULT_INSTALLED_MODULES) \
1079 $(INSTALLED_RAMDISK_TARGET) \
1084 atree_dir := development/build
1086 sdk_atree_files := \
1087 $(atree_dir)/sdk.exclude.atree \
1088 $(atree_dir)/sdk.atree \
1089 $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree
1092 $(target_notice_file_txt) \
1093 $(tools_notice_file_txt) \
1094 $(OUT_DOCS)/offline-sdk-timestamp \
1095 $(INTERNAL_UPDATE_PACKAGE_TARGET) \
1096 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
1098 $(atree_dir)/sdk.atree \
1099 $(HOST_OUT_EXECUTABLES)/atree \
1100 $(HOST_OUT_EXECUTABLES)/line_endings
1102 INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
1103 $(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
1104 $(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
1105 $(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
1106 $(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
1108 # Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
1110 #SDK_GNU_ERROR := true
1112 $(INTERNAL_SDK_TARGET): $(deps)
1113 @echo "Package SDK: $@"
1114 $(hide) rm -rf $(PRIVATE_DIR) $@
1115 $(hide) for f in $(target_gnu_MODULES); do \
1116 if [ -f $$f ]; then \
1117 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
1118 including GNU target $$f >&2; \
1119 FAIL=$(SDK_GNU_ERROR); \
1122 if [ $$FAIL ]; then exit 1; fi
1124 $(HOST_OUT_EXECUTABLES)/atree \
1125 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
1126 -m $(PRIVATE_DEP_FILE) \
1130 -I $(TARGET_COMMON_OUT_ROOT) \
1131 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
1132 -o $(PRIVATE_DIR) && \
1133 cp -f $(target_notice_file_txt) \
1134 $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \
1135 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
1136 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
1137 development/tools/scripts/sdk_clean.sh $(PRIVATE_DIR) && \
1138 chmod -R ug+rwX $(PRIVATE_DIR) && \
1139 cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
1140 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
1144 # -----------------------------------------------------------------
1146 INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
1147 INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
1148 $(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
1150 $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \
1152 $(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
1153 @echo ConvertXmlToText: $@
1154 $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
1155 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
1157 # -----------------------------------------------------------------
1160 # -----------------------------------------------------------------
1161 # These are some additional build tasks that need to be run.
1162 include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))