0001-core-Show-all-conflicting-rules-in-one-go.patch
· 1.9 KiB · Diff
Raw
From e379af626325b9aa96d7fe2a7fb51a17f49ed8a7 Mon Sep 17 00:00:00 2001
From: inferno0230 <[email protected]>
Date: Thu, 27 Aug 2026 03:40:37 +0530
Subject: [PATCH] core: Show all conflicting rules in one go
Signed-off-by: inferno0230 <[email protected]>
---
core/base_rules.mk | 6 ++++--
core/main.mk | 9 +++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/core/base_rules.mk b/core/base_rules.mk
index a736ea48a4..c3105e15f8 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -317,9 +317,11 @@ endif
module_id := MODULE.$(if \
$(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
ifdef $(module_id)
-$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
-endif
+duplicate_module_ids := $(duplicate_module_ids) $(module_id)
+duplicate_module_paths.$(module_id) := $(duplicate_module_paths.$(module_id)) $(LOCAL_PATH)
+else
$(module_id) := $(LOCAL_PATH)
+endif
# These are the same as local-intermediates-dir / local-generated-sources dir, but faster
intermediates.COMMON := $($(my_prefix)OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
diff --git a/core/main.mk b/core/main.mk
index 09639aba7c..a9fc7864bc 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -315,6 +315,15 @@ define pretty-error
$(error $(1))
endef
+# Report duplicate module definitions together instead of stopping at the first
+# one encountered while including module makefiles.
+ifneq ($(strip $(duplicate_module_ids)),)
+$(foreach m,$(sort $(duplicate_module_ids)), \
+ $(foreach p,$(sort $(duplicate_module_paths.$(m))), \
+ $(warning $(p): $(m) already defined by $($(m)))))
+$(error Found $(words $(duplicate_module_ids)) duplicate module definition(s))
+endif
+
# -------------------------------------------------------------------
# Enforce to generate all RRO packages for modules having resource
# overlays.
--
2.55.0
| 1 | From e379af626325b9aa96d7fe2a7fb51a17f49ed8a7 Mon Sep 17 00:00:00 2001 |
| 2 | From: inferno0230 <[email protected]> |
| 3 | Date: Thu, 27 Aug 2026 03:40:37 +0530 |
| 4 | Subject: [PATCH] core: Show all conflicting rules in one go |
| 5 | |
| 6 | Signed-off-by: inferno0230 <[email protected]> |
| 7 | --- |
| 8 | core/base_rules.mk | 6 ++++-- |
| 9 | core/main.mk | 9 +++++++++ |
| 10 | 2 files changed, 13 insertions(+), 2 deletions(-) |
| 11 | |
| 12 | diff --git a/core/base_rules.mk b/core/base_rules.mk |
| 13 | index a736ea48a4..c3105e15f8 100644 |
| 14 | --- a/core/base_rules.mk |
| 15 | +++ b/core/base_rules.mk |
| 16 | @@ -317,9 +317,11 @@ endif |
| 17 | module_id := MODULE.$(if \ |
| 18 | $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name) |
| 19 | ifdef $(module_id) |
| 20 | -$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id))) |
| 21 | -endif |
| 22 | +duplicate_module_ids := $(duplicate_module_ids) $(module_id) |
| 23 | +duplicate_module_paths.$(module_id) := $(duplicate_module_paths.$(module_id)) $(LOCAL_PATH) |
| 24 | +else |
| 25 | $(module_id) := $(LOCAL_PATH) |
| 26 | +endif |
| 27 | |
| 28 | # These are the same as local-intermediates-dir / local-generated-sources dir, but faster |
| 29 | intermediates.COMMON := $($(my_prefix)OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates |
| 30 | diff --git a/core/main.mk b/core/main.mk |
| 31 | index 09639aba7c..a9fc7864bc 100644 |
| 32 | --- a/core/main.mk |
| 33 | +++ b/core/main.mk |
| 34 | @@ -315,6 +315,15 @@ define pretty-error |
| 35 | $(error $(1)) |
| 36 | endef |
| 37 | |
| 38 | +# Report duplicate module definitions together instead of stopping at the first |
| 39 | +# one encountered while including module makefiles. |
| 40 | +ifneq ($(strip $(duplicate_module_ids)),) |
| 41 | +$(foreach m,$(sort $(duplicate_module_ids)), \ |
| 42 | + $(foreach p,$(sort $(duplicate_module_paths.$(m))), \ |
| 43 | + $(warning $(p): $(m) already defined by $($(m))))) |
| 44 | +$(error Found $(words $(duplicate_module_ids)) duplicate module definition(s)) |
| 45 | +endif |
| 46 | + |
| 47 | # ------------------------------------------------------------------- |
| 48 | # Enforce to generate all RRO packages for modules having resource |
| 49 | # overlays. |
| 50 | -- |
| 51 | 2.55.0 |
| 52 | |
| 53 |