Allow disabling turbine

m -j TURBINE_ENABLED=false will build without turbine.  This is
primarily useful for A/B comparisions of turbine builds, but will
also be used to temporarily disable turbine for unbundled builds
until we have turbine prebuilts.

Bug: 64308460
Test: m -j TURBINE_ENABLED=false java
Test: m -j java
Change-Id: Ie48746c8bfc60c361be9634cb1805ca1c09aa1fe
diff --git a/core/definitions.mk b/core/definitions.mk
index 819a485..14e4509 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -683,9 +683,15 @@
 # Java libraries that you want to link against.
 # $(1): library name list
 # $(2): Non-empty if IS_HOST_MODULE
+ifneq ($(TURBINE_ENABLED),false)
 define java-lib-header-files
 $(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),$(2),COMMON)/classes-header.jar)
 endef
+else
+define java-lib-header-files
+$(call java-lib-files,$(1),$(2))
+endef
+endif
 
 # Get the dependency files (you can put on the right side of "|" of a build rule)
 # of the Java libraries.
@@ -709,9 +715,15 @@
 # Get the header jar files (you can pass to "javac -classpath") of static or shared
 # APK libraries that you want to link against.
 # $(1): library name list
+ifneq ($(TURBINE_ENABLED),false)
 define app-lib-header-files
 $(foreach lib,$(1),$(call intermediates-dir-for,APPS,$(lib),,COMMON)/classes-header.jar)
 endef
+else
+define app-lib-header-files
+$(call app-lib-files,$(1))
+endef
+endif
 
 ###########################################################
 ## Convert "core ext framework" to "out/.../classes.jack ..."