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