blob: 05a9b8680d68e2180b56d809a2c7d7190830ea5d [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# 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$(foreach cf,$(PRODUCT_COPY_FILES), \
Joe Onorato64d85d02009-04-09 19:31:12 -070018 $(eval _src := $(call word-colon,1,$(cf))) \
19 $(eval _dest := $(call \
20 append-path,$(PRODUCT_OUT),$(call word-colon,2,$(cf)))) \
The Android Open Source Project88b60792009-03-03 19:28:42 -080021 $(eval $(call copy-one-file,$(_src),$(_dest))) \
22 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_dest)) \
23 )
24
25# -----------------------------------------------------------------
26# docs/index.html
27gen := $(OUT_DOCS)/index.html
28ALL_DOCS += $(gen)
29$(gen): frameworks/base/docs/docs-redirect-index.html
30 @mkdir -p $(dir $@)
31 @cp -f $< $@
32
33# -----------------------------------------------------------------
34# default.prop
35INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
36ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
37ADDITIONAL_DEFAULT_PROPERTIES := \
38 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
39
40$(INSTALLED_DEFAULT_PROP_TARGET):
41 @echo Target buildinfo: $@
42 @mkdir -p $(dir $@)
43 $(hide) echo "#" > $@; \
44 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
45 echo "#" >> $@;
46 $(hide) $(foreach line,$(ADDITIONAL_DEFAULT_PROPERTIES), \
47 echo "$(line)" >> $@;)
48
49# -----------------------------------------------------------------
50# build.prop
51INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
52ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
53ADDITIONAL_BUILD_PROPERTIES := \
54 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
55
56# A list of arbitrary tags describing the build configuration.
57# Force ":=" so we can use +=
58BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
59ifeq ($(TARGET_BUILD_TYPE),debug)
60 BUILD_VERSION_TAGS += debug
61endif
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.
64BUILD_VERSION_TAGS += test-keys
The Android Open Source Project88b60792009-03-03 19:28:42 -080065BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
66
67# A human-readable string that descibes this build in detail.
68build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS)
69$(INSTALLED_BUILD_PROP_TARGET): PRIVATE_BUILD_DESC := $(build_desc)
70
71# The string used to uniquely identify this build; used by the OTA server.
72ifeq (,$(strip $(BUILD_FINGERPRINT)))
73 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE)/$(TARGET_BOOTLOADER_BOARD_NAME):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
74endif
75ifneq ($(words $(BUILD_FINGERPRINT)),1)
76 $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
77endif
78
Sriram Raman7b641242009-03-24 22:40:59 -070079# Display parameters shown under Settings -> About Phone
80ifeq ($(TARGET_BUILD_VARIANT),user)
81 # User builds should show:
82 # release build number or branch.buld_number non-release builds
83
84 # Dev. branches should have DISPLAY_BUILD_NUMBER set
85 ifeq "true" "$(DISPLAY_BUILD_NUMBER)"
86 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER)
87 else
88 BUILD_DISPLAY_ID := $(BUILD_ID)
89 endif
90else
91 # Non-user builds should show detailed build information
92 BUILD_DISPLAY_ID := $(build_desc)
93endif
94
The Android Open Source Project88b60792009-03-03 19:28:42 -080095# Selects the first locale in the list given as the argument,
96# and splits it into language and region, which each may be
97# empty.
98define default-locale
99$(subst _, , $(firstword $(1)))
100endef
101
102# Selects the first locale in the list given as the argument
103# and returns the language (or the region)
104define default-locale-language
105$(word 2, 2, $(call default-locale, $(1)))
106endef
107define default-locale-region
108$(word 3, 3, $(call default-locale, $(1)))
109endef
110
111BUILDINFO_SH := build/tools/buildinfo.sh
112$(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE)
113 @echo Target buildinfo: $@
114 @mkdir -p $(dir $@)
115 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
116 TARGET_DEVICE="$(TARGET_DEVICE)" \
117 PRODUCT_NAME="$(TARGET_PRODUCT)" \
118 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
119 PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \
120 PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \
Robert Greenwaltfbd10d92009-05-20 13:37:35 -0700121 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800122 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
123 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
124 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
125 BUILD_ID="$(BUILD_ID)" \
126 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
127 BUILD_NUMBER="$(BUILD_NUMBER)" \
128 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
129 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
Dianne Hackborn95378842009-05-08 12:06:17 -0700130 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800131 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
132 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
133 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
134 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
Dianne Hackbornecc70d72009-05-21 15:45:30 -0700135 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
David 'Digit' Turner2edfb712009-11-06 15:12:00 -0800136 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800137 bash $(BUILDINFO_SH) > $@
138 $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
139 cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
140 fi
141 $(if $(ADDITIONAL_BUILD_PROPERTIES), \
142 $(hide) echo >> $@; \
143 echo "#" >> $@; \
144 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
145 echo "#" >> $@; )
146 $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \
147 echo "$(line)" >> $@;)
148
149build_desc :=
150
151# -----------------------------------------------------------------
152# sdk-build.prop
153#
154# There are certain things in build.prop that we don't want to
155# ship with the sdk; remove them.
156
157# This must be a list of entire property keys followed by
158# "=" characters, without any internal spaces.
159sdk_build_prop_remove := \
160 ro.build.user= \
161 ro.build.host= \
162 ro.product.brand= \
163 ro.product.manufacturer= \
164 ro.product.device=
165# TODO: Remove this soon-to-be obsolete property
166sdk_build_prop_remove += ro.build.product=
167INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
168$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
169 @echo SDK buildinfo: $@
170 @mkdir -p $(dir $@)
171 $(hide) grep -v "$(subst $(space),\|,$(strip \
172 $(sdk_build_prop_remove)))" $< > $@.tmp
173 $(hide) for x in $(sdk_build_prop_remove); do \
174 echo "$$x"generic >> $@.tmp; done
175 $(hide) mv $@.tmp $@
176
177# -----------------------------------------------------------------
178# package stats
179PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
180PACKAGES_TO_STAT := \
181 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
182 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
183$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
184 @echo Package stats: $@
185 @mkdir -p $(dir $@)
186 $(hide) rm -f $@
187 $(hide) build/tools/dump-package-stats $^ > $@
188
189.PHONY: package-stats
190package-stats: $(PACKAGE_STATS_FILE)
191
192# -----------------------------------------------------------------
193# Cert-to-package mapping. Used by the post-build signing tools.
194name := $(TARGET_PRODUCT)
195ifeq ($(TARGET_BUILD_TYPE),debug)
196 name := $(name)_debug
197endif
198name := $(name)-apkcerts-$(FILE_NAME_TAG)
199intermediates := \
200 $(call intermediates-dir-for,PACKAGING,apkcerts)
201APKCERTS_FILE := $(intermediates)/$(name).txt
202# Depending on the built packages isn't exactly right,
203# but it should guarantee that the apkcerts file is rebuilt
204# if any packages change which certs they're signed with.
205all_built_packages := $(foreach p,$(PACKAGES),$(ALL_MODULES.$(p).BUILT))
206$(APKCERTS_FILE): $(all_built_packages)
207 @echo APK certs list: $@
208 @mkdir -p $(dir $@)
209 @rm -f $@
210 $(hide) $(foreach p,$(PACKAGES),\
211 echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
212 private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;)
213
214.PHONY: apkcerts-list
215apkcerts-list: $(APKCERTS_FILE)
216
217# -----------------------------------------------------------------
218# module info file
219ifdef CREATE_MODULE_INFO_FILE
220 MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt
221 $(info Generating $(MODULE_INFO_FILE)...)
222 $(shell rm -f $(MODULE_INFO_FILE))
223 $(foreach m,$(ALL_MODULES), \
224 $(shell echo "NAME=\"$(m)\"" \
225 "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \
226 "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \
227 "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \
228 "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE)))
229endif
230
Doug Zongker8678df42009-06-15 14:30:14 -0700231# -----------------------------------------------------------------
232
233# The test key is used to sign this package, and as the key required
234# for future OTA packages installed by this system. Actual product
235# deliverables will be re-signed by hand. We expect this file to
236# exist with the suffixes ".x509.pem" and ".pk8".
237DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey
238
239
The Android Open Source Project88b60792009-03-03 19:28:42 -0800240# Rules that need to be present for the simulator, even
241# if they don't do anything.
242.PHONY: systemimage
243systemimage:
244
245ifneq ($(TARGET_SIMULATOR),true)
246
247# #################################################################
248# Targets for boot/OS images
249# #################################################################
250
251# -----------------------------------------------------------------
252# the ramdisk
253INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
254 $(ALL_PREBUILT) \
255 $(ALL_COPIED_HEADERS) \
256 $(ALL_GENERATED_SOURCES) \
257 $(ALL_DEFAULT_INSTALLED_MODULES))
258
Joe Onorato64d85d02009-04-09 19:31:12 -0700259BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
260
261# We just build this directly to the install location.
262INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700263$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800264 $(call pretty,"Target ram disk: $@")
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700265 $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800266
267
268ifneq ($(strip $(TARGET_NO_KERNEL)),true)
269
270# -----------------------------------------------------------------
271# the boot image, which is a collection of other images.
272INTERNAL_BOOTIMAGE_ARGS := \
273 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
274 --kernel $(INSTALLED_KERNEL_TARGET) \
275 --ramdisk $(INSTALLED_RAMDISK_TARGET)
276
277INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
278
279BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
280ifdef BOARD_KERNEL_CMDLINE
281 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
282endif
283
Dima Zavin1e0847c2009-05-07 19:43:08 -0700284BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
285ifdef BOARD_KERNEL_BASE
286 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
287endif
288
The Android Open Source Project88b60792009-03-03 19:28:42 -0800289INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
290
291ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
292tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg
293INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image)
294INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG)
295$(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES)
296 $(call pretty,"Target boot image: $@")
297 $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
298
299else # TARGET_BOOTIMAGE_USE_EXT2 != true
300
301$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
302 $(call pretty,"Target boot image: $@")
303 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
Doug Zongkered96e882009-08-26 09:37:07 -0700304 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800305endif # TARGET_BOOTIMAGE_USE_EXT2
306
307else # TARGET_NO_KERNEL
308# HACK: The top-level targets depend on the bootimage. Not all targets
309# can produce a bootimage, though, and emulator targets need the ramdisk
310# instead. Fake it out by calling the ramdisk the bootimage.
311# TODO: make the emulator use bootimages, and make mkbootimg accept
312# kernel-less inputs.
313INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
314endif
315
316# -----------------------------------------------------------------
317# NOTICE files
318#
319# This needs to be before the systemimage rules, because it adds to
320# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
321# go into the systemimage.
322
323.PHONY: notice_files
324
325# Create the rule to combine the files into text and html forms
326# $(1) - Plain text output file
327# $(2) - HTML output file
328# $(3) - File title
329# $(4) - Directory to use. Notice files are all $(4)/src. Other
330# directories in there will be used for scratch
331# $(5) - Dependencies for the output files
332#
333# The algorithm here is that we go collect a hash for each of the notice
334# files and write the names of the files that match that hash. Then
335# to generate the real files, we go print out all of the files and their
336# hashes.
337#
338# These rules are fairly complex, so they depend on this makefile so if
339# it changes, they'll run again.
340#
341# TODO: We could clean this up so that we just record the locations of the
342# original notice files instead of making rules to copy them somwehere.
343# Then we could traverse that without quite as much bash drama.
344define combine-notice-files
345$(1) $(2): PRIVATE_MESSAGE := $(3)
346$(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
347$(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
348 @echo Finding NOTICE files: $$@
349 $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
350 $$(hide) mkdir -p $$(PRIVATE_DIR)/hash
351 $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
352 hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
353 hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
354 echo $$$$file >> $$$$hashfile; \
355 done
356 $$(hide) touch $$@
357$(1): $(4)/hash-timestamp
358 @echo Combining NOTICE files: $$@
359 $$(hide) mkdir -p $$(dir $$@)
360 $$(hide) echo $$(PRIVATE_MESSAGE) > $$@
361 $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
362 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> $$@
363 $$(hide) echo >> $$@
364 $$(hide) echo >> $$@
365 $$(hide) echo >> $$@
366 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
367 echo "============================================================"\
368 >> $$@; \
369 echo "Notices for file(s):" >> $$@; \
370 cat $$$$hashfile | sort | \
371 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> \
372 $$@; \
373 echo "------------------------------------------------------------"\
374 >> $$@; \
375 echo >> $$@; \
376 orig=$$$$(head -n 1 $$$$hashfile); \
377 cat $$$$orig >> $$@; \
378 echo >> $$@; \
379 echo >> $$@; \
380 echo >> $$@; \
381 done
382$(2): $(4)/hash-timestamp
383 @echo Combining NOTICE files: $$@
384 $$(hide) mkdir -p $$(dir $$@)
385 $$(hide) echo "<html><head>" > $$@
386 $$(hide) echo "<style type=\"text/css\">" >> $$@
387 $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
388 $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
389 $$(hide) echo ".label { font-weight: bold; }" >> $$@
390 $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
391 $$(hide) echo "</style>" >> $$@
392 $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
393 $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
394 >> $$@
395 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
396 cat $$$$hashfile | sort | \
397 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: <a name=\"\1\"></a>:" >> \
398 $$@; \
399 echo "<tr><td class=\"same-license\">" >> $$@; \
400 echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
401 echo "<div class=\"file-list\">" >> $$@; \
402 cat $$$$hashfile | sort | \
403 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1<br/>:" >> $$@; \
404 echo "</div><!-- file-list -->" >> $$@; \
405 echo >> $$@; \
406 orig=$$$$(head -n 1 $$$$hashfile); \
407 echo "<pre class=\"license-text\">" >> $$@; \
408 cat $$$$orig | sed -e "s/\&/\&amp;/g" | sed -e "s/</\&lt;/g" \
409 | sed -e "s/>/\&gt;/g" >> $$@; \
410 echo "</pre><!-- license-text -->" >> $$@; \
411 echo "</td></tr><!-- same-license -->" >> $$@; \
412 echo >> $$@; \
413 echo >> $$@; \
414 echo >> $$@; \
415 done
416 $$(hide) echo "</table>" >> $$@
417 $$(hide) echo "</body></html>" >> $$@
418notice_files: $(1) $(2)
419endef
420
421# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
422# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
423# the src subdirectory.
424
425target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
426target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
427target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
428tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
429tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
430
431kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
432
433$(eval $(call combine-notice-files, \
434 $(target_notice_file_txt), \
435 $(target_notice_file_html), \
436 "Notices for files contained in the filesystem images in this directory:", \
437 $(TARGET_OUT_NOTICE_FILES), \
438 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file)))
439
440$(eval $(call combine-notice-files, \
441 $(tools_notice_file_txt), \
442 $(tools_notice_file_html), \
443 "Notices for files contained in the tools directory:", \
444 $(HOST_OUT_NOTICE_FILES), \
445 $(ALL_DEFAULT_INSTALLED_MODULES)))
446
447# Install the html file at /system/etc/NOTICE.html.gz.
448# This is not ideal, but this is very late in the game, after a lot of
449# the module processing has already been done -- in fact, we used the
450# fact that all that has been done to get the list of modules that we
451# need notice files for.
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700452$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
Doug Zongker8678df42009-06-15 14:30:14 -0700453 $(hide) $(MINIGZIP) -9 < $< > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800454installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
455$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
456 $(copy-file-to-target)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700457
458# if we've been run my mm, mmm, etc, don't reinstall this every time
459ifeq ($(ONE_SHOT_MAKEFILE),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800460ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700461endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800462
463# The kernel isn't really a module, so to get its module file in there, we
464# make the target NOTICE files depend on this particular file too, which will
465# then be in the right directory for the find in combine-notice-files to work.
466$(kernel_notice_file): \
467 prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \
468 | $(ACP)
469 @echo Copying: $@
470 $(hide) mkdir -p $(dir $@)
471 $(hide) $(ACP) $< $@
472
473
Doug Zongker8678df42009-06-15 14:30:14 -0700474# -----------------------------------------------------------------
Doug Zongker9bd49622009-11-30 14:28:59 -0800475
476.PHONY: event-log-tags
477
478event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
479ALL_PREBUILT += $(event_log_tag_file)
480
481# Include tags from all packages included in this product.
482event_log_tags_src := \
483 $(sort $(foreach m,\
484 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
485 $(call module-names-for-tag-list,user), \
486 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
487
488$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
489$(event_log_tags_file): $(event_log_tags_src)
490 $(hide) mkdir -p $(dir $@)
491 $(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
492
493event-log-tags: $(event_log_tags_file)
494
495# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700496# Build a keystore with the authorized keys in it, used to verify the
497# authenticity of downloaded OTA packages.
498#
499# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
500# before the rules that use that variable to build the image.
501ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
502$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Doug Zongker37c0e272009-06-15 15:36:16 -0700503$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
Doug Zongker8678df42009-06-15 14:30:14 -0700504 $(hide) rm -f $@
505 $(hide) mkdir -p $(dir $@)
Doug Zongker37c0e272009-06-15 15:36:16 -0700506 $(hide) zip -qj $@ $<
Doug Zongker8678df42009-06-15 14:30:14 -0700507
508.PHONY: otacerts
509otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
510
511
The Android Open Source Project88b60792009-03-03 19:28:42 -0800512# #################################################################
513# Targets for user images
514# #################################################################
515
516ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
517include external/genext2fs/Config.mk
518INTERNAL_MKUSERFS := $(MKEXT2IMG)
519else
520INTERNAL_MKUSERFS := $(MKYAFFS2)
521endif
522
523# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -0700524# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700525
526# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
Brian Swetland630b7d32009-08-07 18:09:44 -0700527ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID)))
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700528
Doug Zongker4647f122009-07-02 09:00:54 -0700529INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
530
531recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
532recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
533recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
534recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
535recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
536recovery_resources_common := $(call include-path-for, recovery)/res
537recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
538recovery_resource_deps := $(shell find $(recovery_resources_common) \
539 $(recovery_resources_private) -type f)
540
541ifeq ($(recovery_resources_private),)
542 $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
543endif
544
545INTERNAL_RECOVERYIMAGE_ARGS := \
546 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
547 --kernel $(recovery_kernel) \
548 --ramdisk $(recovery_ramdisk)
549
550# Assumes this has already been stripped
551ifdef BOARD_KERNEL_CMDLINE
552 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
553endif
554ifdef BOARD_KERNEL_BASE
555 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
556endif
557
558# Keys authorized to sign OTA packages this build will accept. The
559# build always uses test-keys for this; release packaging tools will
560# substitute other keys for this one.
561OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
562
563# Generate a file containing the keys that will be read by the
564# recovery binary.
565RECOVERY_INSTALL_OTA_KEYS := \
566 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
567DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
568$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
569$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR)
570 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)"
571 @rm -rf $@
572 @mkdir -p $(dir $@)
573 java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@
574
575$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
576 $(INSTALLED_RAMDISK_TARGET) \
577 $(INSTALLED_BOOTIMAGE_TARGET) \
578 $(recovery_binary) \
579 $(recovery_initrc) $(recovery_kernel) \
580 $(INSTALLED_2NDBOOTLOADER_TARGET) \
581 $(recovery_build_prop) $(recovery_resource_deps) \
582 $(RECOVERY_INSTALL_OTA_KEYS)
583 @echo ----- Making recovery image ------
584 rm -rf $(TARGET_RECOVERY_OUT)
585 mkdir -p $(TARGET_RECOVERY_OUT)
586 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)
587 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc
588 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
589 echo Copying baseline ramdisk...
590 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
591 echo Modifying ramdisk contents...
592 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
593 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
594 cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
595 $(foreach item,$(recovery_resources_private), \
596 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
597 cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
598 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
599 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
600 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
601 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
602 @echo ----- Made recovery image -------- $@
Doug Zongkered96e882009-08-26 09:37:07 -0700603 $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
Doug Zongker4647f122009-07-02 09:00:54 -0700604
605else
606INSTALLED_RECOVERYIMAGE_TARGET :=
607endif
608
609.PHONY: recoveryimage
610recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
611
612# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800613# system yaffs image
614#
615# First, the "unoptimized" image, which contains .apk/.jar files
616# that contain regular, unoptimized/unverified .dex entries.
617#
618systemimage_unopt_intermediates := \
619 $(call intermediates-dir-for,PACKAGING,systemimage_unopt)
620BUILT_SYSTEMIMAGE_UNOPT := $(systemimage_unopt_intermediates)/system.img
621
622INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
623 $(ALL_PREBUILT) \
624 $(ALL_COPIED_HEADERS) \
625 $(ALL_GENERATED_SOURCES) \
626 $(ALL_DEFAULT_INSTALLED_MODULES))
627
628ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
629## generate an ext2 image
630# $(1): output file
631define build-systemimage-target
632 @echo "Target system fs image: $(1)"
633 $(call build-userimage-ext2-target,$(TARGET_OUT),$(1),system,)
634endef
635
636else # TARGET_USERIMAGES_USE_EXT2 != true
637
638## generate a yaffs2 image
639# $(1): output file
640define build-systemimage-target
641 @echo "Target system fs image: $(1)"
642 @mkdir -p $(dir $(1))
643 $(hide) $(MKYAFFS2) -f $(TARGET_OUT) $(1)
644endef
645endif # TARGET_USERIMAGES_USE_EXT2
646
647$(BUILT_SYSTEMIMAGE_UNOPT): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_MKUSERFS)
648 $(call build-systemimage-target,$@)
649
650# The installed image, which may be optimized or unoptimized.
651#
652INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
653
654ifdef WITH_DEXPREOPT
655 ifndef DISABLE_DEXPREOPT
656 with_dexpreopt := true
657 endif
658endif
659ifdef with_dexpreopt
660 # This file will set BUILT_SYSTEMIMAGE and SYSTEMIMAGE_SOURCE_DIR
661 include build/tools/dexpreopt/Config.mk
662else
663 BUILT_SYSTEMIMAGE := $(BUILT_SYSTEMIMAGE_UNOPT)
664 SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
665endif
666
Doug Zongker73ef8252009-07-23 15:12:53 -0700667# The system partition needs room for the recovery image as well. We
668# now store the recovery image as a binary patch using the boot image
669# as the source (since they are very similar). Generate the patch so
670# we can see how big it's going to be, and include that in the system
671# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -0700672ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Doug Zongker73ef8252009-07-23 15:12:53 -0700673intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
674RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
675$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
676 $(INSTALLED_BOOTIMAGE_TARGET) \
Doug Zongker22bc5172009-07-23 18:27:43 -0700677 $(HOST_OUT_EXECUTABLES)/imgdiff \
678 $(HOST_OUT_EXECUTABLES)/bsdiff
Doug Zongker73ef8252009-07-23 15:12:53 -0700679 @echo "Construct recovery from boot"
680 mkdir -p $(dir $@)
Doug Zongkerb003d892009-07-23 18:48:38 -0700681 PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Sriram Raman1e96ac82009-07-24 13:52:32 -0700682endif
683
Doug Zongker73ef8252009-07-23 15:12:53 -0700684
685$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800686 @echo "Install system fs image: $@"
687 $(copy-file-to-target)
Doug Zongkered96e882009-08-26 09:37:07 -0700688 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800689
690systemimage: $(INSTALLED_SYSTEMIMAGE)
691
692.PHONY: systemimage-nodeps snod
693systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
694 | $(INTERNAL_MKUSERFS)
695 @echo "make $@: ignoring dependencies"
696 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Doug Zongkered96e882009-08-26 09:37:07 -0700697 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800698
699#######
700## system tarball
701define build-systemtarball-target
702 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
703 $(MKTARBALL) $(FS_GET_STATS) \
704 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
705 $(INSTALLED_SYSTEMTARBALL_TARGET)
706endef
707
708system_tar := $(PRODUCT_OUT)/system.tar
709INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).bz2
710$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
711$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
712 $(build-systemtarball-target)
713
714.PHONY: systemtarball-nodeps
715systemtarball-nodeps: $(FS_GET_STATS) \
716 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
717 $(build-systemtarball-target)
718
719.PHONY: stnod
720stnod: systemtarball-nodeps
721
722
723# -----------------------------------------------------------------
724# data partition image
725INTERNAL_USERDATAIMAGE_FILES := \
726 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
727
728ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
729## Generate an ext2 image
730define build-userdataimage-target
731 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
732 @mkdir -p $(TARGET_OUT_DATA)
733 $(call build-userimage-ext2-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),userdata,)
Doug Zongkered96e882009-08-26 09:37:07 -0700734 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800735endef
736
737else # TARGET_USERIMAGES_USE_EXT2 != true
738
739## Generate a yaffs2 image
740define build-userdataimage-target
741 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
742 @mkdir -p $(TARGET_OUT_DATA)
743 $(hide) $(MKYAFFS2) -f $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
Doug Zongkered96e882009-08-26 09:37:07 -0700744 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800745endef
746endif # TARGET_USERIMAGES_USE_EXT2
747
Joe Onorato64d85d02009-04-09 19:31:12 -0700748BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
749
750# We just build this directly to the install location.
751INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800752$(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_MKUSERFS) \
753 $(INTERNAL_USERDATAIMAGE_FILES)
754 $(build-userdataimage-target)
755
756.PHONY: userdataimage-nodeps
757userdataimage-nodeps: $(INTERNAL_MKUSERFS)
758 $(build-userdataimage-target)
759
760#######
761## data partition tarball
762define build-userdatatarball-target
763 $(call pretty,"Target userdata fs tarball: " \
764 "$(INSTALLED_USERDATATARBALL_TARGET)")
765 $(MKTARBALL) $(FS_GET_STATS) \
766 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
767 $(INSTALLED_USERDATATARBALL_TARGET)
768endef
769
770userdata_tar := $(PRODUCT_OUT)/userdata.tar
771INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
772$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
773$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
774 $(build-userdatatarball-target)
775
776.PHONY: userdatatarball-nodeps
777userdatatarball-nodeps: $(FS_GET_STATS)
778 $(build-userdatatarball-target)
779
780
The Android Open Source Project88b60792009-03-03 19:28:42 -0800781# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800782# bring in the installer image generation defines if necessary
783ifeq ($(TARGET_USE_DISKINSTALLER),true)
784include bootable/diskinstaller/config.mk
785endif
786
787# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700788# host tools needed to build OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -0800789
Doug Zongker8678df42009-06-15 14:30:14 -0700790.PHONY: otatools
791otatools: $(HOST_OUT_EXECUTABLES)/minigzip \
792 $(HOST_OUT_EXECUTABLES)/mkbootfs \
793 $(HOST_OUT_EXECUTABLES)/mkbootimg \
794 $(HOST_OUT_EXECUTABLES)/fs_config \
795 $(HOST_OUT_EXECUTABLES)/mkyaffs2image \
796 $(HOST_OUT_EXECUTABLES)/zipalign \
797 $(HOST_OUT_EXECUTABLES)/aapt \
798 $(HOST_OUT_EXECUTABLES)/bsdiff \
Doug Zongkerc494d7c2009-06-18 08:43:44 -0700799 $(HOST_OUT_EXECUTABLES)/imgdiff \
Doug Zongker8678df42009-06-15 14:30:14 -0700800 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
801 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar
The Android Open Source Project88b60792009-03-03 19:28:42 -0800802
The Android Open Source Project88b60792009-03-03 19:28:42 -0800803# -----------------------------------------------------------------
804# A zip of the directories that map to the target filesystem.
805# This zip can be used to create an OTA package or filesystem image
806# as a post-build step.
807#
808name := $(TARGET_PRODUCT)
809ifeq ($(TARGET_BUILD_TYPE),debug)
810 name := $(name)_debug
811endif
812name := $(name)-target_files-$(FILE_NAME_TAG)
813
814intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
815BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
816$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
817$(BUILT_TARGET_FILES_PACKAGE): \
818 zip_root := $(intermediates)/$(name)
819
820# $(1): Directory to copy
821# $(2): Location to copy it to
822# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
823define package_files-copy-root
824 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
825 mkdir -p $(2) && \
826 $(ACP) -rd $(strip $(1))/* $(2); \
827 fi
828endef
829
830built_ota_tools := \
Doug Zongker17c83cf2009-04-01 15:48:46 -0700831 $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
Doug Zongker6c770462009-07-22 18:27:31 -0700832 $(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \
Doug Zongkera406c1e2009-06-12 16:57:08 -0700833 $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \
834 $(call intermediates-dir-for,EXECUTABLES,updater)/updater
The Android Open Source Project88b60792009-03-03 19:28:42 -0800835$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
836
Doug Zongkerb1134dd2009-06-17 17:09:40 -0700837$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
838
Doug Zongkerc18736b2009-09-30 09:20:32 -0700839ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
840# default to common dir for device vendor
841$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common
842else
843$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
844endif
845
The Android Open Source Project88b60792009-03-03 19:28:42 -0800846# Depending on the various images guarantees that the underlying
847# directories are up-to-date.
848$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800849 $(INSTALLED_BOOTIMAGE_TARGET) \
850 $(INSTALLED_RADIOIMAGE_TARGET) \
851 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Doug Zongker4647f122009-07-02 09:00:54 -0700852 $(INSTALLED_SYSTEMIMAGE) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800853 $(INSTALLED_USERDATAIMAGE_TARGET) \
854 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800855 $(built_ota_tools) \
856 $(APKCERTS_FILE) \
857 | $(ACP)
858 @echo "Package target files: $@"
859 $(hide) rm -rf $@ $(zip_root)
860 $(hide) mkdir -p $(dir $@) $(zip_root)
861 @# Components of the recovery image
862 $(hide) mkdir -p $(zip_root)/RECOVERY
863 $(hide) $(call package_files-copy-root, \
864 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
865ifdef INSTALLED_KERNEL_TARGET
866 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
867endif
868ifdef INSTALLED_2NDBOOTLOADER_TARGET
869 $(hide) $(ACP) \
870 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
871endif
872ifdef BOARD_KERNEL_CMDLINE
873 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
874endif
Doug Zongker38a649f2009-06-17 09:07:09 -0700875ifdef BOARD_KERNEL_BASE
876 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
877endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800878 @# Components of the boot image
879 $(hide) mkdir -p $(zip_root)/BOOT
880 $(hide) $(call package_files-copy-root, \
881 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
882ifdef INSTALLED_KERNEL_TARGET
883 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
884endif
885ifdef INSTALLED_2NDBOOTLOADER_TARGET
886 $(hide) $(ACP) \
887 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
888endif
889ifdef BOARD_KERNEL_CMDLINE
890 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
891endif
Doug Zongker38a649f2009-06-17 09:07:09 -0700892ifdef BOARD_KERNEL_BASE
893 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
894endif
Doug Zongkere01100c2009-06-19 17:12:18 -0700895 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
896 mkdir -p $(zip_root)/RADIO; \
897 $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800898 @# Contents of the system image
899 $(hide) $(call package_files-copy-root, \
900 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
901 @# Contents of the data image
902 $(hide) $(call package_files-copy-root, \
903 $(TARGET_OUT_DATA),$(zip_root)/DATA)
904 @# Extra contents of the OTA package
905 $(hide) mkdir -p $(zip_root)/OTA/bin
The Android Open Source Project88b60792009-03-03 19:28:42 -0800906 $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
907 $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Doug Zongker8678df42009-06-15 14:30:14 -0700908 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -0800909 @# build them.
910 $(hide) mkdir -p $(zip_root)/META
911 $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Doug Zongker17c83cf2009-04-01 15:48:46 -0700912 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Doug Zongkerb1134dd2009-06-17 17:09:40 -0700913 $(hide) echo "$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/recovery-api-version.txt
Doug Zongker4647f122009-07-02 09:00:54 -0700914 $(hide) echo "blocksize $(BOARD_FLASH_BLOCK_SIZE)" > $(zip_root)/META/imagesizes.txt
Doug Zongker8510a1e2009-08-07 16:38:08 -0700915 $(hide) echo "boot $(call image-size-from-data-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
916 $(hide) echo "recovery $(call image-size-from-data-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
917 $(hide) echo "system $(call image-size-from-data-size,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
918 $(hide) echo "userdata $(call image-size-from-data-size,$(BOARD_USERDATAIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
Doug Zongkerc18736b2009-09-30 09:20:32 -0700919 $(hide) echo "$(tool_extensions)" > $(zip_root)/META/tool-extensions.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -0800920 @# Zip everything up, preserving symlinks
921 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
922
923target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
924
925# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700926# OTA update package
Doug Zongker367910f2009-06-15 18:56:51 -0700927
928ifneq ($(TARGET_SIMULATOR),true)
929ifneq ($(TARGET_PRODUCT),sdk)
Sriram Ramanb11428e2009-07-24 12:02:28 -0700930ifneq ($(TARGET_PRODUCT),generic)
Doug Zongker367910f2009-06-15 18:56:51 -0700931
Doug Zongker8678df42009-06-15 14:30:14 -0700932name := $(TARGET_PRODUCT)
933ifeq ($(TARGET_BUILD_TYPE),debug)
934 name := $(name)_debug
935endif
936name := $(name)-ota-$(FILE_NAME_TAG)
937
938INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
939
940$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
941
Doug Zongker659fc552009-06-23 09:46:33 -0700942ifeq ($(TARGET_OTA_SCRIPT_MODE),)
943# default to "auto"
944$(INTERNAL_OTA_PACKAGE_TARGET): scriptmode := auto
945else
946$(INTERNAL_OTA_PACKAGE_TARGET): scriptmode := $(TARGET_OTA_SCRIPT_MODE)
947endif
948
Doug Zongker8678df42009-06-15 14:30:14 -0700949$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools
950 @echo "Package OTA: $@"
951 $(hide) ./build/tools/releasetools/ota_from_target_files \
Doug Zongkerc18736b2009-09-30 09:20:32 -0700952 -m $(scriptmode) \
Doug Zongker602a84e2009-06-18 08:35:12 -0700953 -p $(HOST_OUT) \
Doug Zongker8678df42009-06-15 14:30:14 -0700954 -k $(KEY_CERT_PAIR) \
955 $(BUILT_TARGET_FILES_PACKAGE) $@
956
957.PHONY: otapackage
958otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
959
Sriram Ramanb11428e2009-07-24 12:02:28 -0700960endif # TARGET_PRODUCT != generic
Doug Zongker367910f2009-06-15 18:56:51 -0700961endif # TARGET_PRODUCT != sdk
962endif # TARGET_SIMULATOR != true
Doug Zongker8678df42009-06-15 14:30:14 -0700963
964# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800965# installed file list
966# Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it
967# gets the DexOpt one if we're doing that.
968INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
969$(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE)
970 @echo Installed file list: $@
971 @mkdir -p $(dir $@)
972 @rm -f $@
973 $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@
974
975.PHONY: installed-file-list
976installed-file-list: $(INSTALLED_FILES_FILE)
977$(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE))
Joe Onorato03fbe402009-04-13 08:31:16 -0700978$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800979
980# -----------------------------------------------------------------
981# A zip of the tests that are built when running "make tests".
982# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
983# only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
984#
985name := $(TARGET_PRODUCT)
986ifeq ($(TARGET_BUILD_TYPE),debug)
987 name := $(name)_debug
988endif
989name := $(name)-tests-$(FILE_NAME_TAG)
990
991intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
992BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
993$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
994$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
995
996# Depending on the images guarantees that the underlying
997# directories are up-to-date.
998$(BUILT_TESTS_ZIP_PACKAGE): \
999 $(BUILT_SYSTEMIMAGE) \
1000 $(INSTALLED_USERDATAIMAGE_TARGET) \
1001 | $(ACP)
1002 @echo "Package test files: $@"
1003 $(hide) rm -rf $@ $(zip_root)
1004 $(hide) mkdir -p $(dir $@) $(zip_root)
1005 @# Some parts of the system image
1006 $(hide) $(call package_files-copy-root, \
1007 $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
1008 $(hide) $(call package_files-copy-root, \
1009 $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
1010 $(hide) $(call package_files-copy-root, \
1011 $(SYSTEMIMAGE_SOURCE_DIR)/framework, \
1012 $(zip_root)/SYSTEM/framework)
1013 $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
1014 @# Contents of the data image
1015 $(hide) $(call package_files-copy-root, \
1016 $(TARGET_OUT_DATA),$(zip_root)/DATA)
1017 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
1018
1019tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
1020
1021# -----------------------------------------------------------------
1022# A zip of the symbols directory. Keep the full paths to make it
1023# more obvious where these files came from.
1024#
1025name := $(TARGET_PRODUCT)
1026ifeq ($(TARGET_BUILD_TYPE),debug)
1027 name := $(name)_debug
1028endif
1029name := $(name)-symbols-$(FILE_NAME_TAG)
1030
1031SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
1032$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET)
1033 @echo "Package symbols: $@"
1034 $(hide) rm -rf $@
1035 $(hide) mkdir -p $(dir $@)
1036 $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
1037
1038# -----------------------------------------------------------------
1039# A zip of the Android Apps. Not keeping full path so that we don't
1040# include product names when distributing
1041#
1042name := $(TARGET_PRODUCT)
1043ifeq ($(TARGET_BUILD_TYPE),debug)
1044 name := $(name)_debug
1045endif
1046name := $(name)-apps-$(FILE_NAME_TAG)
1047
1048APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
1049$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
1050 @echo "Package apps: $@"
1051 $(hide) rm -rf $@
1052 $(hide) mkdir -p $(dir $@)
1053 $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
1054
1055endif # TARGET_SIMULATOR != true
1056
1057# -----------------------------------------------------------------
1058# dalvik something
1059.PHONY: dalvikfiles
1060dalvikfiles: $(INTERNAL_DALVIK_MODULES)
1061
1062# -----------------------------------------------------------------
1063# The update package
1064
Doug Zongker367910f2009-06-15 18:56:51 -07001065ifneq ($(TARGET_SIMULATOR),true)
1066ifneq ($(TARGET_PRODUCT),sdk)
1067
The Android Open Source Project88b60792009-03-03 19:28:42 -08001068name := $(TARGET_PRODUCT)
1069ifeq ($(TARGET_BUILD_TYPE),debug)
1070 name := $(name)_debug
1071endif
1072name := $(name)-img-$(FILE_NAME_TAG)
1073
1074INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1075
Doug Zongker659fc552009-06-23 09:46:33 -07001076ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
1077# default to common dir for device vendor
1078$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common
1079else
1080$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
1081endif
1082
Doug Zongker8678df42009-06-15 14:30:14 -07001083$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools
The Android Open Source Project88b60792009-03-03 19:28:42 -08001084 @echo "Package: $@"
Doug Zongker8678df42009-06-15 14:30:14 -07001085 $(hide) ./build/tools/releasetools/img_from_target_files \
Doug Zongker659fc552009-06-23 09:46:33 -07001086 -s $(extensions) \
Doug Zongker602a84e2009-06-18 08:35:12 -07001087 -p $(HOST_OUT) \
Doug Zongker8678df42009-06-15 14:30:14 -07001088 $(BUILT_TARGET_FILES_PACKAGE) $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08001089
Doug Zongker8678df42009-06-15 14:30:14 -07001090.PHONY: updatepackage
1091updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001092
Doug Zongker367910f2009-06-15 18:56:51 -07001093endif # TARGET_PRODUCT != sdk
1094endif # TARGET_SIMULATOR != true
1095
The Android Open Source Project88b60792009-03-03 19:28:42 -08001096# -----------------------------------------------------------------
1097# The emulator package
1098
1099ifneq ($(TARGET_SIMULATOR),true)
1100
1101INTERNAL_EMULATOR_PACKAGE_FILES += \
1102 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
1103 prebuilt/android-arm/kernel/kernel-qemu \
1104 $(INSTALLED_RAMDISK_TARGET) \
1105 $(INSTALLED_SYSTEMIMAGE) \
1106 $(INSTALLED_USERDATAIMAGE_TARGET)
1107
1108name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
1109
1110INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1111
1112$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
1113 @echo "Package: $@"
1114 $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
1115
1116endif
1117
1118# -----------------------------------------------------------------
1119# The pdk package (Platform Development Kit)
1120
1121ifneq (,$(filter pdk,$(MAKECMDGOALS)))
1122 include development/pdk/Pdk.mk
1123endif
1124
1125# -----------------------------------------------------------------
1126# The SDK
1127
1128ifneq ($(TARGET_SIMULATOR),true)
1129
1130# The SDK includes host-specific components, so it belongs under HOST_OUT.
1131sdk_dir := $(HOST_OUT)/sdk
1132
1133# Build a name that looks like:
1134#
1135# linux-x86 --> android-sdk_12345_linux-x86
1136# darwin-x86 --> android-sdk_12345_mac-x86
1137# windows-x86 --> android-sdk_12345_windows
1138#
1139sdk_name := android-sdk_$(FILE_NAME_TAG)
1140ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07001141 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08001142else
Joe Onorato03fbe402009-04-13 08:31:16 -07001143 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001144endif
1145ifneq ($(HOST_OS),windows)
Joe Onorato03fbe402009-04-13 08:31:16 -07001146 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001147endif
Joe Onorato03fbe402009-04-13 08:31:16 -07001148sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001149
1150sdk_dep_file := $(sdk_dir)/sdk_deps.mk
1151
1152ATREE_FILES :=
1153-include $(sdk_dep_file)
1154
1155# if we don't have a real list, then use "everything"
1156ifeq ($(strip $(ATREE_FILES)),)
1157ATREE_FILES := \
1158 $(ALL_PREBUILT) \
1159 $(ALL_COPIED_HEADERS) \
1160 $(ALL_GENERATED_SOURCES) \
1161 $(ALL_DEFAULT_INSTALLED_MODULES) \
1162 $(INSTALLED_RAMDISK_TARGET) \
1163 $(ALL_DOCS) \
1164 $(ALL_SDK_FILES)
1165endif
1166
1167atree_dir := development/build
1168
1169sdk_atree_files := \
1170 $(atree_dir)/sdk.exclude.atree \
1171 $(atree_dir)/sdk.atree \
1172 $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree
1173
1174deps := \
1175 $(target_notice_file_txt) \
1176 $(tools_notice_file_txt) \
1177 $(OUT_DOCS)/offline-sdk-timestamp \
Doug Zongkerdddd9572009-06-15 21:25:32 -07001178 $(INSTALLED_SYSTEMIMAGE) \
1179 $(INSTALLED_USERDATAIMAGE_TARGET) \
1180 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001181 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
1182 $(ATREE_FILES) \
1183 $(atree_dir)/sdk.atree \
1184 $(HOST_OUT_EXECUTABLES)/atree \
1185 $(HOST_OUT_EXECUTABLES)/line_endings
1186
1187INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
1188$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
1189$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
1190$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
1191$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
1192
1193# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
1194#
1195#SDK_GNU_ERROR := true
1196
1197$(INTERNAL_SDK_TARGET): $(deps)
1198 @echo "Package SDK: $@"
1199 $(hide) rm -rf $(PRIVATE_DIR) $@
1200 $(hide) for f in $(target_gnu_MODULES); do \
1201 if [ -f $$f ]; then \
1202 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
1203 including GNU target $$f >&2; \
1204 FAIL=$(SDK_GNU_ERROR); \
1205 fi; \
1206 done; \
1207 if [ $$FAIL ]; then exit 1; fi
1208 $(hide) ( \
1209 $(HOST_OUT_EXECUTABLES)/atree \
1210 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
1211 -m $(PRIVATE_DEP_FILE) \
1212 -I . \
1213 -I $(PRODUCT_OUT) \
1214 -I $(HOST_OUT) \
1215 -I $(TARGET_COMMON_OUT_ROOT) \
1216 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
1217 -o $(PRIVATE_DIR) && \
1218 cp -f $(target_notice_file_txt) \
1219 $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \
1220 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
1221 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Xavier Ducrohet1ae98802009-11-17 15:10:41 -08001222 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001223 chmod -R ug+rwX $(PRIVATE_DIR) && \
1224 cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
1225 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
1226
1227endif # !simulator
1228
1229# -----------------------------------------------------------------
1230# Findbugs
1231INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
1232INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
1233$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
1234 @echo UnionBugs: $@
1235 $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \
1236 > $@
1237$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
1238 @echo ConvertXmlToText: $@
1239 $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
1240 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
1241
1242# -----------------------------------------------------------------
1243# Findbugs
1244
1245# -----------------------------------------------------------------
1246# These are some additional build tasks that need to be run.
1247include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))