blob: bee8c7b00bebb2b1921bf247d9f0e7b7e46cb733 [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 Onorato03fbe402009-04-13 08:31: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 Onorato03fbe402009-04-13 08:31: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 Ducrohet6a769422009-04-06 20:30:02 -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
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700210# Install an apns-conf.xml file if one's not already being installed.
211ifeq (,$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES)))
212 PRODUCT_COPY_FILES += \
213 development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
214 ifeq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800215 $(warning implicitly installing apns-conf_sdk.xml)
216 endif
217endif
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700218# If we're on an eng or tests build, but not on the sdk, and we have
219# a better one, use that instead.
220ifneq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
Joe Onorato03fbe402009-04-13 08:31:16 -0700221 ifdef is_sdk_build
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700222 apns_to_use := $(wildcard vendor/google/etc/apns-conf.xml)
223 ifneq ($(strip $(apns_to_use)),)
224 PRODUCT_COPY_FILES := \
225 $(filter-out %:system/etc/apns-conf.xml,$(PRODUCT_COPY_FILES)) \
226 $(strip $(apns_to_use)):system/etc/apns-conf.xml
227 endif
228 endif
229endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800230
231ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
232
233# enable vm tracing in files for now to help track
234# the cause of ANRs in the content process
235ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
236
237
238# ------------------------------------------------------------
239# Define a function that, given a list of module tags, returns
240# non-empty if that module should be installed in /system.
241
The Android Open Source Project2f312932009-03-09 11:52:11 -0700242# For most goals, anything not tagged with the "tests" tag should
The Android Open Source Project88b60792009-03-03 19:28:42 -0800243# be installed in /system.
244define should-install-to-system
The Android Open Source Project2f312932009-03-09 11:52:11 -0700245$(if $(filter tests,$(1)),,true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800246endef
247
Joe Onorato03fbe402009-04-13 08:31:16 -0700248ifdef is_sdk_build
The Android Open Source Project88b60792009-03-03 19:28:42 -0800249# For the sdk goal, anything with the "samples" tag should be
250# installed in /data even if that module also has "eng"/"debug"/"user".
251define should-install-to-system
The Android Open Source Project2f312932009-03-09 11:52:11 -0700252$(if $(filter samples tests,$(1)),,true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800253endef
254endif
255
256
257# If all they typed was make showcommands, we'll actually build
258# the default target.
259ifeq ($(MAKECMDGOALS),showcommands)
260.PHONY: showcommands
261showcommands: $(DEFAULT_GOAL)
262endif
263
264# These targets are going to delete stuff, don't bother including
265# the whole directory tree if that's all we're going to do
266ifeq ($(MAKECMDGOALS),clean)
267dont_bother := true
268endif
269ifeq ($(MAKECMDGOALS),clobber)
270dont_bother := true
271endif
272ifeq ($(MAKECMDGOALS),dataclean)
273dont_bother := true
274endif
275ifeq ($(MAKECMDGOALS),installclean)
276dont_bother := true
277endif
278
279# Bring in all modules that need to be built.
280ifneq ($(dont_bother),true)
281
282subdir_makefiles :=
283
284ifeq ($(HOST_OS),windows)
285SDK_ONLY := true
286endif
287ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
288SDK_ONLY := true
289endif
290
291ifeq ($(SDK_ONLY),true)
292
293subdirs := \
294 prebuilt \
295 build/libs/host \
296 dalvik/dexdump \
297 dalvik/libdex \
298 dalvik/tools/dmtracedump \
Raphael Molla401b052009-03-31 17:19:14 -0700299 dalvik/tools/hprof-conv \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800300 development/emulator/mksdcard \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800301 development/tools/line_endings \
302 development/host \
303 external/expat \
304 external/libpng \
305 external/qemu \
306 external/sqlite/dist \
307 external/zlib \
308 frameworks/base/libs/utils \
309 frameworks/base/tools/aapt \
310 frameworks/base/tools/aidl \
311 system/core/adb \
312 system/core/fastboot \
313 system/core/libcutils \
314 system/core/liblog \
315 system/core/libzipfile
316
317# The following can only be built if "javac" is available.
318# This check is used when building parts of the SDK under Cygwin.
319ifneq (,$(shell which javac 2>/dev/null))
320$(warning sdk-only: javac available.)
321subdirs += \
322 build/tools/signapk \
323 build/tools/zipalign \
324 dalvik/dx \
325 dalvik/libcore \
326 development/apps \
Raphaeld8a6ac12009-06-04 15:21:49 -0700327 development/tools/archquery \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800328 development/tools/androidprefs \
329 development/tools/apkbuilder \
330 development/tools/jarutils \
331 development/tools/layoutlib_utils \
332 development/tools/ninepatch \
333 development/tools/sdkstats \
334 development/tools/sdkmanager \
Raphael Molla190c522009-04-13 18:21:16 -0700335 development/tools/mkstubs \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800336 frameworks/base \
337 frameworks/base/tools/layoutlib \
338 external/googleclient \
339 packages
340else
341$(warning sdk-only: javac not available.)
342endif
343
344# Exclude tools/acp when cross-compiling windows under linux
345ifeq ($(findstring Linux,$(UNAME)),)
346subdirs += build/tools/acp
347endif
348
349else # !SDK_ONLY
350ifeq ($(BUILD_TINY_ANDROID), true)
351
352# TINY_ANDROID is a super-minimal build configuration, handy for board
353# bringup and very low level debugging
354
355INTERNAL_DEFAULT_DOCS_TARGETS :=
356
357subdirs := \
358 bionic \
359 system/core \
360 build/libs \
361 build/target \
362 build/tools/acp \
363 build/tools/apriori \
364 build/tools/kcm \
365 build/tools/soslim \
366 external/elfcopy \
367 external/elfutils \
368 external/yaffs2 \
369 external/zlib
370else # !BUILD_TINY_ANDROID
371
372#
373# Typical build; include any Android.mk files we can find.
374#
375INTERNAL_DEFAULT_DOCS_TARGETS := offline-sdk-docs
376subdirs := $(TOP)
377
378FULL_BUILD := true
379
380endif # !BUILD_TINY_ANDROID
381
382endif # !SDK_ONLY
383
384# Can't use first-makefiles-under here because
385# --mindepth=2 makes the prunes not work.
386subdir_makefiles += \
387 $(shell build/tools/findleaves.sh --prune="./out" $(subdirs) Android.mk)
388
389# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
390# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
391# make sure only one exists.
392# Real boards should always be associated with an OEM vendor.
393board_config_mk := \
394 $(strip $(wildcard \
395 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
396 vendor/*/$(TARGET_DEVICE)/BoardConfig.mk \
397 ))
398ifeq ($(board_config_mk),)
399 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
400endif
401ifneq ($(words $(board_config_mk)),1)
402 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
403endif
404include $(board_config_mk)
405TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
406board_config_mk :=
407
408# Clean up/verify variables defined by the board config file.
409TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
Dianne Hackbornecc70d72009-05-21 15:45:30 -0700410TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
411ifeq ($(TARGET_CPU_ABI),)
412 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk))
413endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800414
415#
416# Include all of the makefiles in the system
417#
418
419ifneq ($(ONE_SHOT_MAKEFILE),)
420# We've probably been invoked by the "mm" shell function
421# with a subdirectory's makefile.
422include $(ONE_SHOT_MAKEFILE)
423# Change CUSTOM_MODULES to include only modules that were
424# defined by this makefile; this will install all of those
425# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
426# so that the modules will be installed in the same place they
427# would have been with a normal make.
428CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS),))
429FULL_BUILD :=
430INTERNAL_DEFAULT_DOCS_TARGETS :=
431# Stub out the notice targets, which probably aren't defined
432# when using ONE_SHOT_MAKEFILE.
433NOTICE-HOST-%: ;
434NOTICE-TARGET-%: ;
435else
436include $(subdir_makefiles)
437endif
438# -------------------------------------------------------------------
439# All module makefiles have been included at this point.
440# -------------------------------------------------------------------
441
442# -------------------------------------------------------------------
443# Include any makefiles that must happen after the module makefiles
444# have been included.
445# TODO: have these files register themselves via a global var rather
446# than hard-coding the list here.
447ifdef FULL_BUILD
448 # Only include this during a full build, otherwise we can't be
449 # guaranteed that any policies were included.
450 -include frameworks/policies/base/PolicyConfig.mk
451endif
452
453# -------------------------------------------------------------------
454# Fix up CUSTOM_MODULES to refer to installed files rather than
455# just bare module names. Leave unknown modules alone in case
456# they're actually full paths to a particular file.
457known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
458unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
459CUSTOM_MODULES := \
460 $(call module-installed-files,$(known_custom_modules)) \
461 $(unknown_custom_modules)
462
463# -------------------------------------------------------------------
464# Define dependencies for modules that require other modules.
465# This can only happen now, after we've read in all module makefiles.
466#
467# TODO: deal with the fact that a bare module name isn't
468# unambiguous enough. Maybe declare short targets like
469# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
470# BUG: the system image won't know to depend on modules that are
471# brought in as requirements of other modules.
472define add-required-deps
473$(1): $(2)
474endef
475$(foreach m,$(ALL_MODULES), \
476 $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
477 $(if $(r), \
478 $(eval r := $(call module-installed-files,$(r))) \
479 $(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
480 ) \
481 )
482m :=
483r :=
484add-required-deps :=
485
486# -------------------------------------------------------------------
487# Figure out our module sets.
488
489# Of the modules defined by the component makefiles,
490# determine what we actually want to build.
491# If a module has the "restricted" tag on it, it
492# poisons the rest of the tags and shouldn't appear
493# on any list.
494Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
495 $(ALL_BUILT_MODULES) \
496 $(CUSTOM_MODULES))
The Android Open Source Project2f312932009-03-09 11:52:11 -0700497# TODO: Remove the 3 places in the tree that use
498# ALL_DEFAULT_INSTALLED_MODULES and get rid of it from this list.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800499
500ifdef FULL_BUILD
501 # The base list of modules to build for this product is specified
502 # by the appropriate product definition file, which was included
503 # by product_config.make.
504 user_PACKAGES := $(call module-installed-files, \
505 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
506 ifeq (0,1)
507 $(info user packages for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
508 $(foreach p,$(user_PACKAGES),$(info : $(p)))
509 $(error done)
510 endif
511else
512 # We're not doing a full build, and are probably only including
513 # a subset of the module makefiles. Don't try to build any modules
514 # requested by the product, because we probably won't have rules
515 # to build them.
516 user_PACKAGES :=
517endif
518# Use tags to get the non-APPS user modules. Use the product
519# definition files to get the APPS user modules.
520user_MODULES := $(sort $(call get-tagged-modules,user,_class@APPS restricted))
521user_MODULES := $(user_MODULES) $(user_PACKAGES)
522
523eng_MODULES := $(sort $(call get-tagged-modules,eng,restricted))
524debug_MODULES := $(sort $(call get-tagged-modules,debug,restricted))
525tests_MODULES := $(sort $(call get-tagged-modules,tests,restricted))
526
The Android Open Source Project2f312932009-03-09 11:52:11 -0700527ifeq ($(strip $(tags_to_install)),)
528$(error ASSERTION FAILED: tags_to_install should not be empty)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800529endif
The Android Open Source Project2f312932009-03-09 11:52:11 -0700530modules_to_install := $(sort $(Default_MODULES) \
531 $(foreach tag,$(tags_to_install),$($(tag)_MODULES)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800532
533# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
534# Filter out (do not install) any overridden packages.
The Android Open Source Project2f312932009-03-09 11:52:11 -0700535overridden_packages := $(call get-package-overrides,$(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800536ifdef overridden_packages
The Android Open Source Project2f312932009-03-09 11:52:11 -0700537# old_modules_to_install := $(modules_to_install)
538 modules_to_install := \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800539 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
The Android Open Source Project2f312932009-03-09 11:52:11 -0700540 $(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800541endif
The Android Open Source Project2f312932009-03-09 11:52:11 -0700542#$(error filtered out
543# $(filter-out $(modules_to_install),$(old_modules_to_install)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800544
545# Don't include any GNU targets in the SDK. It's ok (and necessary)
546# to build the host tools, but nothing that's going to be installed
547# on the target (including static libraries).
Joe Onorato03fbe402009-04-13 08:31:16 -0700548ifdef is_sdk_build
The Android Open Source Project88b60792009-03-03 19:28:42 -0800549 target_gnu_MODULES := \
550 $(filter \
551 $(TARGET_OUT_INTERMEDIATES)/% \
552 $(TARGET_OUT)/% \
553 $(TARGET_OUT_DATA)/%, \
554 $(sort $(call get-tagged-modules,gnu)))
555 $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
The Android Open Source Project2f312932009-03-09 11:52:11 -0700556 modules_to_install := \
557 $(filter-out $(target_gnu_MODULES),$(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800558endif
559
560
561# config/Makefile contains extra stuff that we don't want to pollute this
562# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
563# contains everything that's built during the current make, but it also further
564# extends ALL_DEFAULT_INSTALLED_MODULES.
The Android Open Source Project2f312932009-03-09 11:52:11 -0700565ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800566include $(BUILD_SYSTEM)/Makefile
The Android Open Source Project2f312932009-03-09 11:52:11 -0700567modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800568ALL_DEFAULT_INSTALLED_MODULES :=
569
570endif # dont_bother
571
572# -------------------------------------------------------------------
573# This is used to to get the ordering right, you can also use these,
574# but they're considered undocumented, so don't complain if their
575# behavior changes.
576.PHONY: prebuilt
577prebuilt: $(ALL_PREBUILT)
578
579# An internal target that depends on all copied headers
580# (see copy_headers.make). Other targets that need the
581# headers to be copied first can depend on this target.
582.PHONY: all_copied_headers
583all_copied_headers: ;
584
585$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
586
587# All the droid stuff, in directories
588.PHONY: files
The Android Open Source Project2f312932009-03-09 11:52:11 -0700589files: prebuilt $(modules_to_install) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800590
591# -------------------------------------------------------------------
592
593.PHONY: ramdisk
594ramdisk: $(INSTALLED_RAMDISK_TARGET)
595
596.PHONY: systemtarball
597systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
598
599.PHONY: userdataimage
600userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
601
602.PHONY: userdatatarball
603userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
604
605.PHONY: bootimage
606bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
607
608ifeq ($(BUILD_TINY_ANDROID), true)
609INSTALLED_RECOVERYIMAGE_TARGET :=
610endif
611
612# Build files and then package it into the rom formats
613.PHONY: droidcore
614droidcore: files \
615 systemimage \
616 $(INSTALLED_BOOTIMAGE_TARGET) \
617 $(INSTALLED_RECOVERYIMAGE_TARGET) \
618 $(INSTALLED_USERDATAIMAGE_TARGET) \
619 $(INTERNAL_DEFAULT_DOCS_TARGETS) \
620 $(INSTALLED_FILES_FILE)
621
622# The actual files built by the droidcore target changes depending
623# on the build variant.
624.PHONY: droid tests
625droid tests: droidcore
626
627$(call dist-for-goals, droid, \
628 $(INTERNAL_UPDATE_PACKAGE_TARGET) \
629 $(INTERNAL_OTA_PACKAGE_TARGET) \
630 $(SYMBOLS_ZIP) \
631 $(APPS_ZIP) \
632 $(INTERNAL_EMULATOR_PACKAGE_TARGET) \
633 $(PACKAGE_STATS_FILE) \
634 $(INSTALLED_FILES_FILE) \
635 $(INSTALLED_BUILD_PROP_TARGET) \
636 $(BUILT_TARGET_FILES_PACKAGE) \
637 )
638
639# Tests are installed in userdata.img. If we're building the tests
640# variant, copy it for "make tests dist". Also copy a zip of the
641# contents of userdata.img, so that people can easily extract a
642# single .apk.
643ifeq ($(TARGET_BUILD_VARIANT),tests)
644$(call dist-for-goals, droid, \
645 $(INSTALLED_USERDATAIMAGE_TARGET) \
646 $(BUILT_TESTS_ZIP_PACKAGE) \
647 )
648endif
649
650.PHONY: docs
651docs: $(ALL_DOCS)
652
653.PHONY: sdk
654ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
655sdk: $(ALL_SDK_TARGETS)
656$(call dist-for-goals,sdk,$(ALL_SDK_TARGETS))
657
658.PHONY: findbugs
659findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
660
661.PHONY: clean
662dirs_to_clean := \
663 $(PRODUCT_OUT) \
664 $(TARGET_COMMON_OUT_ROOT) \
665 $(HOST_OUT) \
666 $(HOST_COMMON_OUT_ROOT)
667clean:
668 @for dir in $(dirs_to_clean) ; do \
669 echo "Cleaning $$dir..."; \
670 rm -rf $$dir; \
671 done
672 @echo "Clean."; \
673
674.PHONY: clobber
675clobber:
676 @rm -rf $(OUT_DIR)
677 @echo "Entire build directory removed."
678
679# The rules for dataclean and installclean are defined in cleanbuild.mk.
680
681#xxx scrape this from ALL_MODULE_NAME_TAGS
682.PHONY: modules
683modules:
684 @echo "Available sub-modules:"
685 @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
686 sed -e 's/ */\n/g' | sort -u | $(COLUMN)
687
688.PHONY: showcommands
689showcommands:
690 @echo >/dev/null
691