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)
79 # Selects the first locale in the list given as the argument,
80 # and splits it into language and region, which each may be
83 $(subst _, , $(firstword $(1)))
86 # Selects the first locale in the list given as the argument
87 # and returns the language (or the region)
88 define default-locale-language
89 $(word 2, 2, $(call default-locale, $(1)))
91 define default-locale-region
92 $(word 3, 3, $(call default-locale, $(1)))
95 BUILDINFO_SH := build/tools/buildinfo.sh
96 $(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE)
97 @echo Target buildinfo: $@
99 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
100 TARGET_DEVICE="$(TARGET_DEVICE)" \
101 PRODUCT_NAME="$(TARGET_PRODUCT)" \
102 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
103 PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \
104 PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \
105 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
106 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
107 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
108 BUILD_ID="$(BUILD_ID)" \
109 BUILD_NUMBER="$(BUILD_NUMBER)" \
110 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
111 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
112 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
113 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
114 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
115 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
116 bash $(BUILDINFO_SH) > $@
117 $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
118 cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
120 $(if $(ADDITIONAL_BUILD_PROPERTIES), \
121 $(hide) echo >> $@; \
123 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
125 $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \
126 echo "$(line)" >> $@;)
130 # -----------------------------------------------------------------
133 # There are certain things in build.prop that we don't want to
134 # ship with the sdk; remove them.
136 # This must be a list of entire property keys followed by
137 # "=" characters, without any internal spaces.
138 sdk_build_prop_remove := \
142 ro.product.manufacturer= \
144 # TODO: Remove this soon-to-be obsolete property
145 sdk_build_prop_remove += ro.build.product=
146 INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
147 $(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
148 @echo SDK buildinfo: $@
150 $(hide) grep -v "$(subst $(space),\|,$(strip \
151 $(sdk_build_prop_remove)))" $< > $@.tmp
152 $(hide) for x in $(sdk_build_prop_remove); do \
153 echo "$$x"generic >> $@.tmp; done
156 # -----------------------------------------------------------------
158 PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
159 PACKAGES_TO_STAT := \
160 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
161 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
162 $(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
163 @echo Package stats: $@
166 $(hide) build/tools/dump-package-stats $^ > $@
168 .PHONY: package-stats
169 package-stats: $(PACKAGE_STATS_FILE)
171 # -----------------------------------------------------------------
172 # Cert-to-package mapping. Used by the post-build signing tools.
173 name := $(TARGET_PRODUCT)
174 ifeq ($(TARGET_BUILD_TYPE),debug)
175 name := $(name)_debug
177 name := $(name)-apkcerts-$(FILE_NAME_TAG)
179 $(call intermediates-dir-for,PACKAGING,apkcerts)
180 APKCERTS_FILE := $(intermediates)/$(name).txt
181 # Depending on the built packages isn't exactly right,
182 # but it should guarantee that the apkcerts file is rebuilt
183 # if any packages change which certs they're signed with.
184 all_built_packages := $(foreach p,$(PACKAGES),$(ALL_MODULES.$(p).BUILT))
185 $(APKCERTS_FILE): $(all_built_packages)
186 @echo APK certs list: $@
189 $(hide) $(foreach p,$(PACKAGES),\
190 echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
191 private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;)
193 .PHONY: apkcerts-list
194 apkcerts-list: $(APKCERTS_FILE)
196 # -----------------------------------------------------------------
197 # installed file list
198 INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
199 $(INSTALLED_FILES_FILE): $(ALL_DEFAULT_INSTALLED_MODULES)
200 @echo Installed file list: $@
203 $(hide) (cd $(PRODUCT_OUT) && \
204 find system data -type f -printf 'name="%p" size=%s\n') | \
207 .PHONY: installed-file-list
208 installed-file-list: $(INSTALLED_FILES_FILE)
210 # -----------------------------------------------------------------
212 ifdef CREATE_MODULE_INFO_FILE
213 MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt
214 $(info Generating $(MODULE_INFO_FILE)...)
215 $(shell rm -f $(MODULE_INFO_FILE))
216 $(foreach m,$(ALL_MODULES), \
217 $(shell echo "NAME=\"$(m)\"" \
218 "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \
219 "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \
220 "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \
221 "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE)))
224 # Rules that need to be present for the simulator, even
225 # if they don't do anything.
229 ifneq ($(TARGET_SIMULATOR),true)
231 # #################################################################
232 # Targets for boot/OS images
233 # #################################################################
235 # -----------------------------------------------------------------
237 INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
239 $(ALL_COPIED_HEADERS) \
240 $(ALL_GENERATED_SOURCES) \
241 $(ALL_DEFAULT_INSTALLED_MODULES))
243 INSTALLED_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
244 $(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES)
245 $(call pretty,"Target ram disk: $@")
246 $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | gzip > $@
249 ifneq ($(strip $(TARGET_NO_KERNEL)),true)
251 # -----------------------------------------------------------------
252 # the boot image, which is a collection of other images.
253 INTERNAL_BOOTIMAGE_ARGS := \
254 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
255 --kernel $(INSTALLED_KERNEL_TARGET) \
256 --ramdisk $(INSTALLED_RAMDISK_TARGET)
258 INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
260 BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
261 ifdef BOARD_KERNEL_CMDLINE
262 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
265 INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
267 ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
268 tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg
269 INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image)
270 INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG)
271 $(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES)
272 $(call pretty,"Target boot image: $@")
273 $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
275 else # TARGET_BOOTIMAGE_USE_EXT2 != true
277 $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
278 $(call pretty,"Target boot image: $@")
279 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
280 $(hide) $(call assert-max-file-size,$@,$(BOARD_BOOTIMAGE_MAX_SIZE))
281 endif # TARGET_BOOTIMAGE_USE_EXT2
283 else # TARGET_NO_KERNEL
284 # HACK: The top-level targets depend on the bootimage. Not all targets
285 # can produce a bootimage, though, and emulator targets need the ramdisk
286 # instead. Fake it out by calling the ramdisk the bootimage.
287 # TODO: make the emulator use bootimages, and make mkbootimg accept
288 # kernel-less inputs.
289 INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
292 # -----------------------------------------------------------------
295 # This needs to be before the systemimage rules, because it adds to
296 # ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
297 # go into the systemimage.
301 # Create the rule to combine the files into text and html forms
302 # $(1) - Plain text output file
303 # $(2) - HTML output file
305 # $(4) - Directory to use. Notice files are all $(4)/src. Other
306 # directories in there will be used for scratch
307 # $(5) - Dependencies for the output files
309 # The algorithm here is that we go collect a hash for each of the notice
310 # files and write the names of the files that match that hash. Then
311 # to generate the real files, we go print out all of the files and their
314 # These rules are fairly complex, so they depend on this makefile so if
315 # it changes, they'll run again.
317 # TODO: We could clean this up so that we just record the locations of the
318 # original notice files instead of making rules to copy them somwehere.
319 # Then we could traverse that without quite as much bash drama.
320 define combine-notice-files
321 $(1) $(2): PRIVATE_MESSAGE := $(3)
322 $(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
323 $(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
324 @echo Finding NOTICE files: $$@
325 $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
326 $$(hide) mkdir -p $$(PRIVATE_DIR)/hash
327 $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
328 hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
329 hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
330 echo $$$$file >> $$$$hashfile; \
333 $(1): $(4)/hash-timestamp
334 @echo Combining NOTICE files: $$@
335 $$(hide) mkdir -p $$(dir $$@)
336 $$(hide) echo $$(PRIVATE_MESSAGE) > $$@
337 $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
338 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> $$@
342 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
343 echo "============================================================"\
345 echo "Notices for file(s):" >> $$@; \
346 cat $$$$hashfile | sort | \
347 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> \
349 echo "------------------------------------------------------------"\
352 orig=$$$$(head -n 1 $$$$hashfile); \
353 cat $$$$orig >> $$@; \
358 $(2): $(4)/hash-timestamp
359 @echo Combining NOTICE files: $$@
360 $$(hide) mkdir -p $$(dir $$@)
361 $$(hide) echo "<html><head>" > $$@
362 $$(hide) echo "<style type=\"text/css\">" >> $$@
363 $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
364 $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
365 $$(hide) echo ".label { font-weight: bold; }" >> $$@
366 $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
367 $$(hide) echo "</style>" >> $$@
368 $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
369 $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
371 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
372 cat $$$$hashfile | sort | \
373 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: <a name=\"\1\"></a>:" >> \
375 echo "<tr><td class=\"same-license\">" >> $$@; \
376 echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
377 echo "<div class=\"file-list\">" >> $$@; \
378 cat $$$$hashfile | sort | \
379 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1<br/>:" >> $$@; \
380 echo "</div><!-- file-list -->" >> $$@; \
382 orig=$$$$(head -n 1 $$$$hashfile); \
383 echo "<pre class=\"license-text\">" >> $$@; \
384 cat $$$$orig | sed -e "s/\&/\&/g" | sed -e "s/</\</g" \
385 | sed -e "s/>/\>/g" >> $$@; \
386 echo "</pre><!-- license-text -->" >> $$@; \
387 echo "</td></tr><!-- same-license -->" >> $$@; \
392 $$(hide) echo "</table>" >> $$@
393 $$(hide) echo "</body></html>" >> $$@
394 notice_files: $(1) $(2)
397 # TODO These intermediate NOTICE.txt/NOTICE.html files should go into
398 # TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
399 # the src subdirectory.
401 target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
402 target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
403 target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
404 tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
405 tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
407 kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
409 $(eval $(call combine-notice-files, \
410 $(target_notice_file_txt), \
411 $(target_notice_file_html), \
412 "Notices for files contained in the filesystem images in this directory:", \
413 $(TARGET_OUT_NOTICE_FILES), \
414 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file)))
416 $(eval $(call combine-notice-files, \
417 $(tools_notice_file_txt), \
418 $(tools_notice_file_html), \
419 "Notices for files contained in the tools directory:", \
420 $(HOST_OUT_NOTICE_FILES), \
421 $(ALL_DEFAULT_INSTALLED_MODULES)))
423 # Install the html file at /system/etc/NOTICE.html.gz.
424 # This is not ideal, but this is very late in the game, after a lot of
425 # the module processing has already been done -- in fact, we used the
426 # fact that all that has been done to get the list of modules that we
427 # need notice files for.
428 $(target_notice_file_html_gz): $(target_notice_file_html)
430 installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
431 $(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
432 $(copy-file-to-target)
433 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
435 # The kernel isn't really a module, so to get its module file in there, we
436 # make the target NOTICE files depend on this particular file too, which will
437 # then be in the right directory for the find in combine-notice-files to work.
438 $(kernel_notice_file): \
439 prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \
442 $(hide) mkdir -p $(dir $@)
446 # #################################################################
447 # Targets for user images
448 # #################################################################
450 ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
451 include external/genext2fs/Config.mk
452 INTERNAL_MKUSERFS := $(MKEXT2IMG)
454 INTERNAL_MKUSERFS := $(MKYAFFS2)
457 # -----------------------------------------------------------------
460 # First, the "unoptimized" image, which contains .apk/.jar files
461 # that contain regular, unoptimized/unverified .dex entries.
463 systemimage_unopt_intermediates := \
464 $(call intermediates-dir-for,PACKAGING,systemimage_unopt)
465 BUILT_SYSTEMIMAGE_UNOPT := $(systemimage_unopt_intermediates)/system.img
467 INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
469 $(ALL_COPIED_HEADERS) \
470 $(ALL_GENERATED_SOURCES) \
471 $(ALL_DEFAULT_INSTALLED_MODULES))
473 ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
474 ## generate an ext2 image
476 define build-systemimage-target
477 @echo "Target system fs image: $(1)"
478 $(call build-userimage-ext2-target,$(TARGET_OUT),$(1),system,)
481 else # TARGET_USERIMAGES_USE_EXT2 != true
483 ## generate a yaffs2 image
485 define build-systemimage-target
486 @echo "Target system fs image: $(1)"
487 @mkdir -p $(dir $(1))
488 $(hide) $(MKYAFFS2) -f $(TARGET_OUT) $(1)
490 endif # TARGET_USERIMAGES_USE_EXT2
492 $(BUILT_SYSTEMIMAGE_UNOPT): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_MKUSERFS)
493 $(call build-systemimage-target,$@)
495 # The installed image, which may be optimized or unoptimized.
497 INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
500 ifndef DISABLE_DEXPREOPT
501 with_dexpreopt := true
505 # This file will set BUILT_SYSTEMIMAGE and SYSTEMIMAGE_SOURCE_DIR
506 include build/tools/dexpreopt/Config.mk
508 BUILT_SYSTEMIMAGE := $(BUILT_SYSTEMIMAGE_UNOPT)
509 SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
512 $(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) | $(ACP)
513 @echo "Install system fs image: $@"
514 $(copy-file-to-target)
515 $(hide) $(call assert-max-file-size,$@,$(BOARD_SYSTEMIMAGE_MAX_SIZE))
517 systemimage: $(INSTALLED_SYSTEMIMAGE)
519 .PHONY: systemimage-nodeps snod
520 systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
521 | $(INTERNAL_MKUSERFS)
522 @echo "make $@: ignoring dependencies"
523 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
524 $(hide) $(call assert-max-file-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_MAX_SIZE))
528 define build-systemtarball-target
529 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
530 $(MKTARBALL) $(FS_GET_STATS) \
531 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
532 $(INSTALLED_SYSTEMTARBALL_TARGET)
535 system_tar := $(PRODUCT_OUT)/system.tar
536 INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).bz2
537 $(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
538 $(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
539 $(build-systemtarball-target)
541 .PHONY: systemtarball-nodeps
542 systemtarball-nodeps: $(FS_GET_STATS) \
543 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
544 $(build-systemtarball-target)
547 stnod: systemtarball-nodeps
550 # -----------------------------------------------------------------
551 # data partition image
552 INTERNAL_USERDATAIMAGE_FILES := \
553 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
555 ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
556 ## Generate an ext2 image
557 define build-userdataimage-target
558 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
559 $(call build-userimage-ext2-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),userdata,)
560 $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE))
563 else # TARGET_USERIMAGES_USE_EXT2 != true
565 ## Generate a yaffs2 image
566 define build-userdataimage-target
567 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
568 $(hide) $(MKYAFFS2) -f $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
569 $(hide) $(call assert-max-file-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_MAX_SIZE))
571 endif # TARGET_USERIMAGES_USE_EXT2
573 INSTALLED_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
574 $(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_MKUSERFS) \
575 $(INTERNAL_USERDATAIMAGE_FILES)
576 $(build-userdataimage-target)
578 .PHONY: userdataimage-nodeps
579 userdataimage-nodeps: $(INTERNAL_MKUSERFS)
580 $(build-userdataimage-target)
583 ## data partition tarball
584 define build-userdatatarball-target
585 $(call pretty,"Target userdata fs tarball: " \
586 "$(INSTALLED_USERDATATARBALL_TARGET)")
587 $(MKTARBALL) $(FS_GET_STATS) \
588 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
589 $(INSTALLED_USERDATATARBALL_TARGET)
592 userdata_tar := $(PRODUCT_OUT)/userdata.tar
593 INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
594 $(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
595 $(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
596 $(build-userdatatarball-target)
598 .PHONY: userdatatarball-nodeps
599 userdatatarball-nodeps: $(FS_GET_STATS)
600 $(build-userdatatarball-target)
603 # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
604 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
606 # -----------------------------------------------------------------
608 INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
610 recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
611 recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
612 recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
613 recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
614 recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
615 recovery_resources := $(call include-path-for, recovery)/res
617 INTERNAL_RECOVERYIMAGE_ARGS := \
618 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
619 --kernel $(recovery_kernel) \
620 --ramdisk $(recovery_ramdisk)
622 # Assumes this has already been stripped
623 ifdef BOARD_KERNEL_CMDLINE
624 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
627 $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) \
628 $(INSTALLED_RAMDISK_TARGET) \
629 $(INSTALLED_BOOTIMAGE_TARGET) \
631 $(recovery_initrc) $(recovery_kernel) \
632 $(INSTALLED_2NDBOOTLOADER_TARGET) \
633 $(recovery_build_prop)
634 @echo ----- Making recovery image ------
635 rm -rf $(TARGET_RECOVERY_OUT)
636 mkdir -p $(TARGET_RECOVERY_OUT)
637 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)
638 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc
639 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
640 echo Copying baseline ramdisk...
641 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
642 echo Modifying ramdisk contents...
643 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
644 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
645 cp -rf $(recovery_resources) $(TARGET_RECOVERY_ROOT_OUT)/
646 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
647 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
648 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | gzip > $(recovery_ramdisk)
649 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
650 @echo ----- Made recovery image -------- $@
651 $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE))
654 INSTALLED_RECOVERYIMAGE_TARGET :=
657 .PHONY: recoveryimage
658 recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
660 # -----------------------------------------------------------------
661 # bring in the installer image generation defines if necessary
662 ifeq ($(TARGET_USE_DISKINSTALLER),true)
663 include bootable/diskinstaller/config.mk
666 # -----------------------------------------------------------------
668 name := $(TARGET_PRODUCT)
669 ifeq ($(TARGET_BUILD_TYPE),debug)
670 name := $(name)_debug
672 name := $(name)-ota-$(FILE_NAME_TAG)
674 INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
675 INTERNAL_OTA_INTERMEDIATES_DIR := $(call intermediates-dir-for,PACKAGING,ota)
677 # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
678 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
679 INTERNAL_OTA_RECOVERYIMAGE_TARGET := $(INTERNAL_OTA_INTERMEDIATES_DIR)/system/recovery.img
681 INTERNAL_OTA_RECOVERYIMAGE_TARGET :=
683 INTERNAL_OTA_SCRIPT_TARGET := $(INTERNAL_OTA_INTERMEDIATES_DIR)/META-INF/com/google/android/update-script
685 # Sign OTA packages with the test key by default.
686 # Actual product deliverables will be re-signed by hand.
687 private_key := $(SRC_TARGET_DIR)/product/security/testkey.pk8
688 certificate := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
689 $(INTERNAL_OTA_PACKAGE_TARGET): $(private_key) $(certificate) $(SIGNAPK_JAR)
690 $(INTERNAL_OTA_PACKAGE_TARGET): PRIVATE_PRIVATE_KEY := $(private_key)
691 $(INTERNAL_OTA_PACKAGE_TARGET): PRIVATE_CERTIFICATE := $(certificate)
693 # Depending on INSTALLED_SYSTEMIMAGE guarantees that SYSTEMIMAGE_SOURCE_DIR
694 # is up-to-date. We use jar instead of zip so that we can use the -C
695 # switch to avoid cd-ing all over the place.
696 # TODO: Make our own jar-creation tool to avoid all these shenanigans.
697 $(INTERNAL_OTA_PACKAGE_TARGET): \
698 $(INTERNAL_OTA_SCRIPT_TARGET) \
699 $(INTERNAL_OTA_RECOVERYIMAGE_TARGET) \
700 $(INSTALLED_BOOTIMAGE_TARGET) \
701 $(INSTALLED_RADIOIMAGE_TARGET) \
702 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
703 $(INSTALLED_SYSTEMIMAGE)
704 @echo "Package OTA: $@"
708 $(INSTALLED_BOOTIMAGE_TARGET) \
709 $(INSTALLED_RADIOIMAGE_TARGET) \
710 $(INSTALLED_ANDROID_INFO_TXT_TARGET), \
711 -C $(dir $(item)) $(notdir $(item))) \
712 -C $(INTERNAL_OTA_INTERMEDIATES_DIR) .
713 $(hide) find $(SYSTEMIMAGE_SOURCE_DIR) -type f -print | \
714 sed 's|^$(dir $(SYSTEMIMAGE_SOURCE_DIR))|-C & |' | \
716 $(hide) if jar tf $@ | egrep '.{65}' >&2; then \
717 echo "Path too long (>64 chars) for OTA update" >&2; \
722 $(INTERNAL_OTA_SCRIPT_TARGET): \
723 $(HOST_OUT_EXECUTABLES)/make-update-script \
724 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
725 $(INSTALLED_SYSTEMIMAGE)
728 @echo "Update script: $@"
729 $(hide) TARGET_DEVICE=$(TARGET_DEVICE) \
730 $< $(SYSTEMIMAGE_SOURCE_DIR) \
731 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
734 ifneq (,$(INTERNAL_OTA_RECOVERYIMAGE_TARGET))
735 # This copy is so recovery.img can be in /system within the OTA package.
736 # That way it gets installed into the system image, which in turn installs it.
737 $(INTERNAL_OTA_RECOVERYIMAGE_TARGET): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ACP)
743 otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
745 # Keys authorized to sign OTA packages this build will accept.
746 ifeq ($(INCLUDE_TEST_OTA_KEYS),true)
748 $(sort $(SRC_TARGET_DIR)/product/security/testkey.x509.pem $(OTA_PUBLIC_KEYS))
751 ifeq ($(OTA_PUBLIC_KEYS),)
752 $(error No OTA_PUBLIC_KEYS defined)
755 # Build a keystore with the authorized keys in it.
756 # java/android/android/server/checkin/UpdateVerifier.java uses this.
757 ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
758 $(TARGET_OUT_ETC)/security/otacerts.zip: $(OTA_PUBLIC_KEYS)
760 $(hide) mkdir -p $(dir $@)
761 zip -qj $@ $(OTA_PUBLIC_KEYS)
763 # The device does not support JKS.
764 # $(hide) for f in $(OTA_PUBLIC_KEYS); do \
765 # echo "keytool: $@ <= $$f" && \
766 # keytool -keystore $@ -storepass $(notdir $@) -noprompt \
767 # -import -file $$f -alias $(notdir $$f) || exit 1; \
770 ifdef RECOVERY_INSTALL_OTA_KEYS_INC
771 # Generate a C-includable file containing the keys.
772 # RECOVERY_INSTALL_OTA_KEYS_INC is defined by recovery/Android.mk.
773 # *** THIS IS A TOTAL HACK; EXECUTABLES MUST NOT CHANGE BETWEEN DIFFERENT
774 # PRODUCTS/BUILD TYPES. ***
775 # TODO: make recovery read the keys from an external file.
776 DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
777 $(RECOVERY_INSTALL_OTA_KEYS_INC): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
778 $(RECOVERY_INSTALL_OTA_KEYS_INC): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR)
779 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)"
782 $(hide) java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@
785 # -----------------------------------------------------------------
786 # A zip of the directories that map to the target filesystem.
787 # This zip can be used to create an OTA package or filesystem image
788 # as a post-build step.
790 name := $(TARGET_PRODUCT)
791 ifeq ($(TARGET_BUILD_TYPE),debug)
792 name := $(name)_debug
794 name := $(name)-target_files-$(FILE_NAME_TAG)
796 intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
797 BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
798 $(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
799 $(BUILT_TARGET_FILES_PACKAGE): \
800 zip_root := $(intermediates)/$(name)
802 # $(1): Directory to copy
803 # $(2): Location to copy it to
804 # The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
805 define package_files-copy-root
806 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
808 $(ACP) -rd $(strip $(1))/* $(2); \
812 # Depending on the various images guarantees that the underlying
813 # directories are up-to-date.
814 $(BUILT_TARGET_FILES_PACKAGE): \
815 $(INTERNAL_OTA_SCRIPT_TARGET) \
816 $(INSTALLED_BOOTIMAGE_TARGET) \
817 $(INSTALLED_RADIOIMAGE_TARGET) \
818 $(INSTALLED_RECOVERYIMAGE_TARGET) \
819 $(BUILT_SYSTEMIMAGE) \
820 $(INSTALLED_USERDATAIMAGE_TARGET) \
821 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
822 $(INTERNAL_OTA_SCRIPT_TARGET) \
825 @echo "Package target files: $@"
826 $(hide) rm -rf $@ $(zip_root)
827 $(hide) mkdir -p $(dir $@) $(zip_root)
828 @# Components of the recovery image
829 $(hide) mkdir -p $(zip_root)/RECOVERY
830 $(hide) $(call package_files-copy-root, \
831 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
832 ifdef INSTALLED_KERNEL_TARGET
833 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
835 ifdef INSTALLED_2NDBOOTLOADER_TARGET
837 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
839 ifdef BOARD_KERNEL_CMDLINE
840 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
842 @# Components of the boot image
843 $(hide) mkdir -p $(zip_root)/BOOT
844 $(hide) $(call package_files-copy-root, \
845 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
846 ifdef INSTALLED_KERNEL_TARGET
847 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
849 ifdef INSTALLED_2NDBOOTLOADER_TARGET
851 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
853 ifdef BOARD_KERNEL_CMDLINE
854 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
856 ifdef INSTALLED_RADIOIMAGE_TARGET
858 $(hide) mkdir -p $(zip_root)/RADIO
859 $(hide) $(ACP) $(INSTALLED_RADIOIMAGE_TARGET) $(zip_root)/RADIO/image
861 @# Contents of the system image
862 $(hide) $(call package_files-copy-root, \
863 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
864 @# Contents of the data image
865 $(hide) $(call package_files-copy-root, \
866 $(TARGET_OUT_DATA),$(zip_root)/DATA)
867 @# Extra contents of the OTA package
868 $(hide) mkdir -p $(zip_root)/OTA
869 $(hide) $(call package_files-copy-root, \
870 $(INTERNAL_OTA_INTERMEDIATES_DIR),$(zip_root)/OTA)
871 $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
872 @# Files that don't end up in any images, but are necessary to
874 $(hide) mkdir -p $(zip_root)/META
875 $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
876 @# Zip everything up, preserving symlinks
877 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
879 target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
881 # -----------------------------------------------------------------
882 # A zip of the tests that are built when running "make tests".
883 # This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
884 # only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
886 name := $(TARGET_PRODUCT)
887 ifeq ($(TARGET_BUILD_TYPE),debug)
888 name := $(name)_debug
890 name := $(name)-tests-$(FILE_NAME_TAG)
892 intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
893 BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
894 $(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
895 $(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
897 # Depending on the images guarantees that the underlying
898 # directories are up-to-date.
899 $(BUILT_TESTS_ZIP_PACKAGE): \
900 $(BUILT_SYSTEMIMAGE) \
901 $(INSTALLED_USERDATAIMAGE_TARGET) \
903 @echo "Package test files: $@"
904 $(hide) rm -rf $@ $(zip_root)
905 $(hide) mkdir -p $(dir $@) $(zip_root)
906 @# Some parts of the system image
907 $(hide) $(call package_files-copy-root, \
908 $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
909 $(hide) $(call package_files-copy-root, \
910 $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
911 $(hide) $(call package_files-copy-root, \
912 $(SYSTEMIMAGE_SOURCE_DIR)/framework, \
913 $(zip_root)/SYSTEM/framework)
914 $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
915 @# Contents of the data image
916 $(hide) $(call package_files-copy-root, \
917 $(TARGET_OUT_DATA),$(zip_root)/DATA)
918 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
920 tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
922 # -----------------------------------------------------------------
923 # A zip of the symbols directory. Keep the full paths to make it
924 # more obvious where these files came from.
926 name := $(TARGET_PRODUCT)
927 ifeq ($(TARGET_BUILD_TYPE),debug)
928 name := $(name)_debug
930 name := $(name)-symbols-$(FILE_NAME_TAG)
932 SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
933 $(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET)
934 @echo "Package symbols: $@"
936 $(hide) mkdir -p $(dir $@)
937 $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
939 # -----------------------------------------------------------------
940 # A zip of the Android Apps. Not keeping full path so that we don't
941 # include product names when distributing
943 name := $(TARGET_PRODUCT)
944 ifeq ($(TARGET_BUILD_TYPE),debug)
945 name := $(name)_debug
947 name := $(name)-apps-$(FILE_NAME_TAG)
949 APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
950 $(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
951 @echo "Package apps: $@"
953 $(hide) mkdir -p $(dir $@)
954 $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
956 endif # TARGET_SIMULATOR != true
958 # -----------------------------------------------------------------
961 dalvikfiles: $(INTERNAL_DALVIK_MODULES)
963 # -----------------------------------------------------------------
966 INTERNAL_UPDATE_PACKAGE_FILES += \
967 $(INSTALLED_BOOTIMAGE_TARGET) \
968 $(INSTALLED_RECOVERYIMAGE_TARGET) \
969 $(INSTALLED_SYSTEMIMAGE) \
970 $(INSTALLED_USERDATAIMAGE_TARGET) \
971 $(INSTALLED_ANDROID_INFO_TXT_TARGET)
973 ifneq ($(strip $(INTERNAL_UPDATE_PACKAGE_FILES)),)
975 name := $(TARGET_PRODUCT)
976 ifeq ($(TARGET_BUILD_TYPE),debug)
977 name := $(name)_debug
979 name := $(name)-img-$(FILE_NAME_TAG)
981 INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
983 $(INTERNAL_UPDATE_PACKAGE_TARGET): $(INTERNAL_UPDATE_PACKAGE_FILES)
985 $(hide) zip -qj $@ $(INTERNAL_UPDATE_PACKAGE_FILES)
988 INTERNAL_UPDATE_PACKAGE_TARGET :=
991 # -----------------------------------------------------------------
992 # The emulator package
994 ifneq ($(TARGET_SIMULATOR),true)
996 INTERNAL_EMULATOR_PACKAGE_FILES += \
997 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
998 prebuilt/android-arm/kernel/kernel-qemu \
999 $(INSTALLED_RAMDISK_TARGET) \
1000 $(INSTALLED_SYSTEMIMAGE) \
1001 $(INSTALLED_USERDATAIMAGE_TARGET)
1003 name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
1005 INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1007 $(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
1009 $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
1013 # -----------------------------------------------------------------
1014 # The pdk package (Platform Development Kit)
1016 ifneq (,$(filter pdk,$(MAKECMDGOALS)))
1017 include development/pdk/Pdk.mk
1020 # -----------------------------------------------------------------
1023 ifneq ($(TARGET_SIMULATOR),true)
1025 # The SDK includes host-specific components, so it belongs under HOST_OUT.
1026 sdk_dir := $(HOST_OUT)/sdk
1028 # Build a name that looks like:
1030 # linux-x86 --> android-sdk_12345_linux-x86
1031 # darwin-x86 --> android-sdk_12345_mac-x86
1032 # windows-x86 --> android-sdk_12345_windows
1034 sdk_name := android-sdk_$(FILE_NAME_TAG)
1035 ifeq ($(HOST_OS),darwin)
1038 sdk_host_os := $(HOST_OS)
1040 ifneq ($(HOST_OS),windows)
1041 sdk_host_os := $(sdk_host_os)-$(HOST_ARCH)
1043 sdk_name := $(sdk_name)_$(sdk_host_os)
1045 sdk_dep_file := $(sdk_dir)/sdk_deps.mk
1048 -include $(sdk_dep_file)
1050 # if we don't have a real list, then use "everything"
1051 ifeq ($(strip $(ATREE_FILES)),)
1054 $(ALL_COPIED_HEADERS) \
1055 $(ALL_GENERATED_SOURCES) \
1056 $(ALL_DEFAULT_INSTALLED_MODULES) \
1057 $(INSTALLED_RAMDISK_TARGET) \
1062 atree_dir := development/build
1064 sdk_atree_files := \
1065 $(atree_dir)/sdk.exclude.atree \
1066 $(atree_dir)/sdk.atree \
1067 $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree
1070 $(target_notice_file_txt) \
1071 $(tools_notice_file_txt) \
1072 $(OUT_DOCS)/offline-sdk-timestamp \
1073 $(INTERNAL_UPDATE_PACKAGE_TARGET) \
1074 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
1076 $(atree_dir)/sdk.atree \
1077 $(HOST_OUT_EXECUTABLES)/atree \
1078 $(HOST_OUT_EXECUTABLES)/line_endings
1080 INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
1081 $(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
1082 $(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
1083 $(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
1084 $(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
1086 # Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
1088 #SDK_GNU_ERROR := true
1090 $(INTERNAL_SDK_TARGET): $(deps)
1091 @echo "Package SDK: $@"
1092 $(hide) rm -rf $(PRIVATE_DIR) $@
1093 $(hide) for f in $(target_gnu_MODULES); do \
1094 if [ -f $$f ]; then \
1095 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
1096 including GNU target $$f >&2; \
1097 FAIL=$(SDK_GNU_ERROR); \
1100 if [ $$FAIL ]; then exit 1; fi
1102 $(HOST_OUT_EXECUTABLES)/atree \
1103 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
1104 -m $(PRIVATE_DEP_FILE) \
1108 -I $(TARGET_COMMON_OUT_ROOT) \
1109 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
1110 -o $(PRIVATE_DIR) && \
1111 cp -f $(target_notice_file_txt) \
1112 $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \
1113 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
1114 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
1115 development/tools/scripts/sdk_clean.sh $(PRIVATE_DIR) && \
1116 chmod -R ug+rwX $(PRIVATE_DIR) && \
1117 cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
1118 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
1122 # -----------------------------------------------------------------
1124 INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
1125 INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
1126 $(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
1128 $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \
1130 $(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
1131 @echo ConvertXmlToText: $@
1132 $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
1133 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
1135 # -----------------------------------------------------------------
1138 # -----------------------------------------------------------------
1139 # These are some additional build tasks that need to be run.
1140 include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))