main.mk revision 9d9f367895655411c42123177ae1c32f104b3c01
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# Install an apns-conf.xml file if one's not already being installed.
249ifeq (,$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES)))
250  PRODUCT_COPY_FILES += \
251        development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
252  ifeq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
253    $(warning implicitly installing apns-conf_sdk.xml)
254  endif
255endif
256# If we're on an eng or tests build, but not on the sdk, and we have
257# a better one, use that instead.
258ifneq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
259  ifdef is_sdk_build
260    apns_to_use := $(wildcard vendor/google/etc/apns-conf.xml)
261    ifneq ($(strip $(apns_to_use)),)
262      PRODUCT_COPY_FILES := \
263            $(filter-out %:system/etc/apns-conf.xml,$(PRODUCT_COPY_FILES)) \
264            $(strip $(apns_to_use)):system/etc/apns-conf.xml
265    endif
266  endif
267endif
268
269ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
270
271# enable vm tracing in files for now to help track
272# the cause of ANRs in the content process
273ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
274
275
276# ------------------------------------------------------------
277# Define a function that, given a list of module tags, returns
278# non-empty if that module should be installed in /system.
279
280# For most goals, anything not tagged with the "tests" tag should
281# be installed in /system.
282define should-install-to-system
283$(if $(filter tests,$(1)),,true)
284endef
285
286ifdef is_sdk_build
287# For the sdk goal, anything with the "samples" tag should be
288# installed in /data even if that module also has "eng"/"debug"/"user".
289define should-install-to-system
290$(if $(filter samples tests,$(1)),,true)
291endef
292endif
293
294
295# If all they typed was make showcommands, we'll actually build
296# the default target.
297ifeq ($(MAKECMDGOALS),showcommands)
298.PHONY: showcommands
299showcommands: $(DEFAULT_GOAL)
300endif
301
302# These targets are going to delete stuff, don't bother including
303# the whole directory tree if that's all we're going to do
304ifeq ($(MAKECMDGOALS),clean)
305dont_bother := true
306endif
307ifeq ($(MAKECMDGOALS),clobber)
308dont_bother := true
309endif
310ifeq ($(MAKECMDGOALS),dataclean)
311dont_bother := true
312endif
313ifeq ($(MAKECMDGOALS),installclean)
314dont_bother := true
315endif
316
317# Bring in all modules that need to be built.
318ifneq ($(dont_bother),true)
319
320subdir_makefiles :=
321
322ifeq ($(HOST_OS),windows)
323SDK_ONLY := true
324endif
325ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
326SDK_ONLY := true
327endif
328
329ifeq ($(SDK_ONLY),true)
330
331subdirs := \
332	prebuilt \
333	build/libs/host \
334	dalvik/dexdump \
335	dalvik/libdex \
336	dalvik/tools/dmtracedump \
337	dalvik/tools/hprof-conv \
338	development/emulator/mksdcard \
339	development/tools/line_endings \
340	development/host \
341	external/expat \
342	external/libpng \
343	external/qemu \
344	external/sqlite/dist \
345	external/zlib \
346	frameworks/base/libs/utils \
347	frameworks/base/tools/aapt \
348	frameworks/base/tools/aidl \
349	system/core/adb \
350	system/core/fastboot \
351	system/core/libcutils \
352	system/core/liblog \
353	system/core/libzipfile
354
355# The following can only be built if "javac" is available.
356# This check is used when building parts of the SDK under Cygwin.
357ifneq (,$(shell which javac 2>/dev/null))
358$(warning sdk-only: javac available.)
359subdirs += \
360	build/tools/signapk \
361	build/tools/zipalign \
362	dalvik/dx \
363	dalvik/libcore \
364	development/apps \
365	development/tools/archquery \
366	development/tools/androidprefs \
367	development/tools/apkbuilder \
368	development/tools/jarutils \
369	development/tools/layoutlib_utils \
370	development/tools/ninepatch \
371	development/tools/sdkstats \
372	development/tools/sdkmanager \
373	development/tools/mkstubs \
374	frameworks/base \
375	frameworks/base/tools/layoutlib \
376	external/googleclient \
377	packages
378else
379$(warning sdk-only: javac not available.)
380endif
381
382# Exclude tools/acp when cross-compiling windows under linux
383ifeq ($(findstring Linux,$(UNAME)),)
384subdirs += build/tools/acp
385endif
386
387else	# !SDK_ONLY
388ifeq ($(BUILD_TINY_ANDROID), true)
389
390# TINY_ANDROID is a super-minimal build configuration, handy for board 
391# bringup and very low level debugging
392
393INTERNAL_DEFAULT_DOCS_TARGETS := 
394
395subdirs := \
396	bionic \
397	system/core \
398	build/libs \
399	build/target \
400	build/tools/acp \
401	build/tools/apriori \
402	build/tools/kcm \
403	build/tools/soslim \
404	external/elfcopy \
405	external/elfutils \
406	external/yaffs2 \
407	external/zlib
408else	# !BUILD_TINY_ANDROID
409
410#
411# Typical build; include any Android.mk files we can find.
412#
413INTERNAL_DEFAULT_DOCS_TARGETS := offline-sdk-docs
414subdirs := $(TOP)
415
416FULL_BUILD := true
417
418endif	# !BUILD_TINY_ANDROID
419
420endif	# !SDK_ONLY
421
422# Can't use first-makefiles-under here because
423# --mindepth=2 makes the prunes not work.
424subdir_makefiles += \
425	$(shell build/tools/findleaves.sh --prune="./out" $(subdirs) Android.mk)
426
427# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
428# or under vendor/*/$(TARGET_DEVICE).  Search in both places, but
429# make sure only one exists.
430# Real boards should always be associated with an OEM vendor.
431board_config_mk := \
432	$(strip $(wildcard \
433		$(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
434		vendor/*/$(TARGET_DEVICE)/BoardConfig.mk \
435	))
436ifeq ($(board_config_mk),)
437  $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
438endif
439ifneq ($(words $(board_config_mk)),1)
440  $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
441endif
442include $(board_config_mk)
443TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
444board_config_mk :=
445
446# Clean up/verify variables defined by the board config file.
447TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
448TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
449ifeq ($(TARGET_CPU_ABI),)
450  $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk))
451endif
452
453#
454# Include all of the makefiles in the system
455#
456
457ifneq ($(ONE_SHOT_MAKEFILE),)
458# We've probably been invoked by the "mm" shell function
459# with a subdirectory's makefile.
460include $(ONE_SHOT_MAKEFILE)
461# Change CUSTOM_MODULES to include only modules that were
462# defined by this makefile; this will install all of those
463# modules as a side-effect.  Do this after including ONE_SHOT_MAKEFILE
464# so that the modules will be installed in the same place they
465# would have been with a normal make.
466CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS),))
467FULL_BUILD :=
468INTERNAL_DEFAULT_DOCS_TARGETS :=
469# Stub out the notice targets, which probably aren't defined
470# when using ONE_SHOT_MAKEFILE.
471NOTICE-HOST-%: ;
472NOTICE-TARGET-%: ;
473else
474include $(subdir_makefiles)
475endif
476# -------------------------------------------------------------------
477# All module makefiles have been included at this point.
478# -------------------------------------------------------------------
479
480# -------------------------------------------------------------------
481# Include any makefiles that must happen after the module makefiles
482# have been included.
483# TODO: have these files register themselves via a global var rather
484# than hard-coding the list here.
485ifdef FULL_BUILD
486  # Only include this during a full build, otherwise we can't be
487  # guaranteed that any policies were included.
488  -include frameworks/policies/base/PolicyConfig.mk
489endif
490
491# -------------------------------------------------------------------
492# Fix up CUSTOM_MODULES to refer to installed files rather than
493# just bare module names.  Leave unknown modules alone in case
494# they're actually full paths to a particular file.
495known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
496unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
497CUSTOM_MODULES := \
498	$(call module-installed-files,$(known_custom_modules)) \
499	$(unknown_custom_modules)
500
501# -------------------------------------------------------------------
502# Define dependencies for modules that require other modules.
503# This can only happen now, after we've read in all module makefiles.
504#
505# TODO: deal with the fact that a bare module name isn't
506# unambiguous enough.  Maybe declare short targets like
507# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
508# BUG: the system image won't know to depend on modules that are
509# brought in as requirements of other modules.
510define add-required-deps
511$(1): $(2)
512endef
513$(foreach m,$(ALL_MODULES), \
514  $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
515  $(if $(r), \
516    $(eval r := $(call module-installed-files,$(r))) \
517    $(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
518   ) \
519 )
520m :=
521r :=
522add-required-deps :=
523
524# -------------------------------------------------------------------
525# Figure out our module sets.
526
527# Of the modules defined by the component makefiles,
528# determine what we actually want to build.
529# If a module has the "restricted" tag on it, it
530# poisons the rest of the tags and shouldn't appear
531# on any list.
532Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
533                          $(ALL_BUILT_MODULES) \
534                          $(CUSTOM_MODULES))
535# TODO: Remove the 3 places in the tree that use
536# ALL_DEFAULT_INSTALLED_MODULES and get rid of it from this list.
537
538ifdef FULL_BUILD
539  # The base list of modules to build for this product is specified
540  # by the appropriate product definition file, which was included
541  # by product_config.make.
542  user_PACKAGES := $(call module-installed-files, \
543                       $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
544  ifeq (0,1)
545    $(info user packages for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
546    $(foreach p,$(user_PACKAGES),$(info :   $(p)))
547    $(error done)
548  endif
549else
550  # We're not doing a full build, and are probably only including
551  # a subset of the module makefiles.  Don't try to build any modules
552  # requested by the product, because we probably won't have rules
553  # to build them.
554  user_PACKAGES :=
555endif
556# Use tags to get the non-APPS user modules.  Use the product
557# definition files to get the APPS user modules.
558user_MODULES := $(sort $(call get-tagged-modules,user,_class@APPS restricted))
559user_MODULES := $(user_MODULES) $(user_PACKAGES)
560
561eng_MODULES := $(sort $(call get-tagged-modules,eng,restricted))
562debug_MODULES := $(sort $(call get-tagged-modules,debug,restricted))
563tests_MODULES := $(sort $(call get-tagged-modules,tests,restricted))
564
565ifeq ($(strip $(tags_to_install)),)
566$(error ASSERTION FAILED: tags_to_install should not be empty)
567endif
568modules_to_install := $(sort $(Default_MODULES) \
569          $(foreach tag,$(tags_to_install),$($(tag)_MODULES)))
570
571# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
572# Filter out (do not install) any overridden packages.
573overridden_packages := $(call get-package-overrides,$(modules_to_install))
574ifdef overridden_packages
575#  old_modules_to_install := $(modules_to_install)
576  modules_to_install := \
577      $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
578          $(modules_to_install))
579endif
580#$(error filtered out
581#           $(filter-out $(modules_to_install),$(old_modules_to_install)))
582
583# Don't include any GNU targets in the SDK.  It's ok (and necessary)
584# to build the host tools, but nothing that's going to be installed
585# on the target (including static libraries).
586ifdef is_sdk_build
587  target_gnu_MODULES := \
588              $(filter \
589                      $(TARGET_OUT_INTERMEDIATES)/% \
590                      $(TARGET_OUT)/% \
591                      $(TARGET_OUT_DATA)/%, \
592                              $(sort $(call get-tagged-modules,gnu)))
593  $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
594  modules_to_install := \
595              $(filter-out $(target_gnu_MODULES),$(modules_to_install))
596endif
597
598
599# config/Makefile contains extra stuff that we don't want to pollute this
600# top-level makefile with.  It expects that ALL_DEFAULT_INSTALLED_MODULES
601# contains everything that's built during the current make, but it also further
602# extends ALL_DEFAULT_INSTALLED_MODULES.
603ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install)
604include $(BUILD_SYSTEM)/Makefile
605modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
606ALL_DEFAULT_INSTALLED_MODULES :=
607
608endif # dont_bother
609
610# -------------------------------------------------------------------
611# This is used to to get the ordering right, you can also use these,
612# but they're considered undocumented, so don't complain if their
613# behavior changes.
614.PHONY: prebuilt
615prebuilt: $(ALL_PREBUILT)
616
617# An internal target that depends on all copied headers
618# (see copy_headers.make).  Other targets that need the
619# headers to be copied first can depend on this target.
620.PHONY: all_copied_headers
621all_copied_headers: ;
622
623$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
624
625# All the droid stuff, in directories
626.PHONY: files
627files: prebuilt $(modules_to_install) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
628
629# -------------------------------------------------------------------
630
631.PHONY: ramdisk
632ramdisk: $(INSTALLED_RAMDISK_TARGET)
633
634.PHONY: systemtarball
635systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
636
637.PHONY: userdataimage
638userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
639
640.PHONY: userdatatarball
641userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
642
643.PHONY: bootimage
644bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
645
646ifeq ($(BUILD_TINY_ANDROID), true)
647INSTALLED_RECOVERYIMAGE_TARGET :=
648endif
649
650# Build files and then package it into the rom formats
651.PHONY: droidcore
652droidcore: files \
653	systemimage \
654	$(INSTALLED_BOOTIMAGE_TARGET) \
655	$(INSTALLED_RECOVERYIMAGE_TARGET) \
656	$(INSTALLED_USERDATAIMAGE_TARGET) \
657	$(INTERNAL_DEFAULT_DOCS_TARGETS) \
658	$(INSTALLED_FILES_FILE)
659
660# The actual files built by the droidcore target changes depending
661# on the build variant.
662.PHONY: droid tests
663droid tests: droidcore
664
665$(call dist-for-goals, droid, \
666	$(INTERNAL_UPDATE_PACKAGE_TARGET) \
667	$(INTERNAL_OTA_PACKAGE_TARGET) \
668	$(SYMBOLS_ZIP) \
669	$(APPS_ZIP) \
670	$(INTERNAL_EMULATOR_PACKAGE_TARGET) \
671	$(PACKAGE_STATS_FILE) \
672	$(INSTALLED_FILES_FILE) \
673	$(INSTALLED_BUILD_PROP_TARGET) \
674	$(BUILT_TARGET_FILES_PACKAGE) \
675 )
676
677# Tests are installed in userdata.img.  If we're building the tests
678# variant, copy it for "make tests dist".  Also copy a zip of the
679# contents of userdata.img, so that people can easily extract a
680# single .apk.
681ifeq ($(TARGET_BUILD_VARIANT),tests)
682$(call dist-for-goals, droid, \
683	$(INSTALLED_USERDATAIMAGE_TARGET) \
684	$(BUILT_TESTS_ZIP_PACKAGE) \
685 )
686endif
687
688.PHONY: docs
689docs: $(ALL_DOCS)
690
691.PHONY: sdk
692ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
693sdk: $(ALL_SDK_TARGETS)
694$(call dist-for-goals,sdk,$(ALL_SDK_TARGETS))
695
696.PHONY: findbugs
697findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
698
699.PHONY: clean
700dirs_to_clean := \
701	$(PRODUCT_OUT) \
702	$(TARGET_COMMON_OUT_ROOT) \
703	$(HOST_OUT) \
704	$(HOST_COMMON_OUT_ROOT)
705clean:
706	@for dir in $(dirs_to_clean) ; do \
707	    echo "Cleaning $$dir..."; \
708	    rm -rf $$dir; \
709	done
710	@echo "Clean."; \
711
712.PHONY: clobber
713clobber:
714	@rm -rf $(OUT_DIR)
715	@echo "Entire build directory removed."
716
717# The rules for dataclean and installclean are defined in cleanbuild.mk.
718
719#xxx scrape this from ALL_MODULE_NAME_TAGS
720.PHONY: modules
721modules:
722	@echo "Available sub-modules:"
723	@echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
724	      sed -e 's/  */\n/g' | sort -u | $(COLUMN)
725
726.PHONY: showcommands
727showcommands:
728	@echo >/dev/null
729
730