versioner: fix makefiles.

Move the Android.mk to src/ so that mm in that directory works.
Also, remove the dependency on FORCE_BUILD_LLVM_COMPONENTS.

Change-Id: Iad7f3fc96f5f26f9535141d752ba865b40d5ff7e
diff --git a/tools/versioner/Android.mk b/tools/versioner/Android.mk
index 4cf30e2..c455f97 100644
--- a/tools/versioner/Android.mk
+++ b/tools/versioner/Android.mk
@@ -1,26 +1,3 @@
-ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
-
 LOCAL_PATH := $(call my-dir)
 
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := versioner
-LOCAL_MODULE_HOST_OS := linux
-
-LOCAL_CLANG := true
-LOCAL_CFLAGS := -Wall -Wextra -Werror -Wno-unused-parameter
-LOCAL_CFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
-LOCAL_CPPFLAGS := $(LOCAL_CFLAGS) -std=c++14 -fno-rtti
-
-LOCAL_SRC_FILES := \
-  src/versioner.cpp \
-  src/Arch.cpp \
-  src/DeclarationDatabase.cpp \
-  src/SymbolDatabase.cpp \
-  src/Utils.cpp
-
-LOCAL_SHARED_LIBRARIES := libclang libLLVM
-
-include $(BUILD_HOST_EXECUTABLE)
-
-endif
+include $(call all-subdir-makefiles)
diff --git a/tools/versioner/src/Android.mk b/tools/versioner/src/Android.mk
new file mode 100644
index 0000000..35cf45b
--- /dev/null
+++ b/tools/versioner/src/Android.mk
@@ -0,0 +1,42 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LLVM_ROOT_PATH := external/llvm
+CLANG_ROOT_PATH := external/clang
+include $(CLANG_ROOT_PATH)/clang.mk
+
+LOCAL_MODULE := versioner
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := EXECUTABLES
+
+TBLGEN_TABLES := \
+  AttrList.inc \
+  AttrVisitor.inc \
+  Attrs.inc \
+  CommentCommandList.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  StmtNodes.inc \
+
+LOCAL_SRC_FILES := \
+  versioner.cpp \
+  Arch.cpp \
+  DeclarationDatabase.cpp \
+  SymbolDatabase.cpp \
+  Utils.cpp
+
+LOCAL_SHARED_LIBRARIES := libclang libLLVM
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+
+# Set these after including the clang makefiles, to avoid getting CFLAGS from them.
+LOCAL_CFLAGS := -Wall -Wextra -Werror -Wno-unused-parameter
+LOCAL_CFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
+LOCAL_CPPFLAGS := -std=c++14 -fno-rtti
+
+LOCAL_MODULE_HOST_OS := linux
+
+include $(BUILD_HOST_EXECUTABLE)