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