ANDROID: bazel: Clean up lexer and parser rules

Simplify the build file as

- dtc_gen creates an unnecessarily broad (and confusing) dependency list
  by using glob([".h"]) as its header list. Instead, dtc now lists
  explicitly the few headers it actually needs;
- generating dtc-lexer.lex.c does not require dtc-parser.{c,h};
- Bison can be told to directly create dtc-parser.{c,h} so no need for
  an unnecessarily broad copying of *.[ch] to move some intermediate
  results.

As a result, we get two genrule() wrapping the source files respectively
generated through lex and bison, which can be listed as srcs of dtc.

Test: bazel build //:all
Change-Id: I238d963af8a338c46f39c8ba9e4314fe536948cf
diff --git a/BUILD.bazel b/BUILD.bazel
index 8a65ba8..634115c 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -21,38 +21,20 @@
 ]
 
 genrule(
-    name = "lexer",
-    srcs = [
-        "dtc-lexer.l",
-        ":parser",
-    ],
+    name = "dtc_lexer_srcs",
+    srcs = ["dtc-lexer.l"],
     outs = ["dtc-lexer.lex.c"],
-    cmd = "lex -o$@ $(location dtc-lexer.l)",
+    cmd = "lex -o $@ $<",
 )
 
 genrule(
-    name = "parser",
+    name = "dtc_parser_srcs",
     srcs = ["dtc-parser.y"],
     outs = [
         "dtc-parser.c",
         "dtc-parser.h",
     ],
-    cmd = """
-      bison -b dtc-parser -d $(location dtc-parser.y)
-      cp ./*.c $(location dtc-parser.c)
-      cp ./*.h $(location dtc-parser.h)
-    """,
-)
-
-cc_library(
-    name = "dtc_gen",
-    srcs = [
-        ":lexer",
-        ":parser",
-    ],
-    hdrs = glob(["*.h"]),
-    copts = COPTS,
-    deps = [":libfdt"],
+    cmd = "bison -d -o $(location dtc-parser.c) $(location dtc-parser.y)",
 )
 
 UTILS = [
@@ -64,6 +46,8 @@
 cc_binary(
     name = "dtc",
     srcs = UTILS + [
+        ":dtc_lexer_srcs",
+        ":dtc_parser_srcs",
         "checks.c",
         "data.c",
         "dtc.c",
@@ -77,10 +61,7 @@
     ],
     copts = COPTS,
     defines = ["NO_YAML"],
-    deps = [
-        ":dtc_gen",
-        ":libfdt",
-    ],
+    deps = [":libfdt"],
 )
 
 cc_binary(