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