Allow boards to turn overriding commands into an error

Many boards have warnings like this, saying that we defined a build
rule, but later something else came in and overrode it with something
else:

art/build/Android.gtest.mk:677: warning: overriding commands for target `test-art-target-gtest-cmdline_parser_test'
art/build/Android.gtest.mk:674: warning: ignoring old commands for target `test-art-target-gtest-cmdline_parser_test'

Beyond the obvious problem of replacing the rule with something else,
target-specific variables can be combined as well, leading to some very
strange problems.

Since so many boards still have problems like this, but we don't
currently have any global problems, add a flag so that we can mark
boards as not broken. This should prevent regressions while we clean up
the individual problems.

Once the non-broken devices number significantly more than the broken
devices, we'll switch this default. And once they're all cleaned up this
variable will become obsolete, and these warnings will always be errors.

Bug: 77611511
Test: lunch aosp_arm-eng; m nothing
Test: lunch aosp_marlin-eng; m nothing
Test: build_test on all downstream branches
Change-Id: I43b645658f468c23a5b9ebcfcd9d4516537db540
diff --git a/core/config.mk b/core/config.mk
index b3a204b..b3f3d36 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -190,6 +190,12 @@
 endif
 
 # ###############################################################
+# Broken build defaults
+# ###############################################################
+# Assume that all boards have duplicate rules right now.
+BUILD_BROKEN_DUP_RULES := true
+
+# ###############################################################
 # Include sub-configuration files
 # ###############################################################
 
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 70c78a8..9bf3c8b 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -69,4 +69,6 @@
 TARGET_NO_RECOVERY := true
 BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
 
-BOARD_VNDK_VERSION := current
\ No newline at end of file
+BOARD_VNDK_VERSION := current
+
+BUILD_BROKEN_DUP_RULES := false
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index be8ea39..dbdec90 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -101,3 +101,5 @@
 BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
 
 BOARD_VNDK_VERSION := current
+
+BUILD_BROKEN_DUP_RULES := false
diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk
index 2052d7b..fa4c355 100644
--- a/target/board/generic_mips64/BoardConfig.mk
+++ b/target/board/generic_mips64/BoardConfig.mk
@@ -91,3 +91,5 @@
 # Enable A/B update
 TARGET_NO_RECOVERY := true
 BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+
+BUILD_BROKEN_DUP_RULES := false
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index f71e72b..3760cc4 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -63,6 +63,8 @@
 
 BOARD_VNDK_VERSION := current
 
+BUILD_BROKEN_DUP_RULES := false
+
 # Enable A/B update
 TARGET_NO_RECOVERY := true
 BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index a9c5142..ec7a51e 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -65,3 +65,5 @@
 # Enable A/B update
 TARGET_NO_RECOVERY := true
 BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+
+BUILD_BROKEN_DUP_RULES := false
diff --git a/target/board/treble_common.mk b/target/board/treble_common.mk
index a8c9bc5..187022e 100644
--- a/target/board/treble_common.mk
+++ b/target/board/treble_common.mk
@@ -58,3 +58,5 @@
 $(error BOARD_AVB_ENABLE cannot be set for Treble GSI)
 endif
 BOARD_BUILD_DISABLED_VBMETAIMAGE := true
+
+BUILD_BROKEN_DUP_RULES := false