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