OSDN Git Service

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