OSDN Git Service

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