blob: 216225b6801ac0ee16785aaa9d6f5a558a8d96c7 [file] [log] [blame]
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -07001
2# Use bash, not whatever shell somebody has installed as /bin/sh
The Android Open Source Project4f85cc52009-01-09 17:50:54 -08003# This is repeated in config.mk, since envsetup.sh runs that file
4# directly.
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -07005SHELL := /bin/bash
6
7# this turns off the suffix rules built into make
8.SUFFIXES:
9
10# If a rule fails, delete $@.
11.DELETE_ON_ERROR:
12
13# Figure out where we are.
14#TOP := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
15#TOP := $(patsubst %/,%,$(TOP))
16
17# TOPDIR is the normal variable you should use, because
18# if we are executing relative to the current directory
19# it can be "", whereas TOP must be "." which causes
20# pattern matching probles when make strips off the
21# trailing "./" from paths in various places.
22#ifeq ($(TOP),.)
23#TOPDIR :=
24#else
25#TOPDIR := $(TOP)/
26#endif
27
28# check for broken versions of make
29ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") \>= 3.81))
30$(warning ********************************************************************************)
31$(warning * You are using version $(MAKE_VERSION) of make.)
32$(warning * You must upgrade to version 3.81 or greater.)
33$(warning * see file://$(shell pwd)/docs/development-environment/machine-setup.html)
34$(warning ********************************************************************************)
35$(error stopping)
36endif
37
38TOP := .
39TOPDIR :=
40
41BUILD_SYSTEM := $(TOPDIR)build/core
42
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -080043# This is the default target. It must be the first declared target.
44DEFAULT_GOAL := droid
45$(DEFAULT_GOAL):
46
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070047# Set up various standard variables based on configuration
48# and host information.
49include $(BUILD_SYSTEM)/config.mk
50
51# This allows us to force a clean build - included after the config.make
52# environment setup is done, but before we generate any dependencies. This
53# file does the rm -rf inline so the deps which are all done below will
54# be generated correctly
55include $(BUILD_SYSTEM)/cleanbuild.mk
56
57ifneq ($(HOST_OS),windows)
58ifneq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
59# check for a case sensitive file system
60ifneq (a,$(shell mkdir -p $(OUT_DIR) ; \
61 echo a > $(OUT_DIR)/casecheck.txt; \
62 echo B > $(OUT_DIR)/CaseCheck.txt; \
63 cat $(OUT_DIR)/casecheck.txt))
64$(warning ************************************************************)
65$(warning You are building on a case-insensitive filesystem.)
66$(warning Please move your source tree to a case-sensitive filesystem.)
67$(warning ************************************************************)
68$(error Case-insensitive filesystems not supported)
69endif
70endif
71endif
72
73# Make sure that there are no spaces in the absolute path; the
74# build system can't deal with them.
75ifneq ($(words $(shell pwd)),1)
76$(warning ************************************************************)
77$(warning You are building in a directory whose absolute path contains)
78$(warning a space character:)
79$(warning $(space))
80$(warning "$(shell pwd)")
81$(warning $(space))
82$(warning Please move your source tree to a path that does not contain)
83$(warning any spaces.)
84$(warning ************************************************************)
85$(error Directory names containing spaces not supported)
86endif
87
88# Set up version information.
89include $(BUILD_SYSTEM)/version_defaults.mk
90
91# These are the modifier targets that don't do anything themselves, but
92# change the behavior of the build.
93# (must be defined before including definitions.make)
94INTERNAL_MODIFIER_TARGETS := showcommands
95
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070096# Bring in standard build system definitions.
97include $(BUILD_SYSTEM)/definitions.mk
98
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -080099ifneq ($(filter eng user userdebug tests,$(MAKECMDGOALS)),)
100$(info ***************************************************************)
101$(info ***************************************************************)
102$(info Don't pass '$(filter eng user userdebug tests,$(MAKECMDGOALS))' on \
103 the make command line.)
104$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or)
105$(info choosecombo.)
106$(info ***************************************************************)
107$(info ***************************************************************)
108$(error stopping)
109endif
110
111
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700112###
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800113### In this section we set up the things that are different
114### between the build variants
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700115###
116
117## user/userdebug ##
118
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800119user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700120enable_target_debugging := true
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800121ifneq (,$(user_variant))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700122 # Target is secure in user builds.
123 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
124
125 override_build_tags := user
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800126 ifeq ($(user_variant),userdebug)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700127 # Pick up some extra useful tools
128 override_build_tags += debug
129 else
130 # Disable debugging in plain user builds.
131 enable_target_debugging :=
132 endif
133
134 # TODO: Always set WITH_DEXPREOPT (for user builds) once it works on OSX.
135 # Also, remove the corresponding block in config/product_config.make.
136 ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
137 WITH_DEXPREOPT := true
138 endif
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800139else # !user_variant
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700140 # Turn on checkjni for non-user builds.
141 ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
142 # Set device insecure for non-user builds.
143 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800144endif # !user_variant
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700145
146ifeq (true,$(strip $(enable_target_debugging)))
147 # Target is more debuggable and adbd is on by default
148 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1
149 # Include the debugging/testing OTA keys in this build.
150 INCLUDE_TEST_OTA_KEYS := true
151else # !enable_target_debugging
152 # Target is less debuggable and adbd is off by default
153 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 persist.service.adb.enable=0
154endif # !enable_target_debugging
155
156## tests ##
157
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800158ifeq ($(TARGET_BUILD_VARIANT),tests)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700159override_build_tags := eng debug user development tests
160endif
161
162## sdk ##
163
164ifneq ($(filter sdk,$(MAKECMDGOALS)),)
165ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1)
166$(error The 'sdk' target may not be specified with any other targets)
167endif
The Android Open Source Project66339ad2009-01-15 16:12:07 -0800168override_build_tags := user
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700169ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
170ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700171else # !sdk
172# Enable sync for non-sdk builds only (sdk builds lack SubscribedFeedsProvider).
173ADDITIONAL_BUILD_PROPERTIES += ro.config.sync=yes
174endif
175
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800176ifeq "" "$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES))"
177 # Install an apns-conf.xml file if one's not already being installed.
178 PRODUCT_COPY_FILES += development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
179 ifeq ($(filter sdk,$(MAKECMDGOALS)),)
180 $(warning implicitly installing apns-conf_sdk.xml)
181 endif
182endif
183
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700184ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
185
186# enable vm tracing in files for now to help track
187# the cause of ANRs in the content process
188ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
189
190
191# ------------------------------------------------------------
192# Define a function that, given a list of module tags, returns
193# non-empty if that module should be installed in /system.
194
195# For most goals, anything tagged with "eng"/"debug"/"user" should
196# be installed in /system.
197define should-install-to-system
198$(filter eng debug user,$(1))
199endef
200
201ifneq (,$(filter sdk,$(MAKECMDGOALS)))
202# For the sdk goal, anything with the "samples" tag should be
203# installed in /data even if that module also has "eng"/"debug"/"user".
204define should-install-to-system
205$(if $(filter samples,$(1)),,$(filter eng debug user development,$(1)))
206endef
207endif
208
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800209ifeq ($(TARGET_BUILD_VARIANT),)
210# For the default goal, everything should be installed in /system.
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700211define should-install-to-system
212true
213endef
214endif
215
216
217# If all they typed was make showcommands, we'll actually build
218# the default target.
219ifeq ($(MAKECMDGOALS),showcommands)
220.PHONY: showcommands
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800221showcommands: $(DEFAULT_GOAL)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700222endif
223
224# These targets are going to delete stuff, don't bother including
225# the whole directory tree if that's all we're going to do
226ifeq ($(MAKECMDGOALS),clean)
227dont_bother := true
228endif
229ifeq ($(MAKECMDGOALS),clobber)
230dont_bother := true
231endif
232ifeq ($(MAKECMDGOALS),dataclean)
233dont_bother := true
234endif
235ifeq ($(MAKECMDGOALS),installclean)
236dont_bother := true
237endif
238
239# Bring in all modules that need to be built.
240ifneq ($(dont_bother),true)
241
242subdir_makefiles :=
243
244ifeq ($(HOST_OS),windows)
245SDK_ONLY := true
246endif
247ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
248SDK_ONLY := true
249endif
250
251ifeq ($(SDK_ONLY),true)
252
253subdirs := \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800254 prebuilt \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700255 build/libs/host \
256 dalvik/dexdump \
257 dalvik/libdex \
258 dalvik/tools/dmtracedump \
259 development/emulator/mksdcard \
260 development/tools/activitycreator \
261 development/tools/line_endings \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800262 development/host \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700263 external/expat \
264 external/libpng \
265 external/qemu \
266 external/sqlite/dist \
267 external/zlib \
268 frameworks/base/libs/utils \
269 frameworks/base/tools/aapt \
270 frameworks/base/tools/aidl \
271 system/core/adb \
272 system/core/fastboot \
273 system/core/libcutils \
274 system/core/liblog \
275 system/core/libzipfile
276
277# The following can only be built if "javac" is available.
278# This check is used when building parts of the SDK under Cygwin.
279ifneq (,$(shell which javac 2>/dev/null))
280$(warning sdk-only: javac available.)
281subdirs += \
282 build/tools/signapk \
283 build/tools/zipalign \
284 dalvik/dx \
285 dalvik/libcore \
286 development/apps \
287 development/tools/androidprefs \
288 development/tools/apkbuilder \
289 development/tools/jarutils \
290 development/tools/layoutlib_utils \
291 development/tools/ninepatch \
292 development/tools/sdkstats \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800293 development/tools/sdkmanager \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700294 frameworks/base \
295 frameworks/base/tools/layoutlib \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800296 external/googleclient \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700297 packages
298else
299$(warning sdk-only: javac not available.)
300endif
301
302# Exclude tools/acp when cross-compiling windows under linux
303ifeq ($(findstring Linux,$(UNAME)),)
304subdirs += build/tools/acp
305endif
306
307else # !SDK_ONLY
308ifeq ($(BUILD_TINY_ANDROID), true)
309
310# TINY_ANDROID is a super-minimal build configuration, handy for board
311# bringup and very low level debugging
312
313INTERNAL_DEFAULT_DOCS_TARGETS :=
314
315subdirs := \
316 system/core \
317 external/zlib \
318 build/tools \
319 tools/kcm \
320 external/yaffs2
321else # !BUILD_TINY_ANDROID
322
323#
324# Typical build; include any Android.mk files we can find.
325#
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800326INTERNAL_DEFAULT_DOCS_TARGETS := offline-sdk-docs
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700327subdirs := $(TOP)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800328# Only include Android.mk files directly under vendor/*, not
329# *all* Android.mk files under vendor (which is what would happen
330# if we didn't prune vendor in the findleaves call).
331subdir_makefiles += $(wildcard vendor/*/Android.mk)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700332
333FULL_BUILD := true
334
335endif # !BUILD_TINY_ANDROID
336
337endif # !SDK_ONLY
338
339# Can't use first-makefiles-under here because
340# --mindepth=2 makes the prunes not work.
341subdir_makefiles += \
342 $(shell build/tools/findleaves.sh \
343 --prune="./vendor" --prune="./out" $(subdirs) Android.mk)
344
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800345# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
346# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700347# make sure only one exists.
348# Real boards should always be associated with an OEM vendor.
349board_config_mk := \
350 $(strip $(wildcard \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800351 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
352 vendor/*/$(TARGET_DEVICE)/BoardConfig.mk \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700353 ))
354ifeq ($(board_config_mk),)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800355 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700356endif
357ifneq ($(words $(board_config_mk)),1)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800358 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700359endif
360include $(board_config_mk)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800361TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700362board_config_mk :=
363
The Android Open Source Project35cfb082009-01-22 00:13:40 -0800364# Clean up/verify variables defined by the board config file.
365TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700366
367#
368# Include all of the makefiles in the system
369#
370
371ifneq ($(ONE_SHOT_MAKEFILE),)
372# We've probably been invoked by the "mm" shell function
373# with a subdirectory's makefile.
374include $(ONE_SHOT_MAKEFILE)
375# Change CUSTOM_MODULES to include only modules that were
376# defined by this makefile; this will install all of those
377# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
378# so that the modules will be installed in the same place they
379# would have been with a normal make.
380CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS),))
381FULL_BUILD :=
382INTERNAL_DEFAULT_DOCS_TARGETS :=
383# Stub out the notice targets, which probably aren't defined
384# when using ONE_SHOT_MAKEFILE.
385NOTICE-HOST-%: ;
386NOTICE-TARGET-%: ;
387else
388include $(subdir_makefiles)
389endif
390# -------------------------------------------------------------------
391# All module makefiles have been included at this point.
392# -------------------------------------------------------------------
393
394# -------------------------------------------------------------------
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800395# Include any makefiles that must happen after the module makefiles
396# have been included.
397# TODO: have these files register themselves via a global var rather
398# than hard-coding the list here.
399ifdef FULL_BUILD
400 # Only include this during a full build, otherwise we can't be
401 # guaranteed that any policies were included.
402 -include frameworks/policies/base/PolicyConfig.mk
403endif
404
405# -------------------------------------------------------------------
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700406# Fix up CUSTOM_MODULES to refer to installed files rather than
407# just bare module names. Leave unknown modules alone in case
408# they're actually full paths to a particular file.
409known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
410unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
411CUSTOM_MODULES := \
412 $(call module-installed-files,$(known_custom_modules)) \
413 $(unknown_custom_modules)
414
415# -------------------------------------------------------------------
416# Define dependencies for modules that require other modules.
417# This can only happen now, after we've read in all module makefiles.
418#
419# TODO: deal with the fact that a bare module name isn't
420# unambiguous enough. Maybe declare short targets like
421# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
422# BUG: the system image won't know to depend on modules that are
423# brought in as requirements of other modules.
424define add-required-deps
425$(1): $(2)
426endef
427$(foreach m,$(ALL_MODULES), \
428 $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
429 $(if $(r), \
430 $(eval r := $(call module-installed-files,$(r))) \
431 $(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
432 ) \
433 )
434m :=
435r :=
436add-required-deps :=
437
438# -------------------------------------------------------------------
439# Figure out our module sets.
440
441# Of the modules defined by the component makefiles,
442# determine what we actually want to build.
443# If a module has the "restricted" tag on it, it
444# poisons the rest of the tags and shouldn't appear
445# on any list.
446Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
447 $(ALL_BUILT_MODULES) \
448 $(CUSTOM_MODULES))
449
450ifdef FULL_BUILD
451 # The base list of modules to build for this product is specified
452 # by the appropriate product definition file, which was included
453 # by product_config.make.
454 user_PACKAGES := $(call module-installed-files, \
455 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
456 ifeq (0,1)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800457 $(info user packages for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700458 $(foreach p,$(user_PACKAGES),$(info : $(p)))
459 $(error done)
460 endif
461else
462 # We're not doing a full build, and are probably only including
463 # a subset of the module makefiles. Don't try to build any modules
464 # requested by the product, because we probably won't have rules
465 # to build them.
466 user_PACKAGES :=
467endif
468# Use tags to get the non-APPS user modules. Use the product
469# definition files to get the APPS user modules.
470user_MODULES := $(sort $(call get-tagged-modules,user,_class@APPS restricted))
471user_MODULES := $(user_MODULES) $(user_PACKAGES)
472
473eng_MODULES := $(sort $(call get-tagged-modules,eng,restricted))
474debug_MODULES := $(sort $(call get-tagged-modules,debug,restricted))
475tests_MODULES := $(sort $(call get-tagged-modules,tests,restricted))
476
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700477droid_MODULES := $(sort $(Default_MODULES) \
478 $(eng_MODULES) \
479 $(debug_MODULES) \
480 $(user_MODULES) \
481 $(all_development_MODULES))
482
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700483# THIS IS A TOTAL HACK AND SHOULD NOT BE USED AS AN EXAMPLE
484modules_to_build := $(droid_MODULES)
485ifneq ($(override_build_tags),)
486 modules_to_build := $(sort $(Default_MODULES) \
487 $(foreach tag,$(override_build_tags),$($(tag)_MODULES)))
488#$(error skipping modules $(filter-out $(modules_to_build),$(Default_MODULES) $(droid_MODULES)))
489endif
490
491# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
492# Filter out (do not install) any overridden packages.
493overridden_packages := $(call get-package-overrides,$(modules_to_build))
494ifdef overridden_packages
495# old_modules_to_build := $(modules_to_build)
496 modules_to_build := \
497 $(filter-out $(foreach p,$(overridden_packages),%/$(p) %/$(p).apk), \
498 $(modules_to_build))
499endif
500#$(error filtered out $(filter-out $(modules_to_build),$(old_modules_to_build)))
501
The Android Open Source Project66339ad2009-01-15 16:12:07 -0800502# Don't include any GNU targets in the SDK. It's ok (and necessary)
503# to build the host tools, but nothing that's going to be installed
504# on the target (including static libraries).
505ifneq ($(filter sdk,$(MAKECMDGOALS)),)
506 target_gnu_MODULES := \
507 $(filter \
508 $(TARGET_OUT_INTERMEDIATES)/% \
509 $(TARGET_OUT)/% \
510 $(TARGET_OUT_DATA)/%, \
511 $(sort $(call get-tagged-modules,gnu)))
512 $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
513 modules_to_build := \
514 $(filter-out $(target_gnu_MODULES),$(modules_to_build))
515endif
516
517
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700518# config/Makefile contains extra stuff that we don't want to pollute this
519# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
520# contains everything that's built during the current make, but it also further
521# extends ALL_DEFAULT_INSTALLED_MODULES.
522ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_build)
523include $(BUILD_SYSTEM)/Makefile
524modules_to_build := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
525ALL_DEFAULT_INSTALLED_MODULES :=
526
527endif # dont_bother
528
529# -------------------------------------------------------------------
530# This is used to to get the ordering right, you can also use these,
531# but they're considered undocumented, so don't complain if their
532# behavior changes.
533.PHONY: prebuilt
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800534prebuilt: $(ALL_PREBUILT)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700535
536# An internal target that depends on all copied headers
537# (see copy_headers.make). Other targets that need the
538# headers to be copied first can depend on this target.
539.PHONY: all_copied_headers
540all_copied_headers: ;
541
542$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
543
544# All the droid stuff, in directories
545.PHONY: files
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800546files: prebuilt $(modules_to_build) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700547
548# -------------------------------------------------------------------
549
550.PHONY: ramdisk
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800551ramdisk: $(INSTALLED_RAMDISK_TARGET)
552
553.PHONY: systemtarball
554systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700555
556.PHONY: userdataimage
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800557userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
558
559.PHONY: userdatatarball
560userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700561
562.PHONY: bootimage
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800563bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700564
565ifeq ($(BUILD_TINY_ANDROID), true)
566INSTALLED_RECOVERYIMAGE_TARGET :=
567endif
568
569# Build files and then package it into the rom formats
570.PHONY: droidcore
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800571droidcore: files \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700572 systemimage \
573 $(INSTALLED_BOOTIMAGE_TARGET) \
574 $(INSTALLED_RECOVERYIMAGE_TARGET) \
575 $(INSTALLED_USERDATAIMAGE_TARGET) \
576 $(INTERNAL_DEFAULT_DOCS_TARGETS)
577
578# The actual files built by the droidcore target changes depending
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800579# on the build variant.
580.PHONY: droid tests
581droid tests: droidcore
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700582
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800583$(call dist-for-goals, droid, \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700584 $(INTERNAL_UPDATE_PACKAGE_TARGET) \
585 $(INTERNAL_OTA_PACKAGE_TARGET) \
586 $(SYMBOLS_ZIP) \
587 $(APPS_ZIP) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700588 $(INTERNAL_EMULATOR_PACKAGE_TARGET) \
589 $(PACKAGE_STATS_FILE) \
590 $(INSTALLED_FILES_FILE) \
591 $(INSTALLED_BUILD_PROP_TARGET) \
592 $(BUILT_TARGET_FILES_PACKAGE) \
593 )
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800594
595# Tests are installed in userdata.img. If we're building the tests
596# variant, copy it for "make tests dist". Also copy a zip of the
597# contents of userdata.img, so that people can easily extract a
598# single .apk.
599ifeq ($(TARGET_BUILD_VARIANT),tests)
600$(call dist-for-goals, droid, \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700601 $(INSTALLED_USERDATAIMAGE_TARGET) \
602 $(BUILT_TESTS_ZIP_PACKAGE) \
603 )
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800604endif
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700605
606.PHONY: docs
607docs: $(ALL_DOCS)
608
609.PHONY: sdk
610ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800611sdk: $(ALL_SDK_TARGETS)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700612$(call dist-for-goals,sdk,$(ALL_SDK_TARGETS))
613
614.PHONY: findbugs
615findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
616
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700617.PHONY: clean
618dirs_to_clean := \
619 $(PRODUCT_OUT) \
620 $(TARGET_COMMON_OUT_ROOT) \
621 $(HOST_OUT) \
622 $(HOST_COMMON_OUT_ROOT)
623clean:
624 @for dir in $(dirs_to_clean) ; do \
625 echo "Cleaning $$dir..."; \
626 rm -rf $$dir; \
627 done
628 @echo "Clean."; \
629
630.PHONY: clobber
631clobber:
632 @rm -rf $(OUT_DIR)
633 @echo "Entire build directory removed."
634
635.PHONY: dataclean
636dataclean:
637 @rm -rf $(PRODUCT_OUT)/data/*
638 @rm -rf $(PRODUCT_OUT)/data-qemu/*
639 @rm -rf $(PRODUCT_OUT)/userdata-qemu.img
640 @echo "Deleted emulator userdata images."
641
642.PHONY: installclean
643# Deletes all of the files that change between different build types,
644# like "make user" vs. "make sdk". This lets you work with different
645# build types without having to do a full clean each time. E.g.:
646#
647# $ make -j8 all
648# $ make installclean
649# $ make -j8 user
650# $ make installclean
651# $ make -j8 sdk
652#
653installclean: dataclean
654 $(hide) rm -rf ./$(PRODUCT_OUT)/system
655 $(hide) rm -rf ./$(PRODUCT_OUT)/recovery
656 $(hide) rm -rf ./$(PRODUCT_OUT)/data
657 $(hide) rm -rf ./$(PRODUCT_OUT)/root
658 $(hide) rm -rf ./$(PRODUCT_OUT)/obj/NOTICE_FILES
659 @# Remove APPS because they may contain the wrong resources.
660 $(hide) rm -rf ./$(PRODUCT_OUT)/obj/APPS
661 $(hide) rm -rf ./$(HOST_OUT)/obj/NOTICE_FILES
662 $(hide) rm -rf ./$(HOST_OUT)/sdk
663 $(hide) rm -rf ./$(PRODUCT_OUT)/obj/PACKAGING
664 $(hide) rm -f ./$(PRODUCT_OUT)/*.img
665 $(hide) rm -f ./$(PRODUCT_OUT)/*.zip
666 $(hide) rm -f ./$(PRODUCT_OUT)/*.txt
667 $(hide) rm -f ./$(PRODUCT_OUT)/*.xlb
668 @echo "Deleted images and staging directories."
669
670#xxx scrape this from ALL_MODULE_NAME_TAGS
671.PHONY: modules
672modules:
673 @echo "Available sub-modules:"
674 @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
675 sed -e 's/ */\n/g' | sort -u | $(COLUMN)
676
677.PHONY: showcommands
678showcommands:
679 @echo >/dev/null
680