main.mk revision 04edc95a328d509b8a51123f891d396256bc409c
1
2# Use bash, not whatever shell somebody has installed as /bin/sh
3# This is repeated in config.mk, since envsetup.sh runs that file
4# directly.
5SHELL := /bin/bash
6
7# this turns off the suffix rules built into make
8.SUFFIXES:
9
10# If a rule fails, delete $@.
11.DELETE_ON_ERROR:
12
13# Figure out where we are.
14#TOP := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
15#TOP := $(patsubst %/,%,$(TOP))
16
17# TOPDIR is the normal variable you should use, because
18# if we are executing relative to the current directory
19# it can be "", whereas TOP must be "." which causes
20# pattern matching probles when make strips off the
21# trailing "./" from paths in various places.
22#ifeq ($(TOP),.)
23#TOPDIR :=
24#else
25#TOPDIR := $(TOP)/
26#endif
27
28# check for broken versions of make
29ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") \>= 3.81))
30$(warning ********************************************************************************)
31$(warning *  You are using version $(MAKE_VERSION) of make.)
32$(warning *  You must upgrade to version 3.81 or greater.)
33$(warning *  see file://$(shell pwd)/docs/development-environment/machine-setup.html)
34$(warning ********************************************************************************)
35$(error stopping)
36endif
37
38TOP := .
39TOPDIR :=
40
41BUILD_SYSTEM := $(TOPDIR)build/core
42
43# This is the default target.  It must be the first declared target.
44DEFAULT_GOAL := droid
45$(DEFAULT_GOAL):
46
47# Set up various standard variables based on configuration
48# and host information.
49include $(BUILD_SYSTEM)/config.mk
50
51# This allows us to force a clean build - included after the config.make
52# environment setup is done, but before we generate any dependencies.  This
53# file does the rm -rf inline so the deps which are all done below will
54# be generated correctly
55include $(BUILD_SYSTEM)/cleanbuild.mk
56
57ifneq ($(HOST_OS),windows)
58ifneq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
59# check for a case sensitive file system
60ifneq (a,$(shell mkdir -p $(OUT_DIR) ; \
61                echo a > $(OUT_DIR)/casecheck.txt; \
62                    echo B > $(OUT_DIR)/CaseCheck.txt; \
63                cat $(OUT_DIR)/casecheck.txt))
64$(warning ************************************************************)
65$(warning You are building on a case-insensitive filesystem.)
66$(warning Please move your source tree to a case-sensitive filesystem.)
67$(warning ************************************************************)
68$(error Case-insensitive filesystems not supported)
69endif
70endif
71endif
72
73# Make sure that there are no spaces in the absolute path; the
74# build system can't deal with them.
75ifneq ($(words $(shell pwd)),1)
76$(warning ************************************************************)
77$(warning You are building in a directory whose absolute path contains)
78$(warning a space character:)
79$(warning $(space))
80$(warning "$(shell pwd)")
81$(warning $(space))
82$(warning Please move your source tree to a path that does not contain)
83$(warning any spaces.)
84$(warning ************************************************************)
85$(error Directory names containing spaces not supported)
86endif
87
88
89# The windows build server currently uses 1.6.  This will be fixed.
90ifneq ($(HOST_OS),windows)
91
92# Check for the correct version of java
93java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
94ifeq ($(strip $(java_version)),)
95$(info ************************************************************)
96$(info You are attempting to build with the incorrect version)
97$(info of java.)
98$(info $(space))
99$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
100$(info The correct version is: 1.5.)
101$(info $(space))
102$(info Please follow the machine setup instructions at)
103$(info $(space)$(space)$(space)$(space)http://source.android.com/download)
104$(info ************************************************************)
105$(error stop)
106endif
107
108# Check for the correct version of javac
109javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
110ifeq ($(strip $(javac_version)),)
111$(info ************************************************************)
112$(info You are attempting to build with the incorrect version)
113$(info of javac.)
114$(info $(space))
115$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
116$(info The correct version is: 1.5.)
117$(info $(space))
118$(info Please follow the machine setup instructions at)
119$(info $(space)$(space)$(space)$(space)http://source.android.com/download)
120$(info ************************************************************)
121$(error stop)
122endif
123
124endif # windows
125
126# These are the modifier targets that don't do anything themselves, but
127# change the behavior of the build.
128# (must be defined before including definitions.make)
129INTERNAL_MODIFIER_TARGETS := showcommands
130
131# Bring in standard build system definitions.
132include $(BUILD_SYSTEM)/definitions.mk
133
134ifneq ($(filter eng user userdebug tests,$(MAKECMDGOALS)),)
135$(info ***************************************************************)
136$(info ***************************************************************)
137$(info Don't pass '$(filter eng user userdebug tests,$(MAKECMDGOALS))' on \
138		the make command line.)
139# XXX The single quote on this line fixes gvim's syntax highlighting.
140# Without which, the rest of this file is impossible to read.
141$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or)
142$(info choosecombo.)
143$(info ***************************************************************)
144$(info ***************************************************************)
145$(error stopping)
146endif
147
148ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),)
149$(info ***************************************************************)
150$(info ***************************************************************)
151$(info Invalid variant: $(TARGET_BUILD_VARIANT)
152$(info Valid values are: $(INTERNAL_VALID_VARIANTS)
153$(info ***************************************************************)
154$(info ***************************************************************)
155$(error stopping)
156endif
157
158###
159### In this section we set up the things that are different
160### between the build variants
161###
162
163is_sdk_build :=
164ifneq ($(filter sdk,$(MAKECMDGOALS)),)
165is_sdk_build := true
166endif
167ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
168is_sdk_build := true
169endif
170
171
172## user/userdebug ##
173
174user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
175enable_target_debugging := true
176ifneq (,$(user_variant))
177  # Target is secure in user builds.
178  ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
179
180  tags_to_install := user
181  ifeq ($(user_variant),userdebug)
182    # Pick up some extra useful tools
183    tags_to_install += debug
184  else
185    # Disable debugging in plain user builds.
186    enable_target_debugging :=
187  endif
188 
189  # TODO: Always set WITH_DEXPREOPT (for user builds) once it works on OSX.
190  # Also, remove the corresponding block in config/product_config.make.
191  ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
192    WITH_DEXPREOPT := true
193  endif
194  
195  # Disallow mock locations by default for user builds
196  ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0
197  
198else # !user_variant
199  # Turn on checkjni for non-user builds.
200  ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
201  # Set device insecure for non-user builds.
202  ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
203  # Allow mock locations by default for non user builds
204  ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1
205endif # !user_variant
206
207ifeq (true,$(strip $(enable_target_debugging)))
208  # Target is more debuggable and adbd is on by default
209  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1
210  # Include the debugging/testing OTA keys in this build.
211  INCLUDE_TEST_OTA_KEYS := true
212else # !enable_target_debugging
213  # Target is less debuggable and adbd is off by default
214  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 persist.service.adb.enable=0
215endif # !enable_target_debugging
216
217## eng ##
218
219ifeq ($(TARGET_BUILD_VARIANT),eng)
220tags_to_install := user debug eng
221  # Don't require the setup wizard on eng builds
222  ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
223          $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES)))
224endif
225
226## tests ##
227
228ifeq ($(TARGET_BUILD_VARIANT),tests)
229tags_to_install := user debug eng tests
230endif
231
232## sdk ##
233
234ifdef is_sdk_build
235ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1)
236$(error The 'sdk' target may not be specified with any other targets)
237endif
238# TODO: this should be eng I think.  Since the sdk is built from the eng
239# variant.
240tags_to_install := user debug eng
241ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
242ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
243else # !sdk
244# Enable sync for non-sdk builds only (sdk builds lack SubscribedFeedsProvider).
245ADDITIONAL_BUILD_PROPERTIES += ro.config.sync=yes
246endif
247
248## precise GC ##
249
250ifneq ($(filter dalvik.gc.type-precise,$(PRODUCT_TAGS)),)
251  # Enabling type-precise GC results in larger optimized DEX files.  The
252  # additional storage requirements for ".odex" files can cause /system
253  # to overflow on some devices, so this is configured separately for
254  # each product.
255  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dexopt-flags=m=y
256endif
257
258# Install an apns-conf.xml file if one's not already being installed.
259ifeq (,$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES)))
260  PRODUCT_COPY_FILES += \
261        development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
262  ifeq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
263    $(warning implicitly installing apns-conf_sdk.xml)
264  endif
265endif
266# Install a vold.conf file is one's not already being installed.
267ifeq (,$(filter %:system/etc/vold.conf, $(PRODUCT_COPY_FILES)))
268  PRODUCT_COPY_FILES += \
269	development/data/etc/vold.conf:system/etc/vold.conf
270  ifeq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
271    $(warning implicitly installing vold.conf)
272  endif
273endif
274# If we're on an eng or tests build, but not on the sdk, and we have
275# a better one, use that instead.
276ifneq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
277  ifndef is_sdk_build
278    apns_to_use := $(wildcard vendor/google/etc/apns-conf.xml)
279    ifneq ($(strip $(apns_to_use)),)
280      PRODUCT_COPY_FILES := \
281            $(filter-out %:system/etc/apns-conf.xml,$(PRODUCT_COPY_FILES)) \
282            $(strip $(apns_to_use)):system/etc/apns-conf.xml
283    endif
284  endif
285endif
286
287ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
288
289# enable vm tracing in files for now to help track
290# the cause of ANRs in the content process
291ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
292
293
294# ------------------------------------------------------------
295# Define a function that, given a list of module tags, returns
296# non-empty if that module should be installed in /system.
297
298# For most goals, anything not tagged with the "tests" tag should
299# be installed in /system.
300define should-install-to-system
301$(if $(filter tests,$(1)),,true)
302endef
303
304ifdef is_sdk_build
305# For the sdk goal, anything with the "samples" tag should be
306# installed in /data even if that module also has "eng"/"debug"/"user".
307define should-install-to-system
308$(if $(filter samples tests,$(1)),,true)
309endef
310endif
311
312
313# If all they typed was make showcommands, we'll actually build
314# the default target.
315ifeq ($(MAKECMDGOALS),showcommands)
316.PHONY: showcommands
317showcommands: $(DEFAULT_GOAL)
318endif
319
320# These targets are going to delete stuff, don't bother including
321# the whole directory tree if that's all we're going to do
322ifeq ($(MAKECMDGOALS),clean)
323dont_bother := true
324endif
325ifeq ($(MAKECMDGOALS),clobber)
326dont_bother := true
327endif
328ifeq ($(MAKECMDGOALS),dataclean)
329dont_bother := true
330endif
331ifeq ($(MAKECMDGOALS),installclean)
332dont_bother := true
333endif
334
335# Bring in all modules that need to be built.
336ifneq ($(dont_bother),true)
337
338subdir_makefiles :=
339
340ifeq ($(HOST_OS),windows)
341SDK_ONLY := true
342endif
343ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
344SDK_ONLY := true
345endif
346
347ifeq ($(SDK_ONLY),true)
348
349subdirs := \
350	prebuilt \
351	build/libs/host \
352	dalvik/dexdump \
353	dalvik/libdex \
354	dalvik/tools/dmtracedump \
355	dalvik/tools/hprof-conv \
356	development/emulator/mksdcard \
357	development/tools/line_endings \
358	development/host \
359	external/expat \
360	external/libpng \
361	external/qemu \
362	external/sqlite/dist \
363	external/zlib \
364	frameworks/base/libs/utils \
365	frameworks/base/tools/aapt \
366	frameworks/base/tools/aidl \
367	system/core/adb \
368	system/core/fastboot \
369	system/core/libcutils \
370	system/core/liblog \
371	system/core/libzipfile
372
373# The following can only be built if "javac" is available.
374# This check is used when building parts of the SDK under Cygwin.
375ifneq (,$(shell which javac 2>/dev/null))
376$(warning sdk-only: javac available.)
377subdirs += \
378	build/tools/signapk \
379	build/tools/zipalign \
380	dalvik/dx \
381	dalvik/libcore \
382	development/apps \
383	development/tools/archquery \
384	development/tools/androidprefs \
385	development/tools/apkbuilder \
386	development/tools/jarutils \
387	development/tools/layoutlib_utils \
388	development/tools/ninepatch \
389	development/tools/sdkstats \
390	development/tools/sdkmanager \
391	development/tools/mkstubs \
392	frameworks/base \
393	frameworks/base/tools/layoutlib \
394	external/googleclient \
395	packages
396else
397$(warning sdk-only: javac not available.)
398endif
399
400# Exclude tools/acp when cross-compiling windows under linux
401ifeq ($(findstring Linux,$(UNAME)),)
402subdirs += build/tools/acp
403endif
404
405else	# !SDK_ONLY
406ifeq ($(BUILD_TINY_ANDROID), true)
407
408# TINY_ANDROID is a super-minimal build configuration, handy for board 
409# bringup and very low level debugging
410
411INTERNAL_DEFAULT_DOCS_TARGETS := 
412
413subdirs := \
414	bionic \
415	system/core \
416	build/libs \
417	build/target \
418	build/tools/acp \
419	build/tools/apriori \
420	build/tools/kcm \
421	build/tools/soslim \
422	external/elfcopy \
423	external/elfutils \
424	external/yaffs2 \
425	external/zlib
426else	# !BUILD_TINY_ANDROID
427
428#
429# Typical build; include any Android.mk files we can find.
430#
431INTERNAL_DEFAULT_DOCS_TARGETS := offline-sdk-docs
432subdirs := $(TOP)
433
434FULL_BUILD := true
435
436endif	# !BUILD_TINY_ANDROID
437
438endif	# !SDK_ONLY
439
440# Can't use first-makefiles-under here because
441# --mindepth=2 makes the prunes not work.
442subdir_makefiles += \
443	$(shell build/tools/findleaves.sh --prune="./out" $(subdirs) Android.mk)
444
445#
446# Include all of the makefiles in the system
447#
448
449ifneq ($(ONE_SHOT_MAKEFILE),)
450# We've probably been invoked by the "mm" shell function
451# with a subdirectory's makefile.
452include $(ONE_SHOT_MAKEFILE)
453# Change CUSTOM_MODULES to include only modules that were
454# defined by this makefile; this will install all of those
455# modules as a side-effect.  Do this after including ONE_SHOT_MAKEFILE
456# so that the modules will be installed in the same place they
457# would have been with a normal make.
458CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS),))
459FULL_BUILD :=
460INTERNAL_DEFAULT_DOCS_TARGETS :=
461# Stub out the notice targets, which probably aren't defined
462# when using ONE_SHOT_MAKEFILE.
463NOTICE-HOST-%: ;
464NOTICE-TARGET-%: ;
465else
466include $(subdir_makefiles)
467endif
468# -------------------------------------------------------------------
469# All module makefiles have been included at this point.
470# -------------------------------------------------------------------
471
472# -------------------------------------------------------------------
473# Include any makefiles that must happen after the module makefiles
474# have been included.
475# TODO: have these files register themselves via a global var rather
476# than hard-coding the list here.
477ifdef FULL_BUILD
478  # Only include this during a full build, otherwise we can't be
479  # guaranteed that any policies were included.
480  -include frameworks/policies/base/PolicyConfig.mk
481endif
482
483# -------------------------------------------------------------------
484# Fix up CUSTOM_MODULES to refer to installed files rather than
485# just bare module names.  Leave unknown modules alone in case
486# they're actually full paths to a particular file.
487known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
488unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
489CUSTOM_MODULES := \
490	$(call module-installed-files,$(known_custom_modules)) \
491	$(unknown_custom_modules)
492
493# -------------------------------------------------------------------
494# Define dependencies for modules that require other modules.
495# This can only happen now, after we've read in all module makefiles.
496#
497# TODO: deal with the fact that a bare module name isn't
498# unambiguous enough.  Maybe declare short targets like
499# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
500# BUG: the system image won't know to depend on modules that are
501# brought in as requirements of other modules.
502define add-required-deps
503$(1): $(2)
504endef
505$(foreach m,$(ALL_MODULES), \
506  $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
507  $(if $(r), \
508    $(eval r := $(call module-installed-files,$(r))) \
509    $(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
510   ) \
511 )
512m :=
513r :=
514add-required-deps :=
515
516# -------------------------------------------------------------------
517# Figure out our module sets.
518
519# Of the modules defined by the component makefiles,
520# determine what we actually want to build.
521# If a module has the "restricted" tag on it, it
522# poisons the rest of the tags and shouldn't appear
523# on any list.
524Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
525                          $(ALL_BUILT_MODULES) \
526                          $(CUSTOM_MODULES))
527# TODO: Remove the 3 places in the tree that use
528# ALL_DEFAULT_INSTALLED_MODULES and get rid of it from this list.
529
530ifdef FULL_BUILD
531  # The base list of modules to build for this product is specified
532  # by the appropriate product definition file, which was included
533  # by product_config.make.
534  user_PACKAGES := $(call module-installed-files, \
535                       $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
536  ifeq (0,1)
537    $(info user packages for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
538    $(foreach p,$(user_PACKAGES),$(info :   $(p)))
539    $(error done)
540  endif
541else
542  # We're not doing a full build, and are probably only including
543  # a subset of the module makefiles.  Don't try to build any modules
544  # requested by the product, because we probably won't have rules
545  # to build them.
546  user_PACKAGES :=
547endif
548# Use tags to get the non-APPS user modules.  Use the product
549# definition files to get the APPS user modules.
550user_MODULES := $(sort $(call get-tagged-modules,user,_class@APPS restricted))
551user_MODULES := $(user_MODULES) $(user_PACKAGES)
552
553eng_MODULES := $(sort $(call get-tagged-modules,eng,restricted))
554debug_MODULES := $(sort $(call get-tagged-modules,debug,restricted))
555tests_MODULES := $(sort $(call get-tagged-modules,tests,restricted))
556
557ifeq ($(strip $(tags_to_install)),)
558$(error ASSERTION FAILED: tags_to_install should not be empty)
559endif
560modules_to_install := $(sort $(Default_MODULES) \
561          $(foreach tag,$(tags_to_install),$($(tag)_MODULES)))
562
563# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
564# Filter out (do not install) any overridden packages.
565overridden_packages := $(call get-package-overrides,$(modules_to_install))
566ifdef overridden_packages
567#  old_modules_to_install := $(modules_to_install)
568  modules_to_install := \
569      $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
570          $(modules_to_install))
571endif
572#$(error filtered out
573#           $(filter-out $(modules_to_install),$(old_modules_to_install)))
574
575# Don't include any GNU targets in the SDK.  It's ok (and necessary)
576# to build the host tools, but nothing that's going to be installed
577# on the target (including static libraries).
578ifdef is_sdk_build
579  target_gnu_MODULES := \
580              $(filter \
581                      $(TARGET_OUT_INTERMEDIATES)/% \
582                      $(TARGET_OUT)/% \
583                      $(TARGET_OUT_DATA)/%, \
584                              $(sort $(call get-tagged-modules,gnu)))
585  $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
586  modules_to_install := \
587              $(filter-out $(target_gnu_MODULES),$(modules_to_install))
588endif
589
590
591# config/Makefile contains extra stuff that we don't want to pollute this
592# top-level makefile with.  It expects that ALL_DEFAULT_INSTALLED_MODULES
593# contains everything that's built during the current make, but it also further
594# extends ALL_DEFAULT_INSTALLED_MODULES.
595ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install)
596include $(BUILD_SYSTEM)/Makefile
597modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
598ALL_DEFAULT_INSTALLED_MODULES :=
599
600endif # dont_bother
601
602# -------------------------------------------------------------------
603# This is used to to get the ordering right, you can also use these,
604# but they're considered undocumented, so don't complain if their
605# behavior changes.
606.PHONY: prebuilt
607prebuilt: $(ALL_PREBUILT)
608
609# An internal target that depends on all copied headers
610# (see copy_headers.make).  Other targets that need the
611# headers to be copied first can depend on this target.
612.PHONY: all_copied_headers
613all_copied_headers: ;
614
615$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
616
617# All the droid stuff, in directories
618.PHONY: files
619files: prebuilt $(modules_to_install) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
620
621# -------------------------------------------------------------------
622
623.PHONY: ramdisk
624ramdisk: $(INSTALLED_RAMDISK_TARGET)
625
626.PHONY: systemtarball
627systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
628
629.PHONY: userdataimage
630userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
631
632.PHONY: userdatatarball
633userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
634
635.PHONY: bootimage
636bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
637
638ifeq ($(BUILD_TINY_ANDROID), true)
639INSTALLED_RECOVERYIMAGE_TARGET :=
640endif
641
642# Build files and then package it into the rom formats
643.PHONY: droidcore
644droidcore: files \
645	systemimage \
646	$(INSTALLED_BOOTIMAGE_TARGET) \
647	$(INSTALLED_RECOVERYIMAGE_TARGET) \
648	$(INSTALLED_USERDATAIMAGE_TARGET) \
649	$(INTERNAL_DEFAULT_DOCS_TARGETS) \
650	$(INSTALLED_FILES_FILE)
651
652# The actual files built by the droidcore target changes depending
653# on the build variant.
654.PHONY: droid tests
655droid tests: droidcore
656
657$(call dist-for-goals, droid, \
658	$(INTERNAL_UPDATE_PACKAGE_TARGET) \
659	$(INTERNAL_OTA_PACKAGE_TARGET) \
660	$(SYMBOLS_ZIP) \
661	$(APPS_ZIP) \
662	$(INTERNAL_EMULATOR_PACKAGE_TARGET) \
663	$(PACKAGE_STATS_FILE) \
664	$(INSTALLED_FILES_FILE) \
665	$(INSTALLED_BUILD_PROP_TARGET) \
666	$(BUILT_TARGET_FILES_PACKAGE) \
667 )
668
669# Tests are installed in userdata.img.  If we're building the tests
670# variant, copy it for "make tests dist".  Also copy a zip of the
671# contents of userdata.img, so that people can easily extract a
672# single .apk.
673ifeq ($(TARGET_BUILD_VARIANT),tests)
674$(call dist-for-goals, droid, \
675	$(INSTALLED_USERDATAIMAGE_TARGET) \
676	$(BUILT_TESTS_ZIP_PACKAGE) \
677 )
678endif
679
680.PHONY: docs
681docs: $(ALL_DOCS)
682
683.PHONY: sdk
684ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
685sdk: $(ALL_SDK_TARGETS)
686$(call dist-for-goals,sdk,$(ALL_SDK_TARGETS))
687
688.PHONY: findbugs
689findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
690
691.PHONY: clean
692dirs_to_clean := \
693	$(PRODUCT_OUT) \
694	$(TARGET_COMMON_OUT_ROOT) \
695	$(HOST_OUT) \
696	$(HOST_COMMON_OUT_ROOT)
697clean:
698	@for dir in $(dirs_to_clean) ; do \
699	    echo "Cleaning $$dir..."; \
700	    rm -rf $$dir; \
701	done
702	@echo "Clean."; \
703
704.PHONY: clobber
705clobber:
706	@rm -rf $(OUT_DIR)
707	@echo "Entire build directory removed."
708
709# The rules for dataclean and installclean are defined in cleanbuild.mk.
710
711#xxx scrape this from ALL_MODULE_NAME_TAGS
712.PHONY: modules
713modules:
714	@echo "Available sub-modules:"
715	@echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
716	      sed -e 's/  */\n/g' | sort -u | $(COLUMN)
717
718.PHONY: showcommands
719showcommands:
720	@echo >/dev/null
721
722