Make vixl tests work with custom OUT_DIR settings

Change-Id: I1a8de4cb31a46d5ca976712400588327814fa689
diff --git a/Android.mk b/Android.mk
index 0d5cd60..b5fc309 100644
--- a/Android.mk
+++ b/Android.mk
@@ -237,11 +237,13 @@
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 include $(BUILD_HOST_EXECUTABLE)
 
+vixl_host_out := $(if $(ANDROID_HOST_OUT), $(ANDROID_HOST_OUT), ../../$(HOST_OUT))
+
 .PHONY: run-vixl-tests
 run-vixl-tests: vixl-test-runner
 	$(vixl_root)/third_party/android/check_top_level_android_mk.sh
 	# TODO: Once available, use the appropriate option of vixl-test-runner
 	# to point to the trace files instead of running from the vixl root.
-	cd $(vixl_root) && ../../$(HOST_OUT)/bin/vixl-test-runner --run_all
-	cd $(vixl_root) && ../../$(HOST_OUT)/bin/vixl-test-runner --run_all --debugger
+	cd $(vixl_root) && $(vixl_host_out)/bin/vixl-test-runner --run_all
+	cd $(vixl_root) && $(vixl_host_out)/bin/vixl-test-runner --run_all --debugger
 	@echo vixl tests PASSED
diff --git a/third_party/android/Android.mk.template b/third_party/android/Android.mk.template
index db87165..ca2748d 100644
--- a/third_party/android/Android.mk.template
+++ b/third_party/android/Android.mk.template
@@ -218,11 +218,13 @@
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 include $(BUILD_HOST_EXECUTABLE)
 
+vixl_host_out := $(if $(ANDROID_HOST_OUT), $(ANDROID_HOST_OUT), ../../$(HOST_OUT))
+
 .PHONY: run-vixl-tests
 run-vixl-tests: vixl-test-runner
 	$(vixl_root)/third_party/android/check_top_level_android_mk.sh
 	# TODO: Once available, use the appropriate option of vixl-test-runner
 	# to point to the trace files instead of running from the vixl root.
-	cd $(vixl_root) && ../../$(HOST_OUT)/bin/vixl-test-runner --run_all
-	cd $(vixl_root) && ../../$(HOST_OUT)/bin/vixl-test-runner --run_all --debugger
+	cd $(vixl_root) && $(vixl_host_out)/bin/vixl-test-runner --run_all
+	cd $(vixl_root) && $(vixl_host_out)/bin/vixl-test-runner --run_all --debugger
 	@echo vixl tests PASSED