Stop using HOST_OS, whitelist windows modules

All clang host modules are whitelisted, since they all pass checkbuild.

Bug: 23566667
Change-Id: Idcd328323b2a2e9cc9c0acd29e583b6bb77e72b0
diff --git a/clang-host-build.mk b/clang-host-build.mk
index 9cd2bf4..afdd023 100644
--- a/clang-host-build.mk
+++ b/clang-host-build.mk
@@ -27,6 +27,8 @@
 	$(CLANG_ROOT_PATH)/lib/CodeGen    \
 	$(LOCAL_C_INCLUDES)
 
+LOCAL_MODULE_HOST_OS := darwin linux windows
+
 LLVM_ROOT_PATH := external/llvm
 include $(LLVM_ROOT_PATH)/llvm.mk
 
diff --git a/shared_clang.mk b/shared_clang.mk
index 151a626..8b81d16 100644
--- a/shared_clang.mk
+++ b/shared_clang.mk
@@ -1,5 +1,3 @@
-# Don't build the library unless forced to.
-ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
 # Don't build the library in unbundled branches.
 ifeq (,$(TARGET_BUILD_APPS))
 
@@ -33,17 +31,34 @@
 LOCAL_MODULE_TAGS := optional
 LOCAL_WHOLE_STATIC_LIBRARIES := $(clang_whole_static_libraries)
 
-ifeq ($(HOST_OS),windows)
-  LOCAL_SHARED_LIBRARIES := libLLVM
-  LOCAL_LDLIBS := -limagehlp -lpsapi
-else
-  LOCAL_SHARED_LIBRARIES := libLLVM libc++
-  LOCAL_LDLIBS := -ldl -lpthread
-endif
+LOCAL_SHARED_LIBRARIES := libLLVM
+
+LOCAL_LDLIBS_windows := -limagehlp -lpsapi
+
+LOCAL_SHARED_LIBRARIES_darwin := libc++
+LOCAL_SHARED_LIBRARIES_linux := libc++
+LOCAL_LDLIBS_darwin := -ldl -lpthread
+LOCAL_LDLIBS_linux := -ldl -lpthread
 
 include $(CLANG_HOST_BUILD_MK)
-include $(BUILD_HOST_SHARED_LIBRARY)
 
+# Don't build the library unless forced to. We don't
+# have prebuilts for windows.
+ifneq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
+LOCAL_MODULE_HOST_OS := windows
+# BUILD_HOST_SHARED_LIBRARY can be moved out once
+# LOCAL_MODULE_HOST_OS is enforced.
+ifeq ($(HOST_OS),windows)
+include $(BUILD_HOST_SHARED_LIBRARY)
+endif
+else
+LOCAL_MODULE_HOST_OS := darwin linux windows
+include $(BUILD_HOST_SHARED_LIBRARY)
+endif
+
+
+# Don't build the library unless forced to.
+ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
 # device
 include $(CLEAR_VARS)
 
@@ -56,6 +71,6 @@
 
 include $(CLANG_DEVICE_BUILD_MK)
 include $(BUILD_SHARED_LIBRARY)
+endif # don't build unless forced to
 
 endif # don't build in unbundled branches
-endif # don't build unless forced to
diff --git a/tools/driver/Android.mk b/tools/driver/Android.mk
index 30d931f..f851bd1 100644
--- a/tools/driver/Android.mk
+++ b/tools/driver/Android.mk
@@ -97,11 +97,9 @@
   libLLVMSupport
 
 LOCAL_LDLIBS += -lm
-ifdef USE_MINGW
-LOCAL_LDLIBS += -limagehlp
-else
-LOCAL_LDLIBS += -lpthread -ldl
-endif
+LOCAL_LDLIBS_windows := -limagehlp
+LOCAL_LDLIBS_darwin := -lpthread -ldl
+LOCAL_LDLIBS_linux := -lpthread -ldl
 
 # remove when we can use PIE binaries in all places again
 LOCAL_NO_FPIE := true
diff --git a/utils/TableGen/Android.mk b/utils/TableGen/Android.mk
index 4a40dc8..0b9f09d 100644
--- a/utils/TableGen/Android.mk
+++ b/utils/TableGen/Android.mk
@@ -25,11 +25,9 @@
   libLLVMSupport
 
 LOCAL_LDLIBS += -lm
-ifeq ($(HOST_OS),windows)
-  LOCAL_LDLIBS += -limagehlp -lpsapi
-else
-  LOCAL_LDLIBS += -lpthread -ldl
-endif
+LOCAL_LDLIBS_windows := -limagehlp -lpsapi
+LOCAL_LDLIBS_darwin := -lpthread -ldl
+LOCAL_LDLIBS_linux := -lpthread -ldl
 
 include $(LLVM_HOST_BUILD_MK)
 include $(BUILD_HOST_EXECUTABLE)