blob: 9a8e4d5228e1e4b40a76bab851cd562699ce2e57 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001
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.
5SHELL := /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
43# This is the default target. It must be the first declared target.
44DEFAULT_GOAL := droid
45$(DEFAULT_GOAL):
46
47# 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
The Android Open Source Project88b60792009-03-03 19:28:42 -080088# These are the modifier targets that don't do anything themselves, but
89# change the behavior of the build.
90# (must be defined before including definitions.make)
91INTERNAL_MODIFIER_TARGETS := showcommands
92
93# Bring in standard build system definitions.
94include $(BUILD_SYSTEM)/definitions.mk
95
96ifneq ($(filter eng user userdebug tests,$(MAKECMDGOALS)),)
97$(info ***************************************************************)
98$(info ***************************************************************)
99$(info Don't pass '$(filter eng user userdebug tests,$(MAKECMDGOALS))' on \
100 the make command line.)
The Android Open Source Project2f312932009-03-09 11:52:11 -0700101# XXX The single quote on this line fixes gvim's syntax highlighting.
102# Without which, the rest of this file is impossible to read.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800103$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or)
104$(info choosecombo.)
105$(info ***************************************************************)
106$(info ***************************************************************)
107$(error stopping)
108endif
109
The Android Open Source Project2f312932009-03-09 11:52:11 -0700110ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),)
111$(info ***************************************************************)
112$(info ***************************************************************)
113$(info Invalid variant: $(TARGET_BUILD_VARIANT)
114$(info Valid values are: $(INTERNAL_VALID_VARIANTS)
115$(info ***************************************************************)
116$(info ***************************************************************)
117$(error stopping)
118endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800119
120###
121### In this section we set up the things that are different
122### between the build variants
123###
124
Joe Onoratoeb19b3e2009-04-13 16:32:16 -0700125is_sdk_build :=
126ifneq ($(filter sdk,$(MAKECMDGOALS)),)
127is_sdk_build := true
128endif
129ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
130is_sdk_build := true
131endif
132
133
The Android Open Source Project88b60792009-03-03 19:28:42 -0800134## user/userdebug ##
135
136user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
137enable_target_debugging := true
138ifneq (,$(user_variant))
139 # Target is secure in user builds.
140 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
141
The Android Open Source Project2f312932009-03-09 11:52:11 -0700142 tags_to_install := user
The Android Open Source Project88b60792009-03-03 19:28:42 -0800143 ifeq ($(user_variant),userdebug)
144 # Pick up some extra useful tools
The Android Open Source Project2f312932009-03-09 11:52:11 -0700145 tags_to_install += debug
The Android Open Source Project88b60792009-03-03 19:28:42 -0800146 else
147 # Disable debugging in plain user builds.
148 enable_target_debugging :=
149 endif
150
151 # TODO: Always set WITH_DEXPREOPT (for user builds) once it works on OSX.
152 # Also, remove the corresponding block in config/product_config.make.
153 ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
154 WITH_DEXPREOPT := true
155 endif
156
157 # Disallow mock locations by default for user builds
158 ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0
159
160else # !user_variant
161 # Turn on checkjni for non-user builds.
162 ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
163 # Set device insecure for non-user builds.
164 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
165 # Allow mock locations by default for non user builds
166 ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1
167endif # !user_variant
168
169ifeq (true,$(strip $(enable_target_debugging)))
170 # Target is more debuggable and adbd is on by default
171 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1
172 # Include the debugging/testing OTA keys in this build.
173 INCLUDE_TEST_OTA_KEYS := true
174else # !enable_target_debugging
175 # Target is less debuggable and adbd is off by default
176 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 persist.service.adb.enable=0
177endif # !enable_target_debugging
178
The Android Open Source Project2f312932009-03-09 11:52:11 -0700179## eng ##
180
181ifeq ($(TARGET_BUILD_VARIANT),eng)
182tags_to_install := user debug eng
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700183 # Don't require the setup wizard on eng builds
184 ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
185 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES)))
The Android Open Source Project2f312932009-03-09 11:52:11 -0700186endif
187
The Android Open Source Project88b60792009-03-03 19:28:42 -0800188## tests ##
189
190ifeq ($(TARGET_BUILD_VARIANT),tests)
The Android Open Source Project2f312932009-03-09 11:52:11 -0700191tags_to_install := user debug eng tests
The Android Open Source Project88b60792009-03-03 19:28:42 -0800192endif
193
194## sdk ##
195
Joe Onoratoeb19b3e2009-04-13 16:32:16 -0700196ifdef is_sdk_build
The Android Open Source Project88b60792009-03-03 19:28:42 -0800197ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1)
198$(error The 'sdk' target may not be specified with any other targets)
199endif
The Android Open Source Project2f312932009-03-09 11:52:11 -0700200# TODO: this should be eng I think. Since the sdk is built from the eng
201# variant.
Xavier Ducrohetf3e79f92009-04-06 20:32:24 -0700202tags_to_install := user debug eng
The Android Open Source Project88b60792009-03-03 19:28:42 -0800203ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
204ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
205else # !sdk
206# Enable sync for non-sdk builds only (sdk builds lack SubscribedFeedsProvider).
207ADDITIONAL_BUILD_PROPERTIES += ro.config.sync=yes
208endif
209
Andy McFadden743e2502009-04-13 14:48:35 -0700210## precise GC ##
211
212ifneq ($(filter dalvik.gc.type-precise,$(PRODUCT_TAGS)),)
213 # Enabling type-precise GC results in larger optimized DEX files. The
214 # additional storage requirements for ".odex" files can cause /system
215 # to overflow on some devices, so this is configured separately for
216 # each product.
217 ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dexopt-flags=m=y
218endif
219
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700220# Install an apns-conf.xml file if one's not already being installed.
221ifeq (,$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES)))
222 PRODUCT_COPY_FILES += \
223 development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
224 ifeq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800225 $(warning implicitly installing apns-conf_sdk.xml)
226 endif
227endif
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700228# If we're on an eng or tests build, but not on the sdk, and we have
229# a better one, use that instead.
230ifneq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
Patrick Scott1f04a3b2009-06-09 10:34:45 -0400231 ifndef is_sdk_build
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700232 apns_to_use := $(wildcard vendor/google/etc/apns-conf.xml)
233 ifneq ($(strip $(apns_to_use)),)
234 PRODUCT_COPY_FILES := \
235 $(filter-out %:system/etc/apns-conf.xml,$(PRODUCT_COPY_FILES)) \
236 $(strip $(apns_to_use)):system/etc/apns-conf.xml
237 endif
238 endif
239endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800240
241ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
242
243# enable vm tracing in files for now to help track
244# the cause of ANRs in the content process
245ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
246
247
248# ------------------------------------------------------------
249# Define a function that, given a list of module tags, returns
250# non-empty if that module should be installed in /system.
251
The Android Open Source Project2f312932009-03-09 11:52:11 -0700252# For most goals, anything not tagged with the "tests" tag should
The Android Open Source Project88b60792009-03-03 19:28:42 -0800253# be installed in /system.
254define should-install-to-system
The Android Open Source Project2f312932009-03-09 11:52:11 -0700255$(if $(filter tests,$(1)),,true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800256endef
257
Joe Onoratoeb19b3e2009-04-13 16:32:16 -0700258ifdef is_sdk_build
The Android Open Source Project88b60792009-03-03 19:28:42 -0800259# For the sdk goal, anything with the "samples" tag should be
260# installed in /data even if that module also has "eng"/"debug"/"user".
261define should-install-to-system
The Android Open Source Project2f312932009-03-09 11:52:11 -0700262$(if $(filter samples tests,$(1)),,true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800263endef
264endif
265
266
267# If all they typed was make showcommands, we'll actually build
268# the default target.
269ifeq ($(MAKECMDGOALS),showcommands)
270.PHONY: showcommands
271showcommands: $(DEFAULT_GOAL)
272endif
273
274# These targets are going to delete stuff, don't bother including
275# the whole directory tree if that's all we're going to do
276ifeq ($(MAKECMDGOALS),clean)
277dont_bother := true
278endif
279ifeq ($(MAKECMDGOALS),clobber)
280dont_bother := true
281endif
282ifeq ($(MAKECMDGOALS),dataclean)
283dont_bother := true
284endif
285ifeq ($(MAKECMDGOALS),installclean)
286dont_bother := true
287endif
288
289# Bring in all modules that need to be built.
290ifneq ($(dont_bother),true)
291
292subdir_makefiles :=
293
294ifeq ($(HOST_OS),windows)
295SDK_ONLY := true
296endif
297ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
298SDK_ONLY := true
299endif
300
301ifeq ($(SDK_ONLY),true)
302
303subdirs := \
304 prebuilt \
305 build/libs/host \
306 dalvik/dexdump \
307 dalvik/libdex \
308 dalvik/tools/dmtracedump \
Raphael Molld9b64e12009-03-31 17:20:53 -0700309 dalvik/tools/hprof-conv \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800310 development/emulator/mksdcard \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800311 development/tools/line_endings \
312 development/host \
313 external/expat \
314 external/libpng \
315 external/qemu \
316 external/sqlite/dist \
317 external/zlib \
318 frameworks/base/libs/utils \
319 frameworks/base/tools/aapt \
320 frameworks/base/tools/aidl \
321 system/core/adb \
322 system/core/fastboot \
323 system/core/libcutils \
324 system/core/liblog \
325 system/core/libzipfile
326
327# The following can only be built if "javac" is available.
328# This check is used when building parts of the SDK under Cygwin.
329ifneq (,$(shell which javac 2>/dev/null))
330$(warning sdk-only: javac available.)
331subdirs += \
332 build/tools/signapk \
333 build/tools/zipalign \
334 dalvik/dx \
335 dalvik/libcore \
336 development/apps \
Raphaeld8a6ac12009-06-04 15:21:49 -0700337 development/tools/archquery \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800338 development/tools/androidprefs \
339 development/tools/apkbuilder \
340 development/tools/jarutils \
341 development/tools/layoutlib_utils \
342 development/tools/ninepatch \
343 development/tools/sdkstats \
344 development/tools/sdkmanager \
Raphael Molla779a052009-04-16 10:54:10 -0700345 development/tools/mkstubs \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800346 frameworks/base \
347 frameworks/base/tools/layoutlib \
348 external/googleclient \
349 packages
350else
351$(warning sdk-only: javac not available.)
352endif
353
354# Exclude tools/acp when cross-compiling windows under linux
355ifeq ($(findstring Linux,$(UNAME)),)
356subdirs += build/tools/acp
357endif
358
359else # !SDK_ONLY
360ifeq ($(BUILD_TINY_ANDROID), true)
361
362# TINY_ANDROID is a super-minimal build configuration, handy for board
363# bringup and very low level debugging
364
365INTERNAL_DEFAULT_DOCS_TARGETS :=
366
367subdirs := \
368 bionic \
369 system/core \
370 build/libs \
371 build/target \
372 build/tools/acp \
373 build/tools/apriori \
374 build/tools/kcm \
375 build/tools/soslim \
376 external/elfcopy \
377 external/elfutils \
378 external/yaffs2 \
379 external/zlib
380else # !BUILD_TINY_ANDROID
381
382#
383# Typical build; include any Android.mk files we can find.
384#
385INTERNAL_DEFAULT_DOCS_TARGETS := offline-sdk-docs
386subdirs := $(TOP)
387
388FULL_BUILD := true
389
390endif # !BUILD_TINY_ANDROID
391
392endif # !SDK_ONLY
393
394# Can't use first-makefiles-under here because
395# --mindepth=2 makes the prunes not work.
396subdir_makefiles += \
397 $(shell build/tools/findleaves.sh --prune="./out" $(subdirs) Android.mk)
398
399# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
400# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
401# make sure only one exists.
402# Real boards should always be associated with an OEM vendor.
403board_config_mk := \
404 $(strip $(wildcard \
405 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
406 vendor/*/$(TARGET_DEVICE)/BoardConfig.mk \
407 ))
408ifeq ($(board_config_mk),)
409 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
410endif
411ifneq ($(words $(board_config_mk)),1)
412 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
413endif
414include $(board_config_mk)
415TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
416board_config_mk :=
417
418# Clean up/verify variables defined by the board config file.
419TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
Dianne Hackbornecc70d72009-05-21 15:45:30 -0700420TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
421ifeq ($(TARGET_CPU_ABI),)
422 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk))
423endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800424
425#
426# Include all of the makefiles in the system
427#
428
429ifneq ($(ONE_SHOT_MAKEFILE),)
430# We've probably been invoked by the "mm" shell function
431# with a subdirectory's makefile.
432include $(ONE_SHOT_MAKEFILE)
433# Change CUSTOM_MODULES to include only modules that were
434# defined by this makefile; this will install all of those
435# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
436# so that the modules will be installed in the same place they
437# would have been with a normal make.
438CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS),))
439FULL_BUILD :=
440INTERNAL_DEFAULT_DOCS_TARGETS :=
441# Stub out the notice targets, which probably aren't defined
442# when using ONE_SHOT_MAKEFILE.
443NOTICE-HOST-%: ;
444NOTICE-TARGET-%: ;
445else
446include $(subdir_makefiles)
447endif
448# -------------------------------------------------------------------
449# All module makefiles have been included at this point.
450# -------------------------------------------------------------------
451
452# -------------------------------------------------------------------
453# Include any makefiles that must happen after the module makefiles
454# have been included.
455# TODO: have these files register themselves via a global var rather
456# than hard-coding the list here.
457ifdef FULL_BUILD
458 # Only include this during a full build, otherwise we can't be
459 # guaranteed that any policies were included.
460 -include frameworks/policies/base/PolicyConfig.mk
461endif
462
463# -------------------------------------------------------------------
464# Fix up CUSTOM_MODULES to refer to installed files rather than
465# just bare module names. Leave unknown modules alone in case
466# they're actually full paths to a particular file.
467known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
468unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
469CUSTOM_MODULES := \
470 $(call module-installed-files,$(known_custom_modules)) \
471 $(unknown_custom_modules)
472
473# -------------------------------------------------------------------
474# Define dependencies for modules that require other modules.
475# This can only happen now, after we've read in all module makefiles.
476#
477# TODO: deal with the fact that a bare module name isn't
478# unambiguous enough. Maybe declare short targets like
479# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
480# BUG: the system image won't know to depend on modules that are
481# brought in as requirements of other modules.
482define add-required-deps
483$(1): $(2)
484endef
485$(foreach m,$(ALL_MODULES), \
486 $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
487 $(if $(r), \
488 $(eval r := $(call module-installed-files,$(r))) \
489 $(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
490 ) \
491 )
492m :=
493r :=
494add-required-deps :=
495
496# -------------------------------------------------------------------
497# Figure out our module sets.
498
499# Of the modules defined by the component makefiles,
500# determine what we actually want to build.
501# If a module has the "restricted" tag on it, it
502# poisons the rest of the tags and shouldn't appear
503# on any list.
504Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
505 $(ALL_BUILT_MODULES) \
506 $(CUSTOM_MODULES))
The Android Open Source Project2f312932009-03-09 11:52:11 -0700507# TODO: Remove the 3 places in the tree that use
508# ALL_DEFAULT_INSTALLED_MODULES and get rid of it from this list.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800509
510ifdef FULL_BUILD
511 # The base list of modules to build for this product is specified
512 # by the appropriate product definition file, which was included
513 # by product_config.make.
514 user_PACKAGES := $(call module-installed-files, \
515 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
516 ifeq (0,1)
517 $(info user packages for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
518 $(foreach p,$(user_PACKAGES),$(info : $(p)))
519 $(error done)
520 endif
521else
522 # We're not doing a full build, and are probably only including
523 # a subset of the module makefiles. Don't try to build any modules
524 # requested by the product, because we probably won't have rules
525 # to build them.
526 user_PACKAGES :=
527endif
528# Use tags to get the non-APPS user modules. Use the product
529# definition files to get the APPS user modules.
530user_MODULES := $(sort $(call get-tagged-modules,user,_class@APPS restricted))
531user_MODULES := $(user_MODULES) $(user_PACKAGES)
532
533eng_MODULES := $(sort $(call get-tagged-modules,eng,restricted))
534debug_MODULES := $(sort $(call get-tagged-modules,debug,restricted))
535tests_MODULES := $(sort $(call get-tagged-modules,tests,restricted))
536
The Android Open Source Project2f312932009-03-09 11:52:11 -0700537ifeq ($(strip $(tags_to_install)),)
538$(error ASSERTION FAILED: tags_to_install should not be empty)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800539endif
The Android Open Source Project2f312932009-03-09 11:52:11 -0700540modules_to_install := $(sort $(Default_MODULES) \
541 $(foreach tag,$(tags_to_install),$($(tag)_MODULES)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800542
543# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
544# Filter out (do not install) any overridden packages.
The Android Open Source Project2f312932009-03-09 11:52:11 -0700545overridden_packages := $(call get-package-overrides,$(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800546ifdef overridden_packages
The Android Open Source Project2f312932009-03-09 11:52:11 -0700547# old_modules_to_install := $(modules_to_install)
548 modules_to_install := \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800549 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
The Android Open Source Project2f312932009-03-09 11:52:11 -0700550 $(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800551endif
The Android Open Source Project2f312932009-03-09 11:52:11 -0700552#$(error filtered out
553# $(filter-out $(modules_to_install),$(old_modules_to_install)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800554
555# Don't include any GNU targets in the SDK. It's ok (and necessary)
556# to build the host tools, but nothing that's going to be installed
557# on the target (including static libraries).
Joe Onoratoeb19b3e2009-04-13 16:32:16 -0700558ifdef is_sdk_build
The Android Open Source Project88b60792009-03-03 19:28:42 -0800559 target_gnu_MODULES := \
560 $(filter \
561 $(TARGET_OUT_INTERMEDIATES)/% \
562 $(TARGET_OUT)/% \
563 $(TARGET_OUT_DATA)/%, \
564 $(sort $(call get-tagged-modules,gnu)))
565 $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
The Android Open Source Project2f312932009-03-09 11:52:11 -0700566 modules_to_install := \
567 $(filter-out $(target_gnu_MODULES),$(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800568endif
569
570
571# config/Makefile contains extra stuff that we don't want to pollute this
572# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
573# contains everything that's built during the current make, but it also further
574# extends ALL_DEFAULT_INSTALLED_MODULES.
The Android Open Source Project2f312932009-03-09 11:52:11 -0700575ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800576include $(BUILD_SYSTEM)/Makefile
The Android Open Source Project2f312932009-03-09 11:52:11 -0700577modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800578ALL_DEFAULT_INSTALLED_MODULES :=
579
580endif # dont_bother
581
582# -------------------------------------------------------------------
583# This is used to to get the ordering right, you can also use these,
584# but they're considered undocumented, so don't complain if their
585# behavior changes.
586.PHONY: prebuilt
587prebuilt: $(ALL_PREBUILT)
588
589# An internal target that depends on all copied headers
590# (see copy_headers.make). Other targets that need the
591# headers to be copied first can depend on this target.
592.PHONY: all_copied_headers
593all_copied_headers: ;
594
595$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
596
597# All the droid stuff, in directories
598.PHONY: files
The Android Open Source Project2f312932009-03-09 11:52:11 -0700599files: prebuilt $(modules_to_install) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800600
601# -------------------------------------------------------------------
602
603.PHONY: ramdisk
604ramdisk: $(INSTALLED_RAMDISK_TARGET)
605
606.PHONY: systemtarball
607systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
608
609.PHONY: userdataimage
610userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
611
612.PHONY: userdatatarball
613userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
614
615.PHONY: bootimage
616bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
617
618ifeq ($(BUILD_TINY_ANDROID), true)
619INSTALLED_RECOVERYIMAGE_TARGET :=
620endif
621
622# Build files and then package it into the rom formats
623.PHONY: droidcore
624droidcore: files \
625 systemimage \
626 $(INSTALLED_BOOTIMAGE_TARGET) \
627 $(INSTALLED_RECOVERYIMAGE_TARGET) \
628 $(INSTALLED_USERDATAIMAGE_TARGET) \
629 $(INTERNAL_DEFAULT_DOCS_TARGETS) \
630 $(INSTALLED_FILES_FILE)
631
632# The actual files built by the droidcore target changes depending
633# on the build variant.
634.PHONY: droid tests
635droid tests: droidcore
636
637$(call dist-for-goals, droid, \
638 $(INTERNAL_UPDATE_PACKAGE_TARGET) \
639 $(INTERNAL_OTA_PACKAGE_TARGET) \
640 $(SYMBOLS_ZIP) \
641 $(APPS_ZIP) \
642 $(INTERNAL_EMULATOR_PACKAGE_TARGET) \
643 $(PACKAGE_STATS_FILE) \
644 $(INSTALLED_FILES_FILE) \
645 $(INSTALLED_BUILD_PROP_TARGET) \
646 $(BUILT_TARGET_FILES_PACKAGE) \
647 )
648
649# Tests are installed in userdata.img. If we're building the tests
650# variant, copy it for "make tests dist". Also copy a zip of the
651# contents of userdata.img, so that people can easily extract a
652# single .apk.
653ifeq ($(TARGET_BUILD_VARIANT),tests)
654$(call dist-for-goals, droid, \
655 $(INSTALLED_USERDATAIMAGE_TARGET) \
656 $(BUILT_TESTS_ZIP_PACKAGE) \
657 )
658endif
659
660.PHONY: docs
661docs: $(ALL_DOCS)
662
663.PHONY: sdk
664ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
665sdk: $(ALL_SDK_TARGETS)
666$(call dist-for-goals,sdk,$(ALL_SDK_TARGETS))
667
668.PHONY: findbugs
669findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
670
671.PHONY: clean
672dirs_to_clean := \
673 $(PRODUCT_OUT) \
674 $(TARGET_COMMON_OUT_ROOT) \
675 $(HOST_OUT) \
676 $(HOST_COMMON_OUT_ROOT)
677clean:
678 @for dir in $(dirs_to_clean) ; do \
679 echo "Cleaning $$dir..."; \
680 rm -rf $$dir; \
681 done
682 @echo "Clean."; \
683
684.PHONY: clobber
685clobber:
686 @rm -rf $(OUT_DIR)
687 @echo "Entire build directory removed."
688
689# The rules for dataclean and installclean are defined in cleanbuild.mk.
690
691#xxx scrape this from ALL_MODULE_NAME_TAGS
692.PHONY: modules
693modules:
694 @echo "Available sub-modules:"
695 @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
696 sed -e 's/ */\n/g' | sort -u | $(COLUMN)
697
698.PHONY: showcommands
699showcommands:
700 @echo >/dev/null
701