Only include test targets if test-art* or build-art* is being built.
Change-Id: I229ba2a77d993b2c14acf9a76e102ef76b0aeba6
diff --git a/Android.mk b/Android.mk
index f8d46a4..7d36659 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,15 +24,17 @@
include $(art_path)/build/Android.common_path.mk
-# following the example of build's dont_bother for clean targets
-ifneq (,$(filter clean-oat,$(MAKECMDGOALS)))
-art_dont_bother := true
+# Following the example of build's dont_bother for clean targets.
+art_done_bother := false
+ifneq (,$(filter clean-oat%,$(MAKECMDGOALS)))
+ art_dont_bother := true
endif
-ifneq (,$(filter clean-oat-host,$(MAKECMDGOALS)))
-art_dont_bother := true
-endif
-ifneq (,$(filter clean-oat-target,$(MAKECMDGOALS)))
-art_dont_bother := true
+
+# Don't bother with tests unless there is a test-art* or build-art* target.
+art_test_bother := false
+$(info $(MAKECMDGOALS))
+ifneq (,$(filter test-art% build-art%,$(MAKECMDGOALS)))
+ art_test_bother := true
endif
.PHONY: clean-oat
@@ -131,6 +133,8 @@
########################################################################
# test rules
+ifeq ($(art_test_bother),true)
+
# All the dependencies that must be built ahead of sync-ing them onto the target device.
TEST_ART_TARGET_SYNC_DEPS :=
@@ -300,6 +304,8 @@
$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
endif
+endif # art_test_bother
+
########################################################################
# oat-target and oat-target-sync rules
@@ -452,3 +458,7 @@
########################################################################
endif # !art_dont_bother
+
+# Clear locally used variables.
+art_dont_bother :=
+art_test_bother :=