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