ANDROID: bazel: Fix dtc header dependencies
As dtc compiles util.c, which includes util.h and version_non_gen.h
(or version_gen.h upstream), the cc_binary should list those
dependencies explicitly so that a change in them triggers a rebuild.
Furthermore, dtc also depends on dtc.h and srcpos.h, which are only
found as dependencies by Bazel through the overkill glob(["*.h"]) header
list of dtc_gen so list them explicitly here so that that cc_library can
be dropped.
Introduce the UTILS list to DRY the build file.
Test: bazel build //:dtc
Change-Id: I32076c65b60820dc91f6dc84c3ee3cad310c1db5
diff --git a/BUILD.bazel b/BUILD.bazel
index 439621d..8a65ba8 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -55,18 +55,25 @@
deps = [":libfdt"],
)
+UTILS = [
+ "util.c",
+ "util.h",
+ "version_non_gen.h",
+]
+
cc_binary(
name = "dtc",
- srcs = [
+ srcs = UTILS + [
"checks.c",
"data.c",
"dtc.c",
+ "dtc.h",
"flattree.c",
"fstree.c",
"livetree.c",
"srcpos.c",
+ "srcpos.h",
"treesource.c",
- "util.c",
],
copts = COPTS,
defines = ["NO_YAML"],
@@ -78,11 +85,8 @@
cc_binary(
name = "fdtget",
- srcs = [
+ srcs = UTILS + [
"fdtget.c",
- "util.c",
- "util.h",
- "version_non_gen.h",
],
copts = COPTS,
defines = ["NO_YAML"],
@@ -91,11 +95,8 @@
cc_binary(
name = "fdtput",
- srcs = [
+ srcs = UTILS + [
"fdtput.c",
- "util.c",
- "util.h",
- "version_non_gen.h",
],
copts = COPTS,
defines = ["NO_YAML"],
@@ -104,11 +105,8 @@
cc_binary(
name = "fdtdump",
- srcs = [
+ srcs = UTILS + [
"fdtdump.c",
- "util.c",
- "util.h",
- "version_non_gen.h",
],
copts = COPTS,
defines = ["NO_YAML"],
@@ -117,11 +115,8 @@
cc_binary(
name = "fdtoverlay",
- srcs = [
+ srcs = UTILS + [
"fdtoverlay.c",
- "util.c",
- "util.h",
- "version_non_gen.h",
],
copts = COPTS,
defines = ["NO_YAML"],