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