blob: c3f1e2face7aa47563e85bb673945eea1d6e1d6f [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
Joe Onorato9d9f3672009-06-22 18:15:38 -070088
89# The windows build server currently uses 1.6. This will be fixed.
90ifneq ($(HOST_OS),windows)
91
92# Check for the correct version of java
93java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
94ifeq ($(strip $(java_version)),)
95$(info ************************************************************)
96$(info You are attempting to build with the incorrect version)
97$(info of java.)
98$(info $(space))
99$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
100$(info The correct version is: 1.5.)
101$(info $(space))
102$(info Please follow the machine setup instructions at)
103$(info $(space)$(space)$(space)$(space)http://source.android.com/download)
104$(info ************************************************************)
105$(error stop)
106endif
107
108# Check for the correct version of javac
109javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
110ifeq ($(strip $(javac_version)),)
111$(info ************************************************************)
112$(info You are attempting to build with the incorrect version)
113$(info of javac.)
114$(info $(space))
115$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
116$(info The correct version is: 1.5.)
117$(info $(space))
118$(info Please follow the machine setup instructions at)
119$(info $(space)$(space)$(space)$(space)http://source.android.com/download)
120$(info ************************************************************)
121$(error stop)
122endif
123
124endif # windows
125
The Android Open Source Project88b60792009-03-03 19:28:42 -0800126# These are the modifier targets that don't do anything themselves, but
127# change the behavior of the build.
128# (must be defined before including definitions.make)
Joe Onoratoe334d252009-07-17 15:33:40 -0400129INTERNAL_MODIFIER_TARGETS := showcommands checkbuild
The Android Open Source Project88b60792009-03-03 19:28:42 -0800130
131# Bring in standard build system definitions.
132include $(BUILD_SYSTEM)/definitions.mk
133
134ifneq ($(filter eng user userdebug tests,$(MAKECMDGOALS)),)
135$(info ***************************************************************)
136$(info ***************************************************************)
137$(info Don't pass '$(filter eng user userdebug tests,$(MAKECMDGOALS))' on \
138 the make command line.)
The Android Open Source Project2f312932009-03-09 11:52:11 -0700139# XXX The single quote on this line fixes gvim's syntax highlighting.
140# Without which, the rest of this file is impossible to read.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800141$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or)
142$(info choosecombo.)
143$(info ***************************************************************)
144$(info ***************************************************************)
145$(error stopping)
146endif
147
The Android Open Source Project2f312932009-03-09 11:52:11 -0700148ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),)
149$(info ***************************************************************)
150$(info ***************************************************************)
151$(info Invalid variant: $(TARGET_BUILD_VARIANT)
152$(info Valid values are: $(INTERNAL_VALID_VARIANTS)
153$(info ***************************************************************)
154$(info ***************************************************************)
155$(error stopping)
156endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800157
158###
159### In this section we set up the things that are different
160### between the build variants
161###
162
Joe Onoratoeb19b3e2009-04-13 16:32:16 -0700163is_sdk_build :=
164ifneq ($(filter sdk,$(MAKECMDGOALS)),)
165is_sdk_build := true
166endif
167ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
168is_sdk_build := true
169endif
170
171
The Android Open Source Project88b60792009-03-03 19:28:42 -0800172## user/userdebug ##
173
174user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
175enable_target_debugging := true
176ifneq (,$(user_variant))
177 # Target is secure in user builds.
178 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
179
The Android Open Source Project2f312932009-03-09 11:52:11 -0700180 tags_to_install := user
The Android Open Source Project88b60792009-03-03 19:28:42 -0800181 ifeq ($(user_variant),userdebug)
182 # Pick up some extra useful tools
The Android Open Source Project2f312932009-03-09 11:52:11 -0700183 tags_to_install += debug
The Android Open Source Project88b60792009-03-03 19:28:42 -0800184 else
185 # Disable debugging in plain user builds.
186 enable_target_debugging :=
187 endif
188
189 # TODO: Always set WITH_DEXPREOPT (for user builds) once it works on OSX.
190 # Also, remove the corresponding block in config/product_config.make.
191 ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
192 WITH_DEXPREOPT := true
193 endif
194
195 # Disallow mock locations by default for user builds
196 ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0
197
198else # !user_variant
199 # Turn on checkjni for non-user builds.
200 ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
201 # Set device insecure for non-user builds.
202 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
203 # Allow mock locations by default for non user builds
204 ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1
205endif # !user_variant
206
207ifeq (true,$(strip $(enable_target_debugging)))
208 # Target is more debuggable and adbd is on by default
209 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1
210 # Include the debugging/testing OTA keys in this build.
211 INCLUDE_TEST_OTA_KEYS := true
212else # !enable_target_debugging
213 # Target is less debuggable and adbd is off by default
214 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 persist.service.adb.enable=0
215endif # !enable_target_debugging
216
The Android Open Source Project2f312932009-03-09 11:52:11 -0700217## eng ##
218
219ifeq ($(TARGET_BUILD_VARIANT),eng)
220tags_to_install := user debug eng
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700221 # Don't require the setup wizard on eng builds
222 ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
223 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES)))
The Android Open Source Project2f312932009-03-09 11:52:11 -0700224endif
225
The Android Open Source Project88b60792009-03-03 19:28:42 -0800226## tests ##
227
228ifeq ($(TARGET_BUILD_VARIANT),tests)
The Android Open Source Project2f312932009-03-09 11:52:11 -0700229tags_to_install := user debug eng tests
The Android Open Source Project88b60792009-03-03 19:28:42 -0800230endif
231
232## sdk ##
233
Joe Onoratoeb19b3e2009-04-13 16:32:16 -0700234ifdef is_sdk_build
The Android Open Source Project88b60792009-03-03 19:28:42 -0800235ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1)
236$(error The 'sdk' target may not be specified with any other targets)
237endif
The Android Open Source Project2f312932009-03-09 11:52:11 -0700238# TODO: this should be eng I think. Since the sdk is built from the eng
239# variant.
Xavier Ducrohetf3e79f92009-04-06 20:32:24 -0700240tags_to_install := user debug eng
The Android Open Source Project88b60792009-03-03 19:28:42 -0800241ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
242ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
243else # !sdk
244# Enable sync for non-sdk builds only (sdk builds lack SubscribedFeedsProvider).
245ADDITIONAL_BUILD_PROPERTIES += ro.config.sync=yes
246endif
247
Andy McFadden743e2502009-04-13 14:48:35 -0700248## precise GC ##
249
250ifneq ($(filter dalvik.gc.type-precise,$(PRODUCT_TAGS)),)
251 # Enabling type-precise GC results in larger optimized DEX files. The
252 # additional storage requirements for ".odex" files can cause /system
253 # to overflow on some devices, so this is configured separately for
254 # each product.
255 ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dexopt-flags=m=y
256endif
257
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700258# Install an apns-conf.xml file if one's not already being installed.
259ifeq (,$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES)))
260 PRODUCT_COPY_FILES += \
261 development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
262 ifeq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800263 $(warning implicitly installing apns-conf_sdk.xml)
264 endif
265endif
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700266# If we're on an eng or tests build, but not on the sdk, and we have
267# a better one, use that instead.
268ifneq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
Patrick Scott1f04a3b2009-06-09 10:34:45 -0400269 ifndef is_sdk_build
The Android Open Source Project6bce2052009-03-13 13:04:19 -0700270 apns_to_use := $(wildcard vendor/google/etc/apns-conf.xml)
271 ifneq ($(strip $(apns_to_use)),)
272 PRODUCT_COPY_FILES := \
273 $(filter-out %:system/etc/apns-conf.xml,$(PRODUCT_COPY_FILES)) \
274 $(strip $(apns_to_use)):system/etc/apns-conf.xml
275 endif
276 endif
277endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800278
279ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
280
281# enable vm tracing in files for now to help track
282# the cause of ANRs in the content process
283ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
284
285
286# ------------------------------------------------------------
287# Define a function that, given a list of module tags, returns
288# non-empty if that module should be installed in /system.
289
The Android Open Source Project2f312932009-03-09 11:52:11 -0700290# For most goals, anything not tagged with the "tests" tag should
The Android Open Source Project88b60792009-03-03 19:28:42 -0800291# be installed in /system.
292define should-install-to-system
The Android Open Source Project2f312932009-03-09 11:52:11 -0700293$(if $(filter tests,$(1)),,true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800294endef
295
Joe Onoratoeb19b3e2009-04-13 16:32:16 -0700296ifdef is_sdk_build
The Android Open Source Project88b60792009-03-03 19:28:42 -0800297# For the sdk goal, anything with the "samples" tag should be
298# installed in /data even if that module also has "eng"/"debug"/"user".
299define should-install-to-system
The Android Open Source Project2f312932009-03-09 11:52:11 -0700300$(if $(filter samples tests,$(1)),,true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800301endef
302endif
303
304
Joe Onoratoe334d252009-07-17 15:33:40 -0400305# If they only used the modifier goals (showcommands, checkbuild), we'll actually
306# build the default target.
307ifeq ($(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS)),)
308.PHONY: $(INTERNAL_MODIFIER_TARGETS)
309$(INTERNAL_MODIFIER_TARGETS): $(DEFAULT_GOAL)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800310endif
311
312# These targets are going to delete stuff, don't bother including
313# the whole directory tree if that's all we're going to do
314ifeq ($(MAKECMDGOALS),clean)
315dont_bother := true
316endif
317ifeq ($(MAKECMDGOALS),clobber)
318dont_bother := true
319endif
320ifeq ($(MAKECMDGOALS),dataclean)
321dont_bother := true
322endif
323ifeq ($(MAKECMDGOALS),installclean)
324dont_bother := true
325endif
326
327# Bring in all modules that need to be built.
328ifneq ($(dont_bother),true)
329
The Android Open Source Project88b60792009-03-03 19:28:42 -0800330ifeq ($(HOST_OS),windows)
331SDK_ONLY := true
332endif
333ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
334SDK_ONLY := true
335endif
336
337ifeq ($(SDK_ONLY),true)
338
339subdirs := \
340 prebuilt \
341 build/libs/host \
342 dalvik/dexdump \
343 dalvik/libdex \
344 dalvik/tools/dmtracedump \
Raphael Molld9b64e12009-03-31 17:20:53 -0700345 dalvik/tools/hprof-conv \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800346 development/emulator/mksdcard \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800347 development/tools/line_endings \
348 development/host \
349 external/expat \
350 external/libpng \
351 external/qemu \
352 external/sqlite/dist \
353 external/zlib \
354 frameworks/base/libs/utils \
355 frameworks/base/tools/aapt \
356 frameworks/base/tools/aidl \
357 system/core/adb \
358 system/core/fastboot \
359 system/core/libcutils \
360 system/core/liblog \
361 system/core/libzipfile
362
363# The following can only be built if "javac" is available.
364# This check is used when building parts of the SDK under Cygwin.
365ifneq (,$(shell which javac 2>/dev/null))
366$(warning sdk-only: javac available.)
367subdirs += \
368 build/tools/signapk \
369 build/tools/zipalign \
370 dalvik/dx \
371 dalvik/libcore \
372 development/apps \
Raphaeld8a6ac12009-06-04 15:21:49 -0700373 development/tools/archquery \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800374 development/tools/androidprefs \
375 development/tools/apkbuilder \
376 development/tools/jarutils \
377 development/tools/layoutlib_utils \
378 development/tools/ninepatch \
379 development/tools/sdkstats \
380 development/tools/sdkmanager \
Raphael Molla779a052009-04-16 10:54:10 -0700381 development/tools/mkstubs \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800382 frameworks/base \
383 frameworks/base/tools/layoutlib \
384 external/googleclient \
385 packages
386else
387$(warning sdk-only: javac not available.)
388endif
389
390# Exclude tools/acp when cross-compiling windows under linux
391ifeq ($(findstring Linux,$(UNAME)),)
392subdirs += build/tools/acp
393endif
394
395else # !SDK_ONLY
396ifeq ($(BUILD_TINY_ANDROID), true)
397
398# TINY_ANDROID is a super-minimal build configuration, handy for board
399# bringup and very low level debugging
400
The Android Open Source Project88b60792009-03-03 19:28:42 -0800401subdirs := \
402 bionic \
403 system/core \
404 build/libs \
405 build/target \
406 build/tools/acp \
407 build/tools/apriori \
408 build/tools/kcm \
409 build/tools/soslim \
410 external/elfcopy \
411 external/elfutils \
412 external/yaffs2 \
413 external/zlib
414else # !BUILD_TINY_ANDROID
415
416#
417# Typical build; include any Android.mk files we can find.
418#
The Android Open Source Project88b60792009-03-03 19:28:42 -0800419subdirs := $(TOP)
420
421FULL_BUILD := true
422
423endif # !BUILD_TINY_ANDROID
424
425endif # !SDK_ONLY
426
The Android Open Source Project88b60792009-03-03 19:28:42 -0800427ifneq ($(ONE_SHOT_MAKEFILE),)
428# We've probably been invoked by the "mm" shell function
429# with a subdirectory's makefile.
430include $(ONE_SHOT_MAKEFILE)
431# Change CUSTOM_MODULES to include only modules that were
432# defined by this makefile; this will install all of those
433# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
434# so that the modules will be installed in the same place they
435# would have been with a normal make.
436CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS),))
437FULL_BUILD :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800438# Stub out the notice targets, which probably aren't defined
439# when using ONE_SHOT_MAKEFILE.
440NOTICE-HOST-%: ;
441NOTICE-TARGET-%: ;
Joe Onoratoead96462009-07-30 11:20:04 -0700442
443else # ONE_SHOT_MAKEFILE
444
445#
446# Include all of the makefiles in the system
447#
448
449# Can't use first-makefiles-under here because
450# --mindepth=2 makes the prunes not work.
451subdir_makefiles := \
452 $(shell build/tools/findleaves.sh --prune="./out" $(subdirs) Android.mk)
453
The Android Open Source Project88b60792009-03-03 19:28:42 -0800454include $(subdir_makefiles)
Joe Onoratoead96462009-07-30 11:20:04 -0700455endif # ONE_SHOT_MAKEFILE
456
The Android Open Source Project88b60792009-03-03 19:28:42 -0800457# -------------------------------------------------------------------
458# All module makefiles have been included at this point.
459# -------------------------------------------------------------------
460
461# -------------------------------------------------------------------
462# Include any makefiles that must happen after the module makefiles
463# have been included.
464# TODO: have these files register themselves via a global var rather
465# than hard-coding the list here.
466ifdef FULL_BUILD
467 # Only include this during a full build, otherwise we can't be
468 # guaranteed that any policies were included.
469 -include frameworks/policies/base/PolicyConfig.mk
470endif
471
472# -------------------------------------------------------------------
473# Fix up CUSTOM_MODULES to refer to installed files rather than
474# just bare module names. Leave unknown modules alone in case
475# they're actually full paths to a particular file.
476known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
477unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
478CUSTOM_MODULES := \
479 $(call module-installed-files,$(known_custom_modules)) \
480 $(unknown_custom_modules)
481
482# -------------------------------------------------------------------
483# Define dependencies for modules that require other modules.
484# This can only happen now, after we've read in all module makefiles.
485#
486# TODO: deal with the fact that a bare module name isn't
487# unambiguous enough. Maybe declare short targets like
488# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
489# BUG: the system image won't know to depend on modules that are
490# brought in as requirements of other modules.
491define add-required-deps
492$(1): $(2)
493endef
494$(foreach m,$(ALL_MODULES), \
495 $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
496 $(if $(r), \
497 $(eval r := $(call module-installed-files,$(r))) \
498 $(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
499 ) \
500 )
501m :=
502r :=
503add-required-deps :=
504
505# -------------------------------------------------------------------
506# Figure out our module sets.
507
508# Of the modules defined by the component makefiles,
509# determine what we actually want to build.
510# If a module has the "restricted" tag on it, it
511# poisons the rest of the tags and shouldn't appear
512# on any list.
513Default_MODULES := $(sort $(ALL_DEFAULT_INSTALLED_MODULES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800514 $(CUSTOM_MODULES))
The Android Open Source Project2f312932009-03-09 11:52:11 -0700515# TODO: Remove the 3 places in the tree that use
516# ALL_DEFAULT_INSTALLED_MODULES and get rid of it from this list.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800517
518ifdef FULL_BUILD
519 # The base list of modules to build for this product is specified
520 # by the appropriate product definition file, which was included
521 # by product_config.make.
522 user_PACKAGES := $(call module-installed-files, \
523 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
524 ifeq (0,1)
525 $(info user packages for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
526 $(foreach p,$(user_PACKAGES),$(info : $(p)))
527 $(error done)
528 endif
529else
530 # We're not doing a full build, and are probably only including
531 # a subset of the module makefiles. Don't try to build any modules
532 # requested by the product, because we probably won't have rules
533 # to build them.
534 user_PACKAGES :=
535endif
536# Use tags to get the non-APPS user modules. Use the product
537# definition files to get the APPS user modules.
538user_MODULES := $(sort $(call get-tagged-modules,user,_class@APPS restricted))
539user_MODULES := $(user_MODULES) $(user_PACKAGES)
540
541eng_MODULES := $(sort $(call get-tagged-modules,eng,restricted))
542debug_MODULES := $(sort $(call get-tagged-modules,debug,restricted))
543tests_MODULES := $(sort $(call get-tagged-modules,tests,restricted))
544
The Android Open Source Project2f312932009-03-09 11:52:11 -0700545ifeq ($(strip $(tags_to_install)),)
546$(error ASSERTION FAILED: tags_to_install should not be empty)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800547endif
The Android Open Source Project2f312932009-03-09 11:52:11 -0700548modules_to_install := $(sort $(Default_MODULES) \
549 $(foreach tag,$(tags_to_install),$($(tag)_MODULES)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800550
551# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
552# Filter out (do not install) any overridden packages.
The Android Open Source Project2f312932009-03-09 11:52:11 -0700553overridden_packages := $(call get-package-overrides,$(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800554ifdef overridden_packages
The Android Open Source Project2f312932009-03-09 11:52:11 -0700555# old_modules_to_install := $(modules_to_install)
556 modules_to_install := \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800557 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
The Android Open Source Project2f312932009-03-09 11:52:11 -0700558 $(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800559endif
The Android Open Source Project2f312932009-03-09 11:52:11 -0700560#$(error filtered out
561# $(filter-out $(modules_to_install),$(old_modules_to_install)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800562
563# Don't include any GNU targets in the SDK. It's ok (and necessary)
564# to build the host tools, but nothing that's going to be installed
565# on the target (including static libraries).
Joe Onoratoeb19b3e2009-04-13 16:32:16 -0700566ifdef is_sdk_build
The Android Open Source Project88b60792009-03-03 19:28:42 -0800567 target_gnu_MODULES := \
568 $(filter \
569 $(TARGET_OUT_INTERMEDIATES)/% \
570 $(TARGET_OUT)/% \
571 $(TARGET_OUT_DATA)/%, \
572 $(sort $(call get-tagged-modules,gnu)))
573 $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
The Android Open Source Project2f312932009-03-09 11:52:11 -0700574 modules_to_install := \
575 $(filter-out $(target_gnu_MODULES),$(modules_to_install))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800576endif
577
578
Joe Onoratoe334d252009-07-17 15:33:40 -0400579# build/core/Makefile contains extra stuff that we don't want to pollute this
The Android Open Source Project88b60792009-03-03 19:28:42 -0800580# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
581# contains everything that's built during the current make, but it also further
582# extends ALL_DEFAULT_INSTALLED_MODULES.
The Android Open Source Project2f312932009-03-09 11:52:11 -0700583ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800584include $(BUILD_SYSTEM)/Makefile
The Android Open Source Project2f312932009-03-09 11:52:11 -0700585modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800586ALL_DEFAULT_INSTALLED_MODULES :=
587
588endif # dont_bother
589
Joe Onoratoe334d252009-07-17 15:33:40 -0400590# These are additional goals that we build, in order to make sure that there
591# is as little code as possible in the tree that doesn't build.
592modules_to_check := $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).CHECKED))
593
594# If you would like to build all goals, and not skip any intermediate
595# steps, you can pass the "all" modifier goal on the commandline.
596ifneq ($(filter all,$(MAKECMDGOALS)),)
597modules_to_check += $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).BUILT))
598endif
599
600# for easier debugging
601modules_to_check := $(sort $(modules_to_check))
602#$(error modules_to_check $(modules_to_check))
603
The Android Open Source Project88b60792009-03-03 19:28:42 -0800604# -------------------------------------------------------------------
605# This is used to to get the ordering right, you can also use these,
606# but they're considered undocumented, so don't complain if their
607# behavior changes.
608.PHONY: prebuilt
609prebuilt: $(ALL_PREBUILT)
610
611# An internal target that depends on all copied headers
612# (see copy_headers.make). Other targets that need the
613# headers to be copied first can depend on this target.
614.PHONY: all_copied_headers
615all_copied_headers: ;
616
617$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
618
619# All the droid stuff, in directories
620.PHONY: files
Joe Onoratoe334d252009-07-17 15:33:40 -0400621files: prebuilt \
622 $(modules_to_install) \
623 $(modules_to_check) \
624 $(INSTALLED_ANDROID_INFO_TXT_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800625
626# -------------------------------------------------------------------
627
Joe Onoratoe334d252009-07-17 15:33:40 -0400628.PHONY: checkbuild
629checkbuild: $(modules_to_check)
630
The Android Open Source Project88b60792009-03-03 19:28:42 -0800631.PHONY: ramdisk
632ramdisk: $(INSTALLED_RAMDISK_TARGET)
633
634.PHONY: systemtarball
635systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
636
637.PHONY: userdataimage
638userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
639
640.PHONY: userdatatarball
641userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
642
643.PHONY: bootimage
644bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
645
646ifeq ($(BUILD_TINY_ANDROID), true)
647INSTALLED_RECOVERYIMAGE_TARGET :=
648endif
649
650# Build files and then package it into the rom formats
651.PHONY: droidcore
652droidcore: files \
653 systemimage \
654 $(INSTALLED_BOOTIMAGE_TARGET) \
655 $(INSTALLED_RECOVERYIMAGE_TARGET) \
656 $(INSTALLED_USERDATAIMAGE_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800657 $(INSTALLED_FILES_FILE)
658
659# The actual files built by the droidcore target changes depending
660# on the build variant.
661.PHONY: droid tests
662droid tests: droidcore
663
664$(call dist-for-goals, droid, \
665 $(INTERNAL_UPDATE_PACKAGE_TARGET) \
666 $(INTERNAL_OTA_PACKAGE_TARGET) \
667 $(SYMBOLS_ZIP) \
668 $(APPS_ZIP) \
669 $(INTERNAL_EMULATOR_PACKAGE_TARGET) \
670 $(PACKAGE_STATS_FILE) \
671 $(INSTALLED_FILES_FILE) \
672 $(INSTALLED_BUILD_PROP_TARGET) \
673 $(BUILT_TARGET_FILES_PACKAGE) \
674 )
675
676# Tests are installed in userdata.img. If we're building the tests
677# variant, copy it for "make tests dist". Also copy a zip of the
678# contents of userdata.img, so that people can easily extract a
679# single .apk.
680ifeq ($(TARGET_BUILD_VARIANT),tests)
681$(call dist-for-goals, droid, \
682 $(INSTALLED_USERDATAIMAGE_TARGET) \
683 $(BUILT_TESTS_ZIP_PACKAGE) \
684 )
685endif
686
687.PHONY: docs
688docs: $(ALL_DOCS)
689
690.PHONY: sdk
691ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
692sdk: $(ALL_SDK_TARGETS)
693$(call dist-for-goals,sdk,$(ALL_SDK_TARGETS))
694
695.PHONY: findbugs
696findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
697
698.PHONY: clean
699dirs_to_clean := \
700 $(PRODUCT_OUT) \
701 $(TARGET_COMMON_OUT_ROOT) \
702 $(HOST_OUT) \
703 $(HOST_COMMON_OUT_ROOT)
704clean:
705 @for dir in $(dirs_to_clean) ; do \
706 echo "Cleaning $$dir..."; \
707 rm -rf $$dir; \
708 done
709 @echo "Clean."; \
710
711.PHONY: clobber
712clobber:
713 @rm -rf $(OUT_DIR)
714 @echo "Entire build directory removed."
715
716# The rules for dataclean and installclean are defined in cleanbuild.mk.
717
718#xxx scrape this from ALL_MODULE_NAME_TAGS
719.PHONY: modules
720modules:
721 @echo "Available sub-modules:"
722 @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
723 sed -e 's/ */\n/g' | sort -u | $(COLUMN)
724
725.PHONY: showcommands
726showcommands:
727 @echo >/dev/null
728