blob: f190ffb41d7389d5e134a948c71ea511efb6ceef [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
3SHELL := /bin/bash
4
5# this turns off the suffix rules built into make
6.SUFFIXES:
7
8# If a rule fails, delete $@.
9.DELETE_ON_ERROR:
10
11# Figure out where we are.
12#TOP := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
13#TOP := $(patsubst %/,%,$(TOP))
14
15# TOPDIR is the normal variable you should use, because
16# if we are executing relative to the current directory
17# it can be "", whereas TOP must be "." which causes
18# pattern matching probles when make strips off the
19# trailing "./" from paths in various places.
20#ifeq ($(TOP),.)
21#TOPDIR :=
22#else
23#TOPDIR := $(TOP)/
24#endif
25
26# check for broken versions of make
27ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") \>= 3.81))
28$(warning ********************************************************************************)
29$(warning * You are using version $(MAKE_VERSION) of make.)
30$(warning * You must upgrade to version 3.81 or greater.)
31$(warning * see file://$(shell pwd)/docs/development-environment/machine-setup.html)
32$(warning ********************************************************************************)
33$(error stopping)
34endif
35
36TOP := .
37TOPDIR :=
38
39BUILD_SYSTEM := $(TOPDIR)build/core
40
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -080041# This is the default target. It must be the first declared target.
42DEFAULT_GOAL := droid
43$(DEFAULT_GOAL):
44
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070045# Set up various standard variables based on configuration
46# and host information.
47include $(BUILD_SYSTEM)/config.mk
48
49# This allows us to force a clean build - included after the config.make
50# environment setup is done, but before we generate any dependencies. This
51# file does the rm -rf inline so the deps which are all done below will
52# be generated correctly
53include $(BUILD_SYSTEM)/cleanbuild.mk
54
55ifneq ($(HOST_OS),windows)
56ifneq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
57# check for a case sensitive file system
58ifneq (a,$(shell mkdir -p $(OUT_DIR) ; \
59 echo a > $(OUT_DIR)/casecheck.txt; \
60 echo B > $(OUT_DIR)/CaseCheck.txt; \
61 cat $(OUT_DIR)/casecheck.txt))
62$(warning ************************************************************)
63$(warning You are building on a case-insensitive filesystem.)
64$(warning Please move your source tree to a case-sensitive filesystem.)
65$(warning ************************************************************)
66$(error Case-insensitive filesystems not supported)
67endif
68endif
69endif
70
71# Make sure that there are no spaces in the absolute path; the
72# build system can't deal with them.
73ifneq ($(words $(shell pwd)),1)
74$(warning ************************************************************)
75$(warning You are building in a directory whose absolute path contains)
76$(warning a space character:)
77$(warning $(space))
78$(warning "$(shell pwd)")
79$(warning $(space))
80$(warning Please move your source tree to a path that does not contain)
81$(warning any spaces.)
82$(warning ************************************************************)
83$(error Directory names containing spaces not supported)
84endif
85
86# Set up version information.
87include $(BUILD_SYSTEM)/version_defaults.mk
88
89# These are the modifier targets that don't do anything themselves, but
90# change the behavior of the build.
91# (must be defined before including definitions.make)
92INTERNAL_MODIFIER_TARGETS := showcommands
93
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070094# Bring in standard build system definitions.
95include $(BUILD_SYSTEM)/definitions.mk
96
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -080097ifneq ($(filter eng user userdebug tests,$(MAKECMDGOALS)),)
98$(info ***************************************************************)
99$(info ***************************************************************)
100$(info Don't pass '$(filter eng user userdebug tests,$(MAKECMDGOALS))' on \
101 the make command line.)
102$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or)
103$(info choosecombo.)
104$(info ***************************************************************)
105$(info ***************************************************************)
106$(error stopping)
107endif
108
109
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700110###
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800111### In this section we set up the things that are different
112### between the build variants
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700113###
114
115## user/userdebug ##
116
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800117user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700118enable_target_debugging := true
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800119ifneq (,$(user_variant))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700120 # Target is secure in user builds.
121 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
122
123 override_build_tags := user
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800124 ifeq ($(user_variant),userdebug)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700125 # Pick up some extra useful tools
126 override_build_tags += debug
127 else
128 # Disable debugging in plain user builds.
129 enable_target_debugging :=
130 endif
131
132 # TODO: Always set WITH_DEXPREOPT (for user builds) once it works on OSX.
133 # Also, remove the corresponding block in config/product_config.make.
134 ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
135 WITH_DEXPREOPT := true
136 endif
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800137else # !user_variant
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700138 # Turn on checkjni for non-user builds.
139 ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
140 # Set device insecure for non-user builds.
141 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800142endif # !user_variant
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700143
144ifeq (true,$(strip $(enable_target_debugging)))
145 # Target is more debuggable and adbd is on by default
146 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1
147 # Include the debugging/testing OTA keys in this build.
148 INCLUDE_TEST_OTA_KEYS := true
149else # !enable_target_debugging
150 # Target is less debuggable and adbd is off by default
151 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 persist.service.adb.enable=0
152endif # !enable_target_debugging
153
154## tests ##
155
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800156ifeq ($(TARGET_BUILD_VARIANT),tests)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700157override_build_tags := eng debug user development tests
158endif
159
160## sdk ##
161
162ifneq ($(filter sdk,$(MAKECMDGOALS)),)
163ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1)
164$(error The 'sdk' target may not be specified with any other targets)
165endif
166override_build_tags := development
167ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
168ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700169else # !sdk
170# Enable sync for non-sdk builds only (sdk builds lack SubscribedFeedsProvider).
171ADDITIONAL_BUILD_PROPERTIES += ro.config.sync=yes
172endif
173
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800174ifeq "" "$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES))"
175 # Install an apns-conf.xml file if one's not already being installed.
176 PRODUCT_COPY_FILES += development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
177 ifeq ($(filter sdk,$(MAKECMDGOALS)),)
178 $(warning implicitly installing apns-conf_sdk.xml)
179 endif
180endif
181
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700182ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
183
184# enable vm tracing in files for now to help track
185# the cause of ANRs in the content process
186ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
187
188
189# ------------------------------------------------------------
190# Define a function that, given a list of module tags, returns
191# non-empty if that module should be installed in /system.
192
193# For most goals, anything tagged with "eng"/"debug"/"user" should
194# be installed in /system.
195define should-install-to-system
196$(filter eng debug user,$(1))
197endef
198
199ifneq (,$(filter sdk,$(MAKECMDGOALS)))
200# For the sdk goal, anything with the "samples" tag should be
201# installed in /data even if that module also has "eng"/"debug"/"user".
202define should-install-to-system
203$(if $(filter samples,$(1)),,$(filter eng debug user development,$(1)))
204endef
205endif
206
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800207ifeq ($(TARGET_BUILD_VARIANT),)
208# For the default goal, everything should be installed in /system.
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700209define should-install-to-system
210true
211endef
212endif
213
214
215# If all they typed was make showcommands, we'll actually build
216# the default target.
217ifeq ($(MAKECMDGOALS),showcommands)
218.PHONY: showcommands
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800219showcommands: $(DEFAULT_GOAL)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700220endif
221
222# These targets are going to delete stuff, don't bother including
223# the whole directory tree if that's all we're going to do
224ifeq ($(MAKECMDGOALS),clean)
225dont_bother := true
226endif
227ifeq ($(MAKECMDGOALS),clobber)
228dont_bother := true
229endif
230ifeq ($(MAKECMDGOALS),dataclean)
231dont_bother := true
232endif
233ifeq ($(MAKECMDGOALS),installclean)
234dont_bother := true
235endif
236
237# Bring in all modules that need to be built.
238ifneq ($(dont_bother),true)
239
240subdir_makefiles :=
241
242ifeq ($(HOST_OS),windows)
243SDK_ONLY := true
244endif
245ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
246SDK_ONLY := true
247endif
248
249ifeq ($(SDK_ONLY),true)
250
251subdirs := \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800252 prebuilt \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700253 build/libs/host \
254 dalvik/dexdump \
255 dalvik/libdex \
256 dalvik/tools/dmtracedump \
257 development/emulator/mksdcard \
258 development/tools/activitycreator \
259 development/tools/line_endings \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800260 development/host \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700261 external/expat \
262 external/libpng \
263 external/qemu \
264 external/sqlite/dist \
265 external/zlib \
266 frameworks/base/libs/utils \
267 frameworks/base/tools/aapt \
268 frameworks/base/tools/aidl \
269 system/core/adb \
270 system/core/fastboot \
271 system/core/libcutils \
272 system/core/liblog \
273 system/core/libzipfile
274
275# The following can only be built if "javac" is available.
276# This check is used when building parts of the SDK under Cygwin.
277ifneq (,$(shell which javac 2>/dev/null))
278$(warning sdk-only: javac available.)
279subdirs += \
280 build/tools/signapk \
281 build/tools/zipalign \
282 dalvik/dx \
283 dalvik/libcore \
284 development/apps \
285 development/tools/androidprefs \
286 development/tools/apkbuilder \
287 development/tools/jarutils \
288 development/tools/layoutlib_utils \
289 development/tools/ninepatch \
290 development/tools/sdkstats \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800291 development/tools/sdkmanager \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700292 frameworks/base \
293 frameworks/base/tools/layoutlib \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800294 external/googleclient \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700295 packages
296else
297$(warning sdk-only: javac not available.)
298endif
299
300# Exclude tools/acp when cross-compiling windows under linux
301ifeq ($(findstring Linux,$(UNAME)),)
302subdirs += build/tools/acp
303endif
304
305else # !SDK_ONLY
306ifeq ($(BUILD_TINY_ANDROID), true)
307
308# TINY_ANDROID is a super-minimal build configuration, handy for board
309# bringup and very low level debugging
310
311INTERNAL_DEFAULT_DOCS_TARGETS :=
312
313subdirs := \
314 system/core \
315 external/zlib \
316 build/tools \
317 tools/kcm \
318 external/yaffs2
319else # !BUILD_TINY_ANDROID
320
321#
322# Typical build; include any Android.mk files we can find.
323#
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800324INTERNAL_DEFAULT_DOCS_TARGETS := offline-sdk-docs
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700325subdirs := $(TOP)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800326# Only include Android.mk files directly under vendor/*, not
327# *all* Android.mk files under vendor (which is what would happen
328# if we didn't prune vendor in the findleaves call).
329subdir_makefiles += $(wildcard vendor/*/Android.mk)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700330
331FULL_BUILD := true
332
333endif # !BUILD_TINY_ANDROID
334
335endif # !SDK_ONLY
336
337# Can't use first-makefiles-under here because
338# --mindepth=2 makes the prunes not work.
339subdir_makefiles += \
340 $(shell build/tools/findleaves.sh \
341 --prune="./vendor" --prune="./out" $(subdirs) Android.mk)
342
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800343# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
344# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700345# make sure only one exists.
346# Real boards should always be associated with an OEM vendor.
347board_config_mk := \
348 $(strip $(wildcard \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800349 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
350 vendor/*/$(TARGET_DEVICE)/BoardConfig.mk \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700351 ))
352ifeq ($(board_config_mk),)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800353 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700354endif
355ifneq ($(words $(board_config_mk)),1)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800356 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700357endif
358include $(board_config_mk)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800359TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700360board_config_mk :=
361
362ifdef CUSTOM_PKG
363$(info ***************************************************************)
364$(info ***************************************************************)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800365$(info CUSTOM_PKG is obsolete; use CUSTOM_MODULES)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700366$(info ***************************************************************)
367$(info ***************************************************************)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800368$(error stopping)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700369endif
370ifdef CUSTOM_TARGETS
371$(info ***************************************************************)
372$(info ***************************************************************)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800373$(info CUSTOM_TARGETS is obsolete; use CUSTOM_MODULES)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700374$(info ***************************************************************)
375$(info ***************************************************************)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800376$(error stopping)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700377endif
378
379#
380# Include all of the makefiles in the system
381#
382
383ifneq ($(ONE_SHOT_MAKEFILE),)
384# We've probably been invoked by the "mm" shell function
385# with a subdirectory's makefile.
386include $(ONE_SHOT_MAKEFILE)
387# Change CUSTOM_MODULES to include only modules that were
388# defined by this makefile; this will install all of those
389# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
390# so that the modules will be installed in the same place they
391# would have been with a normal make.
392CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS),))
393FULL_BUILD :=
394INTERNAL_DEFAULT_DOCS_TARGETS :=
395# Stub out the notice targets, which probably aren't defined
396# when using ONE_SHOT_MAKEFILE.
397NOTICE-HOST-%: ;
398NOTICE-TARGET-%: ;
399else
400include $(subdir_makefiles)
401endif
402# -------------------------------------------------------------------
403# All module makefiles have been included at this point.
404# -------------------------------------------------------------------
405
406# -------------------------------------------------------------------
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800407# Include any makefiles that must happen after the module makefiles
408# have been included.
409# TODO: have these files register themselves via a global var rather
410# than hard-coding the list here.
411ifdef FULL_BUILD
412 # Only include this during a full build, otherwise we can't be
413 # guaranteed that any policies were included.
414 -include frameworks/policies/base/PolicyConfig.mk
415endif
416
417# -------------------------------------------------------------------
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700418# Fix up CUSTOM_MODULES to refer to installed files rather than
419# just bare module names. Leave unknown modules alone in case
420# they're actually full paths to a particular file.
421known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
422unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
423CUSTOM_MODULES := \
424 $(call module-installed-files,$(known_custom_modules)) \
425 $(unknown_custom_modules)
426
427# -------------------------------------------------------------------
428# Define dependencies for modules that require other modules.
429# This can only happen now, after we've read in all module makefiles.
430#
431# TODO: deal with the fact that a bare module name isn't
432# unambiguous enough. Maybe declare short targets like
433# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
434# BUG: the system image won't know to depend on modules that are
435# brought in as requirements of other modules.
436define add-required-deps
437$(1): $(2)
438endef
439$(foreach m,$(ALL_MODULES), \
440 $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
441 $(if $(r), \
442 $(eval r := $(call module-installed-files,$(r))) \
443 $(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
444 ) \
445 )
446m :=
447r :=
448add-required-deps :=
449
450# -------------------------------------------------------------------
451# Figure out our module sets.
452
453# Of the modules defined by the component makefiles,
454# determine what we actually want to build.
455# If a module has the "restricted" tag on it, it
456# poisons the rest of the tags and shouldn't appear
457# on any list.
458Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
459 $(ALL_BUILT_MODULES) \
460 $(CUSTOM_MODULES))
461
462ifdef FULL_BUILD
463 # The base list of modules to build for this product is specified
464 # by the appropriate product definition file, which was included
465 # by product_config.make.
466 user_PACKAGES := $(call module-installed-files, \
467 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
468 ifeq (0,1)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800469 $(info user packages for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700470 $(foreach p,$(user_PACKAGES),$(info : $(p)))
471 $(error done)
472 endif
473else
474 # We're not doing a full build, and are probably only including
475 # a subset of the module makefiles. Don't try to build any modules
476 # requested by the product, because we probably won't have rules
477 # to build them.
478 user_PACKAGES :=
479endif
480# Use tags to get the non-APPS user modules. Use the product
481# definition files to get the APPS user modules.
482user_MODULES := $(sort $(call get-tagged-modules,user,_class@APPS restricted))
483user_MODULES := $(user_MODULES) $(user_PACKAGES)
484
485eng_MODULES := $(sort $(call get-tagged-modules,eng,restricted))
486debug_MODULES := $(sort $(call get-tagged-modules,debug,restricted))
487tests_MODULES := $(sort $(call get-tagged-modules,tests,restricted))
488
489# Don't include any GNU targets in the SDK. It's ok (and necessary)
490# to build the host tools, but nothing that's going to be installed
491# on the target (including static libraries).
492all_development_MODULES := \
493 $(sort $(call get-tagged-modules,development,restricted))
494target_gnu_MODULES := \
495 $(filter \
496 $(TARGET_OUT_INTERMEDIATES)/% \
497 $(TARGET_OUT)/% \
498 $(TARGET_OUT_DATA)/%, \
499 $(sort $(call get-tagged-modules,gnu)))
500#$(info Removing from development:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
501development_MODULES := \
502 $(filter-out $(target_gnu_MODULES),$(all_development_MODULES))
503
504droid_MODULES := $(sort $(Default_MODULES) \
505 $(eng_MODULES) \
506 $(debug_MODULES) \
507 $(user_MODULES) \
508 $(all_development_MODULES))
509
510# The list of everything that's not on droid_MODULES.
511# Also skip modules tagged as "restricted", which are
512# never installed unless explicitly mentioned in
513# CUSTOM_MODULES.
514nonDroid_MODULES := $(sort $(call get-tagged-modules,\
515 $(ALL_MODULE_TAGS),\
516 eng debug user development restricted))
517
518# THIS IS A TOTAL HACK AND SHOULD NOT BE USED AS AN EXAMPLE
519modules_to_build := $(droid_MODULES)
520ifneq ($(override_build_tags),)
521 modules_to_build := $(sort $(Default_MODULES) \
522 $(foreach tag,$(override_build_tags),$($(tag)_MODULES)))
523#$(error skipping modules $(filter-out $(modules_to_build),$(Default_MODULES) $(droid_MODULES)))
524endif
525
526# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
527# Filter out (do not install) any overridden packages.
528overridden_packages := $(call get-package-overrides,$(modules_to_build))
529ifdef overridden_packages
530# old_modules_to_build := $(modules_to_build)
531 modules_to_build := \
532 $(filter-out $(foreach p,$(overridden_packages),%/$(p) %/$(p).apk), \
533 $(modules_to_build))
534endif
535#$(error filtered out $(filter-out $(modules_to_build),$(old_modules_to_build)))
536
537# config/Makefile contains extra stuff that we don't want to pollute this
538# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
539# contains everything that's built during the current make, but it also further
540# extends ALL_DEFAULT_INSTALLED_MODULES.
541ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_build)
542include $(BUILD_SYSTEM)/Makefile
543modules_to_build := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
544ALL_DEFAULT_INSTALLED_MODULES :=
545
546endif # dont_bother
547
548# -------------------------------------------------------------------
549# This is used to to get the ordering right, you can also use these,
550# but they're considered undocumented, so don't complain if their
551# behavior changes.
552.PHONY: prebuilt
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800553prebuilt: $(ALL_PREBUILT)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700554
555# An internal target that depends on all copied headers
556# (see copy_headers.make). Other targets that need the
557# headers to be copied first can depend on this target.
558.PHONY: all_copied_headers
559all_copied_headers: ;
560
561$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
562
563# All the droid stuff, in directories
564.PHONY: files
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800565files: prebuilt $(modules_to_build) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700566
567# -------------------------------------------------------------------
568
569.PHONY: ramdisk
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800570ramdisk: $(INSTALLED_RAMDISK_TARGET)
571
572.PHONY: systemtarball
573systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700574
575.PHONY: userdataimage
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800576userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
577
578.PHONY: userdatatarball
579userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700580
581.PHONY: bootimage
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800582bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700583
584ifeq ($(BUILD_TINY_ANDROID), true)
585INSTALLED_RECOVERYIMAGE_TARGET :=
586endif
587
588# Build files and then package it into the rom formats
589.PHONY: droidcore
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800590droidcore: files \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700591 systemimage \
592 $(INSTALLED_BOOTIMAGE_TARGET) \
593 $(INSTALLED_RECOVERYIMAGE_TARGET) \
594 $(INSTALLED_USERDATAIMAGE_TARGET) \
595 $(INTERNAL_DEFAULT_DOCS_TARGETS)
596
597# The actual files built by the droidcore target changes depending
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800598# on the build variant.
599.PHONY: droid tests
600droid tests: droidcore
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700601
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800602$(call dist-for-goals, droid, \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700603 $(INTERNAL_UPDATE_PACKAGE_TARGET) \
604 $(INTERNAL_OTA_PACKAGE_TARGET) \
605 $(SYMBOLS_ZIP) \
606 $(APPS_ZIP) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700607 $(INTERNAL_EMULATOR_PACKAGE_TARGET) \
608 $(PACKAGE_STATS_FILE) \
609 $(INSTALLED_FILES_FILE) \
610 $(INSTALLED_BUILD_PROP_TARGET) \
611 $(BUILT_TARGET_FILES_PACKAGE) \
612 )
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800613
614# Tests are installed in userdata.img. If we're building the tests
615# variant, copy it for "make tests dist". Also copy a zip of the
616# contents of userdata.img, so that people can easily extract a
617# single .apk.
618ifeq ($(TARGET_BUILD_VARIANT),tests)
619$(call dist-for-goals, droid, \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700620 $(INSTALLED_USERDATAIMAGE_TARGET) \
621 $(BUILT_TESTS_ZIP_PACKAGE) \
622 )
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800623endif
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700624
625.PHONY: docs
626docs: $(ALL_DOCS)
627
628.PHONY: sdk
629ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800630sdk: $(ALL_SDK_TARGETS)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700631$(call dist-for-goals,sdk,$(ALL_SDK_TARGETS))
632
633.PHONY: findbugs
634findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
635
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700636.PHONY: clean
637dirs_to_clean := \
638 $(PRODUCT_OUT) \
639 $(TARGET_COMMON_OUT_ROOT) \
640 $(HOST_OUT) \
641 $(HOST_COMMON_OUT_ROOT)
642clean:
643 @for dir in $(dirs_to_clean) ; do \
644 echo "Cleaning $$dir..."; \
645 rm -rf $$dir; \
646 done
647 @echo "Clean."; \
648
649.PHONY: clobber
650clobber:
651 @rm -rf $(OUT_DIR)
652 @echo "Entire build directory removed."
653
654.PHONY: dataclean
655dataclean:
656 @rm -rf $(PRODUCT_OUT)/data/*
657 @rm -rf $(PRODUCT_OUT)/data-qemu/*
658 @rm -rf $(PRODUCT_OUT)/userdata-qemu.img
659 @echo "Deleted emulator userdata images."
660
661.PHONY: installclean
662# Deletes all of the files that change between different build types,
663# like "make user" vs. "make sdk". This lets you work with different
664# build types without having to do a full clean each time. E.g.:
665#
666# $ make -j8 all
667# $ make installclean
668# $ make -j8 user
669# $ make installclean
670# $ make -j8 sdk
671#
672installclean: dataclean
673 $(hide) rm -rf ./$(PRODUCT_OUT)/system
674 $(hide) rm -rf ./$(PRODUCT_OUT)/recovery
675 $(hide) rm -rf ./$(PRODUCT_OUT)/data
676 $(hide) rm -rf ./$(PRODUCT_OUT)/root
677 $(hide) rm -rf ./$(PRODUCT_OUT)/obj/NOTICE_FILES
678 @# Remove APPS because they may contain the wrong resources.
679 $(hide) rm -rf ./$(PRODUCT_OUT)/obj/APPS
680 $(hide) rm -rf ./$(HOST_OUT)/obj/NOTICE_FILES
681 $(hide) rm -rf ./$(HOST_OUT)/sdk
682 $(hide) rm -rf ./$(PRODUCT_OUT)/obj/PACKAGING
683 $(hide) rm -f ./$(PRODUCT_OUT)/*.img
684 $(hide) rm -f ./$(PRODUCT_OUT)/*.zip
685 $(hide) rm -f ./$(PRODUCT_OUT)/*.txt
686 $(hide) rm -f ./$(PRODUCT_OUT)/*.xlb
687 @echo "Deleted images and staging directories."
688
689#xxx scrape this from ALL_MODULE_NAME_TAGS
690.PHONY: modules
691modules:
692 @echo "Available sub-modules:"
693 @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
694 sed -e 's/ */\n/g' | sort -u | $(COLUMN)
695
696.PHONY: showcommands
697showcommands:
698 @echo >/dev/null
699