Convert to Android.bp

See build/soong/Android.bp for more information.

Bug: 31742855
Test: mma -j
Change-Id: Ia013a6d6a942a0fc0f610ef7eef9deadac01fd6c
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..07fd62c
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,105 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+subdirs = [
+    "c2hal",
+    "utils",
+]
+
+//
+// libhidl-gen
+//
+cc_library_shared {
+    name: "libhidl-gen",
+    host_supported: true,
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+    srcs: [
+        "Annotation.cpp",
+        "ArrayType.cpp",
+        "CompoundType.cpp",
+        "ConstantExpression.cpp",
+        "EnumType.cpp",
+        "FQName.cpp",
+        "GenericBinder.cpp",
+        "HandleType.cpp",
+        "Interface.cpp",
+        "Method.cpp",
+        "NamedType.cpp",
+        "PredefinedType.cpp",
+        "ScalarType.cpp",
+        "Scope.cpp",
+        "StringType.cpp",
+        "Type.cpp",
+        "TypeDef.cpp",
+        "VectorType.cpp",
+    ],
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libhidl-gen-utils",
+    ],
+}
+
+//
+// libhidl-gen-ast
+//
+
+cc_library_host_shared {
+    name: "libhidl-gen-ast",
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+    srcs: [
+        "Coordinator.cpp",
+        "generateCpp.cpp",
+        "generateCppImpl.cpp",
+        "generateJava.cpp",
+        "generateVts.cpp",
+        "hidl-gen_y.yy",
+        "hidl-gen_l.ll",
+        "AST.cpp",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libhidl-gen",
+        "libhidl-gen-utils",
+    ],
+}
+
+//
+// hidl-gen
+//
+cc_binary_host {
+    name: "hidl-gen",
+    srcs: ["main.cpp"],
+
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libhidl-gen",
+        "libhidl-gen-ast",
+        "libhidl-gen-utils",
+    ],
+
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 79c5a1a..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,104 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-common_libhidl-gen_src_files := \
-    Annotation.cpp              \
-    ArrayType.cpp               \
-    CompoundType.cpp            \
-    ConstantExpression.cpp      \
-    EnumType.cpp                \
-    FQName.cpp                  \
-    GenericBinder.cpp           \
-    HandleType.cpp              \
-    Interface.cpp               \
-    Method.cpp                  \
-    NamedType.cpp               \
-    PredefinedType.cpp          \
-    ScalarType.cpp              \
-    Scope.cpp                   \
-    StringType.cpp              \
-    Type.cpp                    \
-    TypeDef.cpp                 \
-    VectorType.cpp              \
-
-#
-# libhidl-gen for device
-#
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libhidl-gen
-LOCAL_CFLAGS := -O0 -g
-LOCAL_SRC_FILES := $(common_libhidl-gen_src_files)
-LOCAL_SHARED_LIBRARIES :=       \
-    libbase                     \
-    liblog                      \
-    libhidl-gen-utils           \
-
-include $(BUILD_SHARED_LIBRARY)
-
-#
-# libhidl-gen for host
-#
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libhidl-gen
-LOCAL_CFLAGS := -O0 -g
-LOCAL_SRC_FILES := $(common_libhidl-gen_src_files)
-LOCAL_SHARED_LIBRARIES :=       \
-    libbase                     \
-    liblog                      \
-    libhidl-gen-utils           \
-
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-common_libhidl-gen-ast_src_files := \
-    Coordinator.cpp                 \
-    generateCpp.cpp                 \
-    generateCppImpl.cpp             \
-    generateJava.cpp                \
-    generateVts.cpp                 \
-    hidl-gen_y.yy                   \
-    hidl-gen_l.ll                   \
-    AST.cpp                         \
-
-#
-# libhidl-gen-ast
-#
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libhidl-gen-ast
-LOCAL_CFLAGS := -O0 -g
-LOCAL_SRC_FILES := $(common_libhidl-gen-ast_src_files)
-
-LOCAL_SHARED_LIBRARIES :=       \
-    libbase                     \
-    liblog                      \
-    libhidl-gen                 \
-    libhidl-gen-utils           \
-
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-#
-# hidl-gen
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := hidl-gen
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_IS_HOST_MODULE := true
-
-LOCAL_SRC_FILES :=              \
-    main.cpp                    \
-
-LOCAL_SHARED_LIBRARIES :=       \
-    libbase                     \
-    liblog                      \
-    libhidl-gen                 \
-    libhidl-gen-ast             \
-    libhidl-gen-utils           \
-
-LOCAL_CFLAGS := -O0 -g
-
-include $(BUILD_HOST_EXECUTABLE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/c2hal/Android.bp b/c2hal/Android.bp
new file mode 100644
index 0000000..f901d24
--- /dev/null
+++ b/c2hal/Android.bp
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_binary_host {
+    name: "c2hal",
+    srcs: [
+        "AST.cpp",
+        "c2hal_l.ll",
+        "c2hal_y.yy",
+        "CompositeDeclaration.cpp",
+        "Declaration.cpp",
+        "Define.cpp",
+        "EnumVarDeclaration.cpp",
+        "Expression.cpp",
+        "FunctionDeclaration.cpp",
+        "Include.cpp",
+        "main.cpp",
+        "Note.cpp",
+        "Type.cpp",
+        "TypeDef.cpp",
+        "VarDeclaration.cpp",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libhidl-gen-utils",
+    ],
+
+    static_libs: ["libutils"],
+
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
diff --git a/c2hal/Android.mk b/c2hal/Android.mk
deleted file mode 100644
index 0a1bde3..0000000
--- a/c2hal/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := c2hal
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_IS_HOST_MODULE := true
-
-LOCAL_SRC_FILES :=              \
-    AST.cpp                     \
-    c2hal_l.ll                  \
-    c2hal_y.yy                  \
-    CompositeDeclaration.cpp    \
-    Declaration.cpp             \
-    Define.cpp                  \
-    EnumVarDeclaration.cpp      \
-    Expression.cpp              \
-    FunctionDeclaration.cpp     \
-    Include.cpp                 \
-    main.cpp                    \
-    Note.cpp                    \
-    Type.cpp                    \
-    TypeDef.cpp                 \
-    VarDeclaration.cpp          \
-
-LOCAL_SHARED_LIBRARIES :=       \
-    libbase                     \
-    liblog                      \
-    libhidl-gen-utils           \
-
-LOCAL_STATIC_LIBRARIES :=       \
-    libutils                    \
-
-LOCAL_CFLAGS := -O0 -g
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/utils/Android.bp b/utils/Android.bp
new file mode 100644
index 0000000..a6c37a6
--- /dev/null
+++ b/utils/Android.bp
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_library_shared {
+    name: "libhidl-gen-utils",
+    host_supported: true,
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+    srcs: [
+        "Formatter.cpp",
+        "StringHelper.cpp",
+    ],
+    shared_libs: [
+        "libbase",
+        "liblog",
+    ],
+
+    local_include_dirs: ["include/hidl-util"],
+    export_include_dirs: ["include"],
+}
diff --git a/utils/Android.mk b/utils/Android.mk
deleted file mode 100644
index a1fe8ee..0000000
--- a/utils/Android.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-LOCAL_PATH:= $(call my-dir)
-
-common_libhidl-gen-utils_src_files :=   \
-    Formatter.cpp                       \
-    StringHelper.cpp                    \
-
-#
-# libhidl-gen-utils for device
-#
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libhidl-gen-utils
-LOCAL_CFLAGS := -O0 -g
-LOCAL_SRC_FILES := $(common_libhidl-gen-utils_src_files)
-LOCAL_SHARED_LIBRARIES :=               \
-    libbase                             \
-    liblog                              \
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/hidl-util
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-include $(BUILD_SHARED_LIBRARY)
-
-#
-# libhidl-gen-utils for host
-#
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libhidl-gen-utils
-LOCAL_CFLAGS := -O0 -g
-LOCAL_SRC_FILES := $(common_libhidl-gen-utils_src_files)
-LOCAL_SHARED_LIBRARIES :=               \
-    libbase                             \
-    liblog                              \
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/hidl-util
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-include $(BUILD_HOST_SHARED_LIBRARY)
\ No newline at end of file