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