blob: 8523d548d9d6d5c6978dbe161bc7c12e7a397a63 [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),\
Doug Zongkerf6a53aa2009-12-15 15:06:55 -0800211 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
212 echo 'name="$(p).apk" certificate="EXTERNAL" \
213 private_key=""' >> $@;,\
214 echo 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
215 private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@;))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800216
217.PHONY: apkcerts-list
218apkcerts-list: $(APKCERTS_FILE)
219
220# -----------------------------------------------------------------
221# module info file
222ifdef CREATE_MODULE_INFO_FILE
223 MODULE_INFO_FILE := $(PRODUCT_OUT)/module-info.txt
224 $(info Generating $(MODULE_INFO_FILE)...)
225 $(shell rm -f $(MODULE_INFO_FILE))
226 $(foreach m,$(ALL_MODULES), \
227 $(shell echo "NAME=\"$(m)\"" \
228 "PATH=\"$(strip $(ALL_MODULES.$(m).PATH))\"" \
229 "TAGS=\"$(strip $(filter-out _%,$(ALL_MODULES.$(m).TAGS)))\"" \
230 "BUILT=\"$(strip $(ALL_MODULES.$(m).BUILT))\"" \
231 "INSTALLED=\"$(strip $(ALL_MODULES.$(m).INSTALLED))\"" >> $(MODULE_INFO_FILE)))
232endif
233
Doug Zongker8678df42009-06-15 14:30:14 -0700234# -----------------------------------------------------------------
235
236# The test key is used to sign this package, and as the key required
237# for future OTA packages installed by this system. Actual product
238# deliverables will be re-signed by hand. We expect this file to
239# exist with the suffixes ".x509.pem" and ".pk8".
240DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey
241
242
The Android Open Source Project88b60792009-03-03 19:28:42 -0800243# Rules that need to be present for the simulator, even
244# if they don't do anything.
245.PHONY: systemimage
246systemimage:
247
248ifneq ($(TARGET_SIMULATOR),true)
249
250# #################################################################
251# Targets for boot/OS images
252# #################################################################
253
254# -----------------------------------------------------------------
255# the ramdisk
256INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
257 $(ALL_PREBUILT) \
258 $(ALL_COPIED_HEADERS) \
259 $(ALL_GENERATED_SOURCES) \
260 $(ALL_DEFAULT_INSTALLED_MODULES))
261
Joe Onorato64d85d02009-04-09 19:31:12 -0700262BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
263
264# We just build this directly to the install location.
265INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700266$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800267 $(call pretty,"Target ram disk: $@")
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700268 $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800269
270
271ifneq ($(strip $(TARGET_NO_KERNEL)),true)
272
273# -----------------------------------------------------------------
274# the boot image, which is a collection of other images.
275INTERNAL_BOOTIMAGE_ARGS := \
276 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
277 --kernel $(INSTALLED_KERNEL_TARGET) \
278 --ramdisk $(INSTALLED_RAMDISK_TARGET)
279
280INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
281
282BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
283ifdef BOARD_KERNEL_CMDLINE
284 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
285endif
286
Dima Zavin1e0847c2009-05-07 19:43:08 -0700287BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
288ifdef BOARD_KERNEL_BASE
289 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
290endif
291
The Android Open Source Project88b60792009-03-03 19:28:42 -0800292INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
293
294ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
295tmp_dir_for_image := $(call intermediates-dir-for,EXECUTABLES,boot_img)/bootimg
296INTERNAL_BOOTIMAGE_ARGS += --tmpdir $(tmp_dir_for_image)
297INTERNAL_BOOTIMAGE_ARGS += --genext2fs $(MKEXT2IMG)
298$(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES)
299 $(call pretty,"Target boot image: $@")
300 $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
301
302else # TARGET_BOOTIMAGE_USE_EXT2 != true
303
304$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
305 $(call pretty,"Target boot image: $@")
306 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
Doug Zongkered96e882009-08-26 09:37:07 -0700307 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800308endif # TARGET_BOOTIMAGE_USE_EXT2
309
310else # TARGET_NO_KERNEL
311# HACK: The top-level targets depend on the bootimage. Not all targets
312# can produce a bootimage, though, and emulator targets need the ramdisk
313# instead. Fake it out by calling the ramdisk the bootimage.
314# TODO: make the emulator use bootimages, and make mkbootimg accept
315# kernel-less inputs.
316INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
317endif
318
319# -----------------------------------------------------------------
320# NOTICE files
321#
322# This needs to be before the systemimage rules, because it adds to
323# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
324# go into the systemimage.
325
326.PHONY: notice_files
327
328# Create the rule to combine the files into text and html forms
329# $(1) - Plain text output file
330# $(2) - HTML output file
331# $(3) - File title
332# $(4) - Directory to use. Notice files are all $(4)/src. Other
333# directories in there will be used for scratch
334# $(5) - Dependencies for the output files
335#
336# The algorithm here is that we go collect a hash for each of the notice
337# files and write the names of the files that match that hash. Then
338# to generate the real files, we go print out all of the files and their
339# hashes.
340#
341# These rules are fairly complex, so they depend on this makefile so if
342# it changes, they'll run again.
343#
344# TODO: We could clean this up so that we just record the locations of the
345# original notice files instead of making rules to copy them somwehere.
346# Then we could traverse that without quite as much bash drama.
347define combine-notice-files
348$(1) $(2): PRIVATE_MESSAGE := $(3)
349$(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
350$(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
351 @echo Finding NOTICE files: $$@
352 $$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
353 $$(hide) mkdir -p $$(PRIVATE_DIR)/hash
354 $$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
355 hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
356 hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
357 echo $$$$file >> $$$$hashfile; \
358 done
359 $$(hide) touch $$@
360$(1): $(4)/hash-timestamp
361 @echo Combining NOTICE files: $$@
362 $$(hide) mkdir -p $$(dir $$@)
363 $$(hide) echo $$(PRIVATE_MESSAGE) > $$@
364 $$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
365 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> $$@
366 $$(hide) echo >> $$@
367 $$(hide) echo >> $$@
368 $$(hide) echo >> $$@
369 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
370 echo "============================================================"\
371 >> $$@; \
372 echo "Notices for file(s):" >> $$@; \
373 cat $$$$hashfile | sort | \
374 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1:" >> \
375 $$@; \
376 echo "------------------------------------------------------------"\
377 >> $$@; \
378 echo >> $$@; \
379 orig=$$$$(head -n 1 $$$$hashfile); \
380 cat $$$$orig >> $$@; \
381 echo >> $$@; \
382 echo >> $$@; \
383 echo >> $$@; \
384 done
385$(2): $(4)/hash-timestamp
386 @echo Combining NOTICE files: $$@
387 $$(hide) mkdir -p $$(dir $$@)
388 $$(hide) echo "<html><head>" > $$@
389 $$(hide) echo "<style type=\"text/css\">" >> $$@
390 $$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
391 $$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
392 $$(hide) echo ".label { font-weight: bold; }" >> $$@
393 $$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
394 $$(hide) echo "</style>" >> $$@
395 $$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
396 $$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
397 >> $$@
398 $$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
399 cat $$$$hashfile | sort | \
400 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: <a name=\"\1\"></a>:" >> \
401 $$@; \
402 echo "<tr><td class=\"same-license\">" >> $$@; \
403 echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
404 echo "<div class=\"file-list\">" >> $$@; \
405 cat $$$$hashfile | sort | \
406 sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt: \1<br/>:" >> $$@; \
407 echo "</div><!-- file-list -->" >> $$@; \
408 echo >> $$@; \
409 orig=$$$$(head -n 1 $$$$hashfile); \
410 echo "<pre class=\"license-text\">" >> $$@; \
411 cat $$$$orig | sed -e "s/\&/\&amp;/g" | sed -e "s/</\&lt;/g" \
412 | sed -e "s/>/\&gt;/g" >> $$@; \
413 echo "</pre><!-- license-text -->" >> $$@; \
414 echo "</td></tr><!-- same-license -->" >> $$@; \
415 echo >> $$@; \
416 echo >> $$@; \
417 echo >> $$@; \
418 done
419 $$(hide) echo "</table>" >> $$@
420 $$(hide) echo "</body></html>" >> $$@
421notice_files: $(1) $(2)
422endef
423
424# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
425# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
426# the src subdirectory.
427
428target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
429target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
430target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
431tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
432tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
433
434kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
435
436$(eval $(call combine-notice-files, \
437 $(target_notice_file_txt), \
438 $(target_notice_file_html), \
439 "Notices for files contained in the filesystem images in this directory:", \
440 $(TARGET_OUT_NOTICE_FILES), \
441 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file)))
442
443$(eval $(call combine-notice-files, \
444 $(tools_notice_file_txt), \
445 $(tools_notice_file_html), \
446 "Notices for files contained in the tools directory:", \
447 $(HOST_OUT_NOTICE_FILES), \
448 $(ALL_DEFAULT_INSTALLED_MODULES)))
449
450# Install the html file at /system/etc/NOTICE.html.gz.
451# This is not ideal, but this is very late in the game, after a lot of
452# the module processing has already been done -- in fact, we used the
453# fact that all that has been done to get the list of modules that we
454# need notice files for.
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700455$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
Doug Zongker8678df42009-06-15 14:30:14 -0700456 $(hide) $(MINIGZIP) -9 < $< > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800457installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
458$(installed_notice_html_gz): $(target_notice_file_html_gz) | $(ACP)
459 $(copy-file-to-target)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700460
461# if we've been run my mm, mmm, etc, don't reinstall this every time
462ifeq ($(ONE_SHOT_MAKEFILE),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800463ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_gz)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700464endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800465
466# The kernel isn't really a module, so to get its module file in there, we
467# make the target NOTICE files depend on this particular file too, which will
468# then be in the right directory for the find in combine-notice-files to work.
469$(kernel_notice_file): \
470 prebuilt/$(TARGET_PREBUILT_TAG)/kernel/LINUX_KERNEL_COPYING \
471 | $(ACP)
472 @echo Copying: $@
473 $(hide) mkdir -p $(dir $@)
474 $(hide) $(ACP) $< $@
475
476
Doug Zongker8678df42009-06-15 14:30:14 -0700477# -----------------------------------------------------------------
Doug Zongker9bd49622009-11-30 14:28:59 -0800478
479.PHONY: event-log-tags
480
481event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
482ALL_PREBUILT += $(event_log_tag_file)
483
484# Include tags from all packages included in this product.
485event_log_tags_src := \
486 $(sort $(foreach m,\
487 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
488 $(call module-names-for-tag-list,user), \
489 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
490
491$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
492$(event_log_tags_file): $(event_log_tags_src)
493 $(hide) mkdir -p $(dir $@)
494 $(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
495
496event-log-tags: $(event_log_tags_file)
497
Doug Zongker672b05c2009-12-04 10:05:20 -0800498ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
499
Doug Zongker9bd49622009-11-30 14:28:59 -0800500# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700501# Build a keystore with the authorized keys in it, used to verify the
502# authenticity of downloaded OTA packages.
503#
504# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
505# before the rules that use that variable to build the image.
506ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
507$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Doug Zongker37c0e272009-06-15 15:36:16 -0700508$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
Doug Zongker8678df42009-06-15 14:30:14 -0700509 $(hide) rm -f $@
510 $(hide) mkdir -p $(dir $@)
Doug Zongker37c0e272009-06-15 15:36:16 -0700511 $(hide) zip -qj $@ $<
Doug Zongker8678df42009-06-15 14:30:14 -0700512
513.PHONY: otacerts
514otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
515
516
The Android Open Source Project88b60792009-03-03 19:28:42 -0800517# #################################################################
518# Targets for user images
519# #################################################################
520
521ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
522include external/genext2fs/Config.mk
523INTERNAL_MKUSERFS := $(MKEXT2IMG)
524else
525INTERNAL_MKUSERFS := $(MKYAFFS2)
526endif
527
528# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -0700529# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700530
531# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
Brian Swetland630b7d32009-08-07 18:09:44 -0700532ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID)))
Doug Zongker8cebf1f2009-07-07 17:14:25 -0700533
Doug Zongker4647f122009-07-02 09:00:54 -0700534INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
535
536recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
537recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
538recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
539recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
540recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
541recovery_resources_common := $(call include-path-for, recovery)/res
542recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
543recovery_resource_deps := $(shell find $(recovery_resources_common) \
544 $(recovery_resources_private) -type f)
545
546ifeq ($(recovery_resources_private),)
547 $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
548endif
549
550INTERNAL_RECOVERYIMAGE_ARGS := \
551 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
552 --kernel $(recovery_kernel) \
553 --ramdisk $(recovery_ramdisk)
554
555# Assumes this has already been stripped
556ifdef BOARD_KERNEL_CMDLINE
557 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
558endif
559ifdef BOARD_KERNEL_BASE
560 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
561endif
562
563# Keys authorized to sign OTA packages this build will accept. The
564# build always uses test-keys for this; release packaging tools will
565# substitute other keys for this one.
566OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem
567
568# Generate a file containing the keys that will be read by the
569# recovery binary.
570RECOVERY_INSTALL_OTA_KEYS := \
571 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
572DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
573$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
574$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR)
575 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)"
576 @rm -rf $@
577 @mkdir -p $(dir $@)
578 java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@
579
580$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
581 $(INSTALLED_RAMDISK_TARGET) \
582 $(INSTALLED_BOOTIMAGE_TARGET) \
583 $(recovery_binary) \
584 $(recovery_initrc) $(recovery_kernel) \
585 $(INSTALLED_2NDBOOTLOADER_TARGET) \
586 $(recovery_build_prop) $(recovery_resource_deps) \
587 $(RECOVERY_INSTALL_OTA_KEYS)
588 @echo ----- Making recovery image ------
589 rm -rf $(TARGET_RECOVERY_OUT)
590 mkdir -p $(TARGET_RECOVERY_OUT)
591 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)
592 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc
593 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
594 echo Copying baseline ramdisk...
595 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
596 echo Modifying ramdisk contents...
597 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
598 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
599 cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
600 $(foreach item,$(recovery_resources_private), \
601 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
602 cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
603 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
604 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop
605 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
606 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
607 @echo ----- Made recovery image -------- $@
Doug Zongkered96e882009-08-26 09:37:07 -0700608 $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
Doug Zongker4647f122009-07-02 09:00:54 -0700609
610else
611INSTALLED_RECOVERYIMAGE_TARGET :=
612endif
613
614.PHONY: recoveryimage
615recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
616
Dima Zavin11818982010-02-05 13:34:34 -0800617ifneq ($(BOARD_NAND_PAGE_SIZE),)
618mkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE)
619else
620mkyaffs2_extra_flags :=
621endif
622
623
Doug Zongker4647f122009-07-02 09:00:54 -0700624# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800625# system yaffs image
626#
627# First, the "unoptimized" image, which contains .apk/.jar files
628# that contain regular, unoptimized/unverified .dex entries.
629#
630systemimage_unopt_intermediates := \
631 $(call intermediates-dir-for,PACKAGING,systemimage_unopt)
632BUILT_SYSTEMIMAGE_UNOPT := $(systemimage_unopt_intermediates)/system.img
633
634INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
635 $(ALL_PREBUILT) \
636 $(ALL_COPIED_HEADERS) \
637 $(ALL_GENERATED_SOURCES) \
638 $(ALL_DEFAULT_INSTALLED_MODULES))
639
640ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
641## generate an ext2 image
642# $(1): output file
643define build-systemimage-target
644 @echo "Target system fs image: $(1)"
645 $(call build-userimage-ext2-target,$(TARGET_OUT),$(1),system,)
646endef
647
648else # TARGET_USERIMAGES_USE_EXT2 != true
649
650## generate a yaffs2 image
651# $(1): output file
652define build-systemimage-target
653 @echo "Target system fs image: $(1)"
654 @mkdir -p $(dir $(1))
Dima Zavin11818982010-02-05 13:34:34 -0800655 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800656endef
657endif # TARGET_USERIMAGES_USE_EXT2
658
659$(BUILT_SYSTEMIMAGE_UNOPT): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_MKUSERFS)
660 $(call build-systemimage-target,$@)
661
662# The installed image, which may be optimized or unoptimized.
663#
664INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
665
666ifdef WITH_DEXPREOPT
667 ifndef DISABLE_DEXPREOPT
668 with_dexpreopt := true
669 endif
670endif
671ifdef with_dexpreopt
672 # This file will set BUILT_SYSTEMIMAGE and SYSTEMIMAGE_SOURCE_DIR
673 include build/tools/dexpreopt/Config.mk
674else
675 BUILT_SYSTEMIMAGE := $(BUILT_SYSTEMIMAGE_UNOPT)
676 SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
677endif
678
Doug Zongker73ef8252009-07-23 15:12:53 -0700679# The system partition needs room for the recovery image as well. We
680# now store the recovery image as a binary patch using the boot image
681# as the source (since they are very similar). Generate the patch so
682# we can see how big it's going to be, and include that in the system
683# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -0700684ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Doug Zongker73ef8252009-07-23 15:12:53 -0700685intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
686RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
687$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
688 $(INSTALLED_BOOTIMAGE_TARGET) \
Doug Zongker22bc5172009-07-23 18:27:43 -0700689 $(HOST_OUT_EXECUTABLES)/imgdiff \
690 $(HOST_OUT_EXECUTABLES)/bsdiff
Doug Zongker73ef8252009-07-23 15:12:53 -0700691 @echo "Construct recovery from boot"
692 mkdir -p $(dir $@)
Doug Zongkerb003d892009-07-23 18:48:38 -0700693 PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Sriram Raman1e96ac82009-07-24 13:52:32 -0700694endif
695
Doug Zongker73ef8252009-07-23 15:12:53 -0700696
697$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800698 @echo "Install system fs image: $@"
699 $(copy-file-to-target)
Doug Zongkered96e882009-08-26 09:37:07 -0700700 $(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 -0800701
702systemimage: $(INSTALLED_SYSTEMIMAGE)
703
704.PHONY: systemimage-nodeps snod
705systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
706 | $(INTERNAL_MKUSERFS)
707 @echo "make $@: ignoring dependencies"
708 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Doug Zongkered96e882009-08-26 09:37:07 -0700709 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800710
711#######
712## system tarball
713define build-systemtarball-target
714 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
715 $(MKTARBALL) $(FS_GET_STATS) \
716 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
717 $(INSTALLED_SYSTEMTARBALL_TARGET)
718endef
719
720system_tar := $(PRODUCT_OUT)/system.tar
721INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).bz2
722$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
723$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
724 $(build-systemtarball-target)
725
726.PHONY: systemtarball-nodeps
727systemtarball-nodeps: $(FS_GET_STATS) \
728 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
729 $(build-systemtarball-target)
730
731.PHONY: stnod
732stnod: systemtarball-nodeps
733
734
735# -----------------------------------------------------------------
736# data partition image
737INTERNAL_USERDATAIMAGE_FILES := \
738 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
739
740ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
741## Generate an ext2 image
742define build-userdataimage-target
743 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
744 @mkdir -p $(TARGET_OUT_DATA)
745 $(call build-userimage-ext2-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),userdata,)
Doug Zongkered96e882009-08-26 09:37:07 -0700746 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800747endef
748
749else # TARGET_USERIMAGES_USE_EXT2 != true
750
751## Generate a yaffs2 image
752define build-userdataimage-target
753 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
754 @mkdir -p $(TARGET_OUT_DATA)
Dima Zavin11818982010-02-05 13:34:34 -0800755 $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
Doug Zongkered96e882009-08-26 09:37:07 -0700756 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800757endef
758endif # TARGET_USERIMAGES_USE_EXT2
759
Joe Onorato64d85d02009-04-09 19:31:12 -0700760BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
761
762# We just build this directly to the install location.
763INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800764$(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_MKUSERFS) \
765 $(INTERNAL_USERDATAIMAGE_FILES)
766 $(build-userdataimage-target)
767
768.PHONY: userdataimage-nodeps
769userdataimage-nodeps: $(INTERNAL_MKUSERFS)
770 $(build-userdataimage-target)
771
772#######
773## data partition tarball
774define build-userdatatarball-target
775 $(call pretty,"Target userdata fs tarball: " \
776 "$(INSTALLED_USERDATATARBALL_TARGET)")
777 $(MKTARBALL) $(FS_GET_STATS) \
778 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
779 $(INSTALLED_USERDATATARBALL_TARGET)
780endef
781
782userdata_tar := $(PRODUCT_OUT)/userdata.tar
783INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
784$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
785$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
786 $(build-userdatatarball-target)
787
788.PHONY: userdatatarball-nodeps
789userdatatarball-nodeps: $(FS_GET_STATS)
790 $(build-userdatatarball-target)
791
792
The Android Open Source Project88b60792009-03-03 19:28:42 -0800793# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800794# bring in the installer image generation defines if necessary
795ifeq ($(TARGET_USE_DISKINSTALLER),true)
796include bootable/diskinstaller/config.mk
797endif
798
799# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700800# host tools needed to build OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -0800801
Doug Zongker8678df42009-06-15 14:30:14 -0700802.PHONY: otatools
803otatools: $(HOST_OUT_EXECUTABLES)/minigzip \
804 $(HOST_OUT_EXECUTABLES)/mkbootfs \
805 $(HOST_OUT_EXECUTABLES)/mkbootimg \
806 $(HOST_OUT_EXECUTABLES)/fs_config \
807 $(HOST_OUT_EXECUTABLES)/mkyaffs2image \
808 $(HOST_OUT_EXECUTABLES)/zipalign \
809 $(HOST_OUT_EXECUTABLES)/aapt \
810 $(HOST_OUT_EXECUTABLES)/bsdiff \
Doug Zongkerc494d7c2009-06-18 08:43:44 -0700811 $(HOST_OUT_EXECUTABLES)/imgdiff \
Doug Zongker8678df42009-06-15 14:30:14 -0700812 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
813 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar
The Android Open Source Project88b60792009-03-03 19:28:42 -0800814
The Android Open Source Project88b60792009-03-03 19:28:42 -0800815# -----------------------------------------------------------------
816# A zip of the directories that map to the target filesystem.
817# This zip can be used to create an OTA package or filesystem image
818# as a post-build step.
819#
820name := $(TARGET_PRODUCT)
821ifeq ($(TARGET_BUILD_TYPE),debug)
822 name := $(name)_debug
823endif
824name := $(name)-target_files-$(FILE_NAME_TAG)
825
826intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
827BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
828$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
829$(BUILT_TARGET_FILES_PACKAGE): \
830 zip_root := $(intermediates)/$(name)
831
832# $(1): Directory to copy
833# $(2): Location to copy it to
834# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
835define package_files-copy-root
836 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
837 mkdir -p $(2) && \
838 $(ACP) -rd $(strip $(1))/* $(2); \
839 fi
840endef
841
842built_ota_tools := \
Doug Zongker17c83cf2009-04-01 15:48:46 -0700843 $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
Doug Zongker6c770462009-07-22 18:27:31 -0700844 $(call intermediates-dir-for,EXECUTABLES,applypatch_static)/applypatch_static \
Doug Zongkera406c1e2009-06-12 16:57:08 -0700845 $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq \
846 $(call intermediates-dir-for,EXECUTABLES,updater)/updater
The Android Open Source Project88b60792009-03-03 19:28:42 -0800847$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
848
Doug Zongkerb1134dd2009-06-17 17:09:40 -0700849$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
850
Doug Zongkerc18736b2009-09-30 09:20:32 -0700851ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
852# default to common dir for device vendor
853$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common
854else
855$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
856endif
857
The Android Open Source Project88b60792009-03-03 19:28:42 -0800858# Depending on the various images guarantees that the underlying
859# directories are up-to-date.
860$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800861 $(INSTALLED_BOOTIMAGE_TARGET) \
862 $(INSTALLED_RADIOIMAGE_TARGET) \
863 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Doug Zongker4647f122009-07-02 09:00:54 -0700864 $(INSTALLED_SYSTEMIMAGE) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800865 $(INSTALLED_USERDATAIMAGE_TARGET) \
866 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800867 $(built_ota_tools) \
868 $(APKCERTS_FILE) \
869 | $(ACP)
870 @echo "Package target files: $@"
871 $(hide) rm -rf $@ $(zip_root)
872 $(hide) mkdir -p $(dir $@) $(zip_root)
873 @# Components of the recovery image
874 $(hide) mkdir -p $(zip_root)/RECOVERY
875 $(hide) $(call package_files-copy-root, \
876 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/RECOVERY/RAMDISK)
877ifdef INSTALLED_KERNEL_TARGET
878 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/RECOVERY/kernel
879endif
880ifdef INSTALLED_2NDBOOTLOADER_TARGET
881 $(hide) $(ACP) \
882 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/RECOVERY/second
883endif
884ifdef BOARD_KERNEL_CMDLINE
885 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
886endif
Doug Zongker38a649f2009-06-17 09:07:09 -0700887ifdef BOARD_KERNEL_BASE
888 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
889endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800890 @# Components of the boot image
891 $(hide) mkdir -p $(zip_root)/BOOT
892 $(hide) $(call package_files-copy-root, \
893 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
894ifdef INSTALLED_KERNEL_TARGET
895 $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
896endif
897ifdef INSTALLED_2NDBOOTLOADER_TARGET
898 $(hide) $(ACP) \
899 $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
900endif
901ifdef BOARD_KERNEL_CMDLINE
902 $(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
903endif
Doug Zongker38a649f2009-06-17 09:07:09 -0700904ifdef BOARD_KERNEL_BASE
905 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
906endif
Doug Zongkere01100c2009-06-19 17:12:18 -0700907 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
908 mkdir -p $(zip_root)/RADIO; \
909 $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800910 @# Contents of the system image
911 $(hide) $(call package_files-copy-root, \
912 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
913 @# Contents of the data image
914 $(hide) $(call package_files-copy-root, \
915 $(TARGET_OUT_DATA),$(zip_root)/DATA)
916 @# Extra contents of the OTA package
917 $(hide) mkdir -p $(zip_root)/OTA/bin
The Android Open Source Project88b60792009-03-03 19:28:42 -0800918 $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
919 $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Doug Zongker8678df42009-06-15 14:30:14 -0700920 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -0800921 @# build them.
922 $(hide) mkdir -p $(zip_root)/META
923 $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Doug Zongker17c83cf2009-04-01 15:48:46 -0700924 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Doug Zongkerb1134dd2009-06-17 17:09:40 -0700925 $(hide) echo "$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/recovery-api-version.txt
Doug Zongker4647f122009-07-02 09:00:54 -0700926 $(hide) echo "blocksize $(BOARD_FLASH_BLOCK_SIZE)" > $(zip_root)/META/imagesizes.txt
Doug Zongker8510a1e2009-08-07 16:38:08 -0700927 $(hide) echo "boot $(call image-size-from-data-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
928 $(hide) echo "recovery $(call image-size-from-data-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
929 $(hide) echo "system $(call image-size-from-data-size,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
930 $(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 -0700931 $(hide) echo "$(tool_extensions)" > $(zip_root)/META/tool-extensions.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -0800932 @# Zip everything up, preserving symlinks
933 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
934
935target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
936
937# -----------------------------------------------------------------
Doug Zongker8678df42009-06-15 14:30:14 -0700938# OTA update package
Doug Zongker367910f2009-06-15 18:56:51 -0700939
940ifneq ($(TARGET_SIMULATOR),true)
941ifneq ($(TARGET_PRODUCT),sdk)
Sriram Ramanb11428e2009-07-24 12:02:28 -0700942ifneq ($(TARGET_PRODUCT),generic)
Doug Zongker367910f2009-06-15 18:56:51 -0700943
Doug Zongker8678df42009-06-15 14:30:14 -0700944name := $(TARGET_PRODUCT)
945ifeq ($(TARGET_BUILD_TYPE),debug)
946 name := $(name)_debug
947endif
948name := $(name)-ota-$(FILE_NAME_TAG)
949
950INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
951
952$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
953
Doug Zongker659fc552009-06-23 09:46:33 -0700954ifeq ($(TARGET_OTA_SCRIPT_MODE),)
955# default to "auto"
956$(INTERNAL_OTA_PACKAGE_TARGET): scriptmode := auto
957else
958$(INTERNAL_OTA_PACKAGE_TARGET): scriptmode := $(TARGET_OTA_SCRIPT_MODE)
959endif
960
Doug Zongker8678df42009-06-15 14:30:14 -0700961$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools
962 @echo "Package OTA: $@"
963 $(hide) ./build/tools/releasetools/ota_from_target_files \
Doug Zongkerc18736b2009-09-30 09:20:32 -0700964 -m $(scriptmode) \
Doug Zongker602a84e2009-06-18 08:35:12 -0700965 -p $(HOST_OUT) \
Doug Zongker8678df42009-06-15 14:30:14 -0700966 -k $(KEY_CERT_PAIR) \
967 $(BUILT_TARGET_FILES_PACKAGE) $@
968
969.PHONY: otapackage
970otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
971
Sriram Ramanb11428e2009-07-24 12:02:28 -0700972endif # TARGET_PRODUCT != generic
Doug Zongker367910f2009-06-15 18:56:51 -0700973endif # TARGET_PRODUCT != sdk
974endif # TARGET_SIMULATOR != true
Doug Zongker8678df42009-06-15 14:30:14 -0700975
976# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800977# installed file list
978# Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it
979# gets the DexOpt one if we're doing that.
980INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
981$(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE)
982 @echo Installed file list: $@
983 @mkdir -p $(dir $@)
984 @rm -f $@
985 $(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@
986
987.PHONY: installed-file-list
988installed-file-list: $(INSTALLED_FILES_FILE)
989$(call dist-for-goals, sdk, $(INSTALLED_FILES_FILE))
Joe Onorato03fbe402009-04-13 08:31:16 -0700990$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800991
992# -----------------------------------------------------------------
993# A zip of the tests that are built when running "make tests".
994# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
995# only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
996#
997name := $(TARGET_PRODUCT)
998ifeq ($(TARGET_BUILD_TYPE),debug)
999 name := $(name)_debug
1000endif
1001name := $(name)-tests-$(FILE_NAME_TAG)
1002
1003intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
1004BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
1005$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
1006$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
1007
1008# Depending on the images guarantees that the underlying
1009# directories are up-to-date.
1010$(BUILT_TESTS_ZIP_PACKAGE): \
1011 $(BUILT_SYSTEMIMAGE) \
1012 $(INSTALLED_USERDATAIMAGE_TARGET) \
1013 | $(ACP)
1014 @echo "Package test files: $@"
1015 $(hide) rm -rf $@ $(zip_root)
1016 $(hide) mkdir -p $(dir $@) $(zip_root)
1017 @# Some parts of the system image
1018 $(hide) $(call package_files-copy-root, \
1019 $(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
1020 $(hide) $(call package_files-copy-root, \
1021 $(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
1022 $(hide) $(call package_files-copy-root, \
1023 $(SYSTEMIMAGE_SOURCE_DIR)/framework, \
1024 $(zip_root)/SYSTEM/framework)
1025 $(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
1026 @# Contents of the data image
1027 $(hide) $(call package_files-copy-root, \
1028 $(TARGET_OUT_DATA),$(zip_root)/DATA)
1029 $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
1030
1031tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
1032
1033# -----------------------------------------------------------------
1034# A zip of the symbols directory. Keep the full paths to make it
1035# more obvious where these files came from.
1036#
1037name := $(TARGET_PRODUCT)
1038ifeq ($(TARGET_BUILD_TYPE),debug)
1039 name := $(name)_debug
1040endif
1041name := $(name)-symbols-$(FILE_NAME_TAG)
1042
1043SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
1044$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_BOOTIMAGE_TARGET)
1045 @echo "Package symbols: $@"
1046 $(hide) rm -rf $@
1047 $(hide) mkdir -p $(dir $@)
1048 $(hide) zip -qr $@ $(TARGET_OUT_UNSTRIPPED)
1049
1050# -----------------------------------------------------------------
1051# A zip of the Android Apps. Not keeping full path so that we don't
1052# include product names when distributing
1053#
1054name := $(TARGET_PRODUCT)
1055ifeq ($(TARGET_BUILD_TYPE),debug)
1056 name := $(name)_debug
1057endif
1058name := $(name)-apps-$(FILE_NAME_TAG)
1059
1060APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
1061$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
1062 @echo "Package apps: $@"
1063 $(hide) rm -rf $@
1064 $(hide) mkdir -p $(dir $@)
1065 $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
1066
1067endif # TARGET_SIMULATOR != true
1068
1069# -----------------------------------------------------------------
1070# dalvik something
1071.PHONY: dalvikfiles
1072dalvikfiles: $(INTERNAL_DALVIK_MODULES)
1073
1074# -----------------------------------------------------------------
1075# The update package
1076
Doug Zongker367910f2009-06-15 18:56:51 -07001077ifneq ($(TARGET_SIMULATOR),true)
1078ifneq ($(TARGET_PRODUCT),sdk)
1079
The Android Open Source Project88b60792009-03-03 19:28:42 -08001080name := $(TARGET_PRODUCT)
1081ifeq ($(TARGET_BUILD_TYPE),debug)
1082 name := $(name)_debug
1083endif
1084name := $(name)-img-$(FILE_NAME_TAG)
1085
1086INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1087
Doug Zongker659fc552009-06-23 09:46:33 -07001088ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
1089# default to common dir for device vendor
1090$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common
1091else
1092$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
1093endif
1094
Doug Zongker8678df42009-06-15 14:30:14 -07001095$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools
The Android Open Source Project88b60792009-03-03 19:28:42 -08001096 @echo "Package: $@"
Doug Zongker8678df42009-06-15 14:30:14 -07001097 $(hide) ./build/tools/releasetools/img_from_target_files \
Doug Zongker659fc552009-06-23 09:46:33 -07001098 -s $(extensions) \
Doug Zongker602a84e2009-06-18 08:35:12 -07001099 -p $(HOST_OUT) \
Doug Zongker8678df42009-06-15 14:30:14 -07001100 $(BUILT_TARGET_FILES_PACKAGE) $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08001101
Doug Zongker8678df42009-06-15 14:30:14 -07001102.PHONY: updatepackage
1103updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001104
Doug Zongker367910f2009-06-15 18:56:51 -07001105endif # TARGET_PRODUCT != sdk
1106endif # TARGET_SIMULATOR != true
1107
The Android Open Source Project88b60792009-03-03 19:28:42 -08001108# -----------------------------------------------------------------
1109# The emulator package
1110
1111ifneq ($(TARGET_SIMULATOR),true)
1112
1113INTERNAL_EMULATOR_PACKAGE_FILES += \
1114 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
1115 prebuilt/android-arm/kernel/kernel-qemu \
1116 $(INSTALLED_RAMDISK_TARGET) \
1117 $(INSTALLED_SYSTEMIMAGE) \
1118 $(INSTALLED_USERDATAIMAGE_TARGET)
1119
1120name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
1121
1122INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
1123
1124$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
1125 @echo "Package: $@"
1126 $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
1127
1128endif
1129
1130# -----------------------------------------------------------------
1131# The pdk package (Platform Development Kit)
1132
1133ifneq (,$(filter pdk,$(MAKECMDGOALS)))
1134 include development/pdk/Pdk.mk
1135endif
1136
1137# -----------------------------------------------------------------
1138# The SDK
1139
1140ifneq ($(TARGET_SIMULATOR),true)
1141
1142# The SDK includes host-specific components, so it belongs under HOST_OUT.
1143sdk_dir := $(HOST_OUT)/sdk
1144
1145# Build a name that looks like:
1146#
1147# linux-x86 --> android-sdk_12345_linux-x86
1148# darwin-x86 --> android-sdk_12345_mac-x86
1149# windows-x86 --> android-sdk_12345_windows
1150#
1151sdk_name := android-sdk_$(FILE_NAME_TAG)
1152ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07001153 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08001154else
Joe Onorato03fbe402009-04-13 08:31:16 -07001155 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001156endif
1157ifneq ($(HOST_OS),windows)
Joe Onorato03fbe402009-04-13 08:31:16 -07001158 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001159endif
Joe Onorato03fbe402009-04-13 08:31:16 -07001160sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001161
1162sdk_dep_file := $(sdk_dir)/sdk_deps.mk
1163
1164ATREE_FILES :=
1165-include $(sdk_dep_file)
1166
1167# if we don't have a real list, then use "everything"
1168ifeq ($(strip $(ATREE_FILES)),)
1169ATREE_FILES := \
1170 $(ALL_PREBUILT) \
1171 $(ALL_COPIED_HEADERS) \
1172 $(ALL_GENERATED_SOURCES) \
1173 $(ALL_DEFAULT_INSTALLED_MODULES) \
1174 $(INSTALLED_RAMDISK_TARGET) \
1175 $(ALL_DOCS) \
1176 $(ALL_SDK_FILES)
1177endif
1178
1179atree_dir := development/build
1180
1181sdk_atree_files := \
1182 $(atree_dir)/sdk.exclude.atree \
1183 $(atree_dir)/sdk.atree \
1184 $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree
1185
1186deps := \
1187 $(target_notice_file_txt) \
1188 $(tools_notice_file_txt) \
1189 $(OUT_DOCS)/offline-sdk-timestamp \
Doug Zongkerdddd9572009-06-15 21:25:32 -07001190 $(INSTALLED_SYSTEMIMAGE) \
1191 $(INSTALLED_USERDATAIMAGE_TARGET) \
1192 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001193 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
1194 $(ATREE_FILES) \
1195 $(atree_dir)/sdk.atree \
1196 $(HOST_OUT_EXECUTABLES)/atree \
1197 $(HOST_OUT_EXECUTABLES)/line_endings
1198
1199INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
1200$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
1201$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
1202$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
1203$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
1204
1205# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
1206#
1207#SDK_GNU_ERROR := true
1208
1209$(INTERNAL_SDK_TARGET): $(deps)
1210 @echo "Package SDK: $@"
1211 $(hide) rm -rf $(PRIVATE_DIR) $@
1212 $(hide) for f in $(target_gnu_MODULES); do \
1213 if [ -f $$f ]; then \
1214 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
1215 including GNU target $$f >&2; \
1216 FAIL=$(SDK_GNU_ERROR); \
1217 fi; \
1218 done; \
1219 if [ $$FAIL ]; then exit 1; fi
1220 $(hide) ( \
1221 $(HOST_OUT_EXECUTABLES)/atree \
1222 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
1223 -m $(PRIVATE_DEP_FILE) \
1224 -I . \
1225 -I $(PRODUCT_OUT) \
1226 -I $(HOST_OUT) \
1227 -I $(TARGET_COMMON_OUT_ROOT) \
1228 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
1229 -o $(PRIVATE_DIR) && \
1230 cp -f $(target_notice_file_txt) \
1231 $(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \
1232 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
1233 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Xavier Ducrohet1ae98802009-11-17 15:10:41 -08001234 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001235 chmod -R ug+rwX $(PRIVATE_DIR) && \
1236 cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) \
1237 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
1238
1239endif # !simulator
1240
1241# -----------------------------------------------------------------
1242# Findbugs
1243INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
1244INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
1245$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
1246 @echo UnionBugs: $@
1247 $(hide) prebuilt/common/findbugs/bin/unionBugs $(ALL_FINDBUGS_FILES) \
1248 > $@
1249$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
1250 @echo ConvertXmlToText: $@
1251 $(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
1252 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
1253
1254# -----------------------------------------------------------------
1255# Findbugs
1256
1257# -----------------------------------------------------------------
1258# These are some additional build tasks that need to be run.
1259include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))