OSDN Git Service

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