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