Convert to Android.bp

See build/soong/README.md for more information.

Test: mmma external/bison
Change-Id: Ice1691f9de3c3189007ff3fad561ef205248134f
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..6bbd4d3
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,211 @@
+// Copyright 2006 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_defaults {
+    name: "bison_defaults",
+
+    cflags: [
+        "-Wall",
+        "-Wno-sign-compare",
+    ],
+
+    target: {
+        darwin: {
+            local_include_dirs: [
+                "darwin-lib",
+                "lib",
+            ],
+            cflags: ["-Wno-shift-count-overflow"],
+        },
+        linux: {
+            local_include_dirs: [
+                "linux-lib",
+                "lib",
+            ],
+            cflags: ["-Werror"],
+        },
+    },
+}
+
+cc_library_host_static {
+    name: "libbison",
+    defaults: ["bison_defaults"],
+
+    srcs: [
+        "lib/abitset.c",
+        "lib/argmatch.c",
+        "lib/asnprintf.c",
+        "lib/basename-lgpl.c",
+        "lib/basename.c",
+        "lib/binary-io.c",
+        "lib/bitrotate.c",
+        "lib/bitset.c",
+        "lib/bitset_stats.c",
+        "lib/bitsetv-print.c",
+        "lib/bitsetv.c",
+        "lib/c-ctype.c",
+        "lib/c-strcasecmp.c",
+        "lib/c-strncasecmp.c",
+        "lib/cloexec.c",
+        "lib/close-stream.c",
+        "lib/closeout.c",
+        "lib/dirname-lgpl.c",
+        "lib/dirname.c",
+        "lib/dup-safer-flag.c",
+        "lib/dup-safer.c",
+        "lib/ebitset.c",
+        "lib/exitfail.c",
+        "lib/fatal-signal.c",
+        "lib/fd-hook.c",
+        "lib/fd-safer-flag.c",
+        "lib/fd-safer.c",
+        "lib/fopen-safer.c",
+        "lib/fprintf.c",
+        "lib/fseterr.c",
+        "lib/get-errno.c",
+        "lib/hash.c",
+        "lib/isnand.c",
+        "lib/isnanf.c",
+        "lib/isnanl.c",
+        "lib/lbitset.c",
+        "lib/localcharset.c",
+        "lib/math.c",
+        "lib/mbchar.c",
+        "lib/mbschr.c",
+        "lib/mbsrchr.c",
+        "lib/mbswidth.c",
+        "lib/mbuiter.c",
+        "lib/pipe-safer.c",
+        "lib/pipe2-safer.c",
+        "lib/pipe2.c",
+        "lib/printf-args.c",
+        "lib/printf-frexp.c",
+        "lib/printf-frexpl.c",
+        "lib/printf-parse.c",
+        "lib/printf.c",
+        "lib/progname.c",
+        "lib/quotearg.c",
+        "lib/sig-handler.c",
+        "lib/snprintf.c",
+        "lib/spawn-pipe.c",
+        "lib/sprintf.c",
+        "lib/stdio.c",
+        "lib/strerror_r.c",
+        "lib/stripslash.c",
+        "lib/strnlen1.c",
+        "lib/timevar.c",
+        "lib/unistd.c",
+        "lib/vasnprintf.c",
+        "lib/vbitset.c",
+        "lib/vfprintf.c",
+        "lib/vsnprintf.c",
+        "lib/vsprintf.c",
+        "lib/wait-process.c",
+        "lib/wctype-h.c",
+        "lib/xalloc-die.c",
+        "lib/xmalloc.c",
+        "lib/xmemdup0.c",
+        "lib/xsize.c",
+        "lib/xstrndup.c",
+        "lib/yyerror.c",
+        "lib/glthread/lock.c",
+        "lib/glthread/threadlib.c",
+        "lib/uniwidth/width.c",
+    ],
+
+    target: {
+        darwin: {
+            srcs: [
+                "lib/error.c",
+                "lib/fpending.c",
+                "lib/getdelim.c",
+                "lib/getline.c",
+                "lib/getopt.c",
+                "lib/getopt1.c",
+                "lib/obstack.c",
+                "lib/obstack_printf.c",
+                "lib/open.c",
+                "lib/perror.c",
+                "lib/rawmemchr.c",
+                "lib/stat.c",
+                "lib/strchrnul.c",
+                "lib/strerror-override.c",
+                "lib/strerror.c",
+                "lib/strndup.c",
+                "lib/strnlen.c",
+                "lib/strverscmp.c",
+                "lib/wcwidth.c",
+            ],
+        },
+
+        linux: {
+            srcs: ["lib/fcntl.c"],
+        },
+    },
+}
+
+//##########################################
+
+cc_binary_host {
+    name: "bison",
+    defaults: ["bison_defaults"],
+
+    cflags: [
+        "-DPKGDATADIR=\"external/bison/data\"",
+
+        "-Wno-sometimes-uninitialized",
+        "-Wno-unused-parameter",
+    ],
+
+    static_libs: ["libbison"],
+
+    srcs: [
+        "src/AnnotationList.c",
+        "src/InadequacyList.c",
+        "src/LR0.c",
+        "src/Sbitset.c",
+        "src/assoc.c",
+        "src/closure.c",
+        "src/complain.c",
+        "src/conflicts.c",
+        "src/derives.c",
+        "src/files.c",
+        "src/getargs.c",
+        "src/gram.c",
+        "src/graphviz.c",
+        "src/ielr.c",
+        "src/lalr.c",
+        "src/location.c",
+        "src/main.c",
+        "src/muscle-tab.c",
+        "src/named-ref.c",
+        "src/nullable.c",
+        "src/output.c",
+        "src/parse-gram.c",
+        "src/print-xml.c",
+        "src/print.c",
+        "src/print_graph.c",
+        "src/reader.c",
+        "src/reduce.c",
+        "src/relation.c",
+        "src/scan-code-c.c",
+        "src/scan-gram-c.c",
+        "src/scan-skel-c.c",
+        "src/state.c",
+        "src/symlist.c",
+        "src/symtab.c",
+        "src/tables.c",
+        "src/uniqstr.c",
+    ],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index a0a3cfb..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,205 +0,0 @@
-# Copyright 2006 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)
-
-ifeq ($(HOST_OS),darwin)
-BISON_WERROR := -Wno-shift-count-overflow
-else
-BISON_WERROR := -Werror
-endif
-
-###########################################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbison
-
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/$(BUILD_OS)-lib \
-    $(LOCAL_PATH)/lib
-
-LOCAL_SRC_FILES := \
-    lib/abitset.c \
-    lib/argmatch.c \
-    lib/asnprintf.c \
-    lib/basename-lgpl.c \
-    lib/basename.c \
-    lib/binary-io.c \
-    lib/bitrotate.c \
-    lib/bitset.c \
-    lib/bitset_stats.c \
-    lib/bitsetv-print.c \
-    lib/bitsetv.c \
-    lib/c-ctype.c \
-    lib/c-strcasecmp.c \
-    lib/c-strncasecmp.c \
-    lib/cloexec.c \
-    lib/close-stream.c \
-    lib/closeout.c \
-    lib/dirname-lgpl.c \
-    lib/dirname.c \
-    lib/dup-safer-flag.c \
-    lib/dup-safer.c \
-    lib/ebitset.c \
-    lib/exitfail.c \
-    lib/fatal-signal.c \
-    lib/fd-hook.c \
-    lib/fd-safer-flag.c \
-    lib/fd-safer.c \
-    lib/fopen-safer.c \
-    lib/fprintf.c \
-    lib/fseterr.c \
-    lib/get-errno.c \
-    lib/hash.c \
-    lib/isnand.c \
-    lib/isnanf.c \
-    lib/isnanl.c \
-    lib/lbitset.c \
-    lib/localcharset.c \
-    lib/math.c \
-    lib/mbchar.c \
-    lib/mbschr.c \
-    lib/mbsrchr.c \
-    lib/mbswidth.c \
-    lib/mbuiter.c \
-    lib/pipe-safer.c \
-    lib/pipe2-safer.c \
-    lib/pipe2.c \
-    lib/printf-args.c \
-    lib/printf-frexp.c \
-    lib/printf-frexpl.c \
-    lib/printf-parse.c \
-    lib/printf.c \
-    lib/progname.c \
-    lib/quotearg.c \
-    lib/sig-handler.c \
-    lib/snprintf.c \
-    lib/spawn-pipe.c \
-    lib/sprintf.c \
-    lib/stdio.c \
-    lib/strerror_r.c \
-    lib/stripslash.c \
-    lib/strnlen1.c \
-    lib/timevar.c \
-    lib/unistd.c \
-    lib/vasnprintf.c \
-    lib/vbitset.c \
-    lib/vfprintf.c \
-    lib/vsnprintf.c \
-    lib/vsprintf.c \
-    lib/wait-process.c \
-    lib/wctype-h.c \
-    lib/xalloc-die.c \
-    lib/xmalloc.c \
-    lib/xmemdup0.c \
-    lib/xsize.c \
-    lib/xstrndup.c \
-    lib/yyerror.c \
-    lib/glthread/lock.c \
-    lib/glthread/threadlib.c \
-    lib/uniwidth/width.c
-
-ifeq ($(BUILD_OS),darwin)
-LOCAL_SRC_FILES += \
-    lib/error.c \
-    lib/fpending.c \
-    lib/getdelim.c \
-    lib/getline.c \
-    lib/getopt.c \
-    lib/getopt1.c \
-    lib/obstack.c \
-    lib/obstack_printf.c \
-    lib/open.c \
-    lib/perror.c \
-    lib/rawmemchr.c \
-    lib/stat.c \
-    lib/strchrnul.c \
-    lib/strerror-override.c \
-    lib/strerror.c \
-    lib/strndup.c \
-    lib/strnlen.c \
-    lib/strverscmp.c \
-    lib/wcwidth.c
-endif
-
-ifeq ($(BUILD_OS),linux)
-LOCAL_SRC_FILES += \
-    lib/fcntl.c
-endif
-
-LOCAL_CFLAGS := $(BISON_WERROR) -Wall -Wno-sign-compare
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-###########################################
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := bison
-
-LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/$(BUILD_OS)-lib \
-    $(LOCAL_PATH)/lib
-
-LOCAL_CFLAGS := -DPKGDATADIR=\"$(LOCAL_PATH)/data\"
-
-LOCAL_CFLAGS := -DPKGDATADIR=\"$(LOCAL_PATH)/data\" \
-    -Wall \
-    $(BISON_WERROR) \
-    -Wno-sign-compare \
-    -Wno-sometimes-uninitialized \
-    -Wno-unused-parameter \
-
-LOCAL_STATIC_LIBRARIES := libbison
-
-LOCAL_SRC_FILES := \
-    src/AnnotationList.c \
-    src/InadequacyList.c \
-    src/LR0.c \
-    src/Sbitset.c \
-    src/assoc.c \
-    src/closure.c \
-    src/complain.c \
-    src/conflicts.c \
-    src/derives.c \
-    src/files.c \
-    src/getargs.c \
-    src/gram.c \
-    src/graphviz.c \
-    src/ielr.c \
-    src/lalr.c \
-    src/location.c \
-    src/main.c \
-    src/muscle-tab.c \
-    src/named-ref.c \
-    src/nullable.c \
-    src/output.c \
-    src/parse-gram.c \
-    src/print-xml.c \
-    src/print.c \
-    src/print_graph.c \
-    src/reader.c \
-    src/reduce.c \
-    src/relation.c \
-    src/scan-code-c.c \
-    src/scan-gram-c.c \
-    src/scan-skel-c.c \
-    src/state.c \
-    src/symlist.c \
-    src/symtab.c \
-    src/tables.c \
-    src/uniqstr.c
-
-include $(BUILD_HOST_EXECUTABLE)
-
-BISON_WERROR :=