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