summaryrefslogtreecommitdiffstats
path: root/core/host_executable.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2012-12-13 18:23:01 -0800
committerYing Wang <wangying@google.com>2012-12-14 14:48:00 -0800
commit63d94fa3056066ba7be6754356975af6a1c82981 (patch)
treeea7b1813537535b23c45476eb81440fbd5fb1eeb /core/host_executable.mk
parent9c68f06a5450223eaefcd165c69fd5336cc2317e (diff)
downloadbuild-63d94fa3056066ba7be6754356975af6a1c82981.zip
build-63d94fa3056066ba7be6754356975af6a1c82981.tar.gz
build-63d94fa3056066ba7be6754356975af6a1c82981.tar.bz2
Build from source or prebuilt
With this change, you can easily switch between building from source code and prebuilt. Set LOCAL_PREBUILT_MODULE_FILE to the path of the prebuilt file, relative to the top of the source tree, in the usual module definition. The prebuilt will be used unless any of the followings satisfied: 1) ANDROID_BUILD_FROM_SOURCE is "true", which disable prebuilt globally; 2) The module name is in ANDROID_NO_PREBUILT_MODULES; 3) The LOCAL_PATH is prefixed by any of ANDROID_NO_PREBUILT_PATHS. A developer can set ANDROID_NO_PREBUILT_MODULES or ANDROID_NO_PREBUILT_PATHS to build only his own module(s) from source, while build other modules from prebuilts. You can set ANDROID_BUILD_FROM_SOURCE to true to build everything from source. Those variables can be set with shell environmental variable or in your buildspec.mk. Sometimes module B is able to be built from source only if module A is also built from source, for example, if B is the test apk of A. In that case, you can use the macro include-if-build-from-source to include B's Android.mk only if A is built from source too, or if-build-from-source to conditionally include the definition of module B, if their module definitions are in the same Android.mk. Support host-executable-hook and host-shared-library-hook. Change-Id: Icab7cf028c87eaba0dd7efc2a7749fd6f32b44e4
Diffstat (limited to 'core/host_executable.mk')
-rw-r--r--core/host_executable.mk14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/host_executable.mk b/core/host_executable.mk
index 93d3f10..ab0f8f3 100644
--- a/core/host_executable.mk
+++ b/core/host_executable.mk
@@ -13,7 +13,21 @@ ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(HOST_EXECUTABLE_SUFFIX)
endif
+$(call host-executable-hook)
+
+skip_build_from_source :=
+ifdef LOCAL_PREBUILT_MODULE_FILE
+ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
+include $(BUILD_PREBUILT)
+skip_build_from_source := true
+endif
+endif
+
+ifndef skip_build_from_source
+
include $(BUILD_SYSTEM)/binary.mk
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
$(transform-host-o-to-executable)
+
+endif # skip_build_from_source