[1/5] kbuild: treat an object as multi-used when $(foo-) is set

Message ID 20190806063923.1266-2-yamada.masahiro@socionext.com
State Accepted
Commit 33e84f2e79659e410c379b530dac57779f201d15
Headers show
Series
  • kbuild: allow big modules to sub-divide Makefiles
Related show

Commit Message

Masahiro Yamada Aug. 6, 2019, 6:39 a.m.
Currently, Kbuild treats an object as multi-used when any of
$(foo-objs), $(foo-y), $(foo-m) is set. It makes more sense to
check $(foo-) as well.

In the context of foo-$(CONFIG_FOO_FEATURE1), CONFIG_FOO_FEATURE1
could be unset.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 scripts/Makefile.lib | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.17.1

Comments

Masahiro Yamada Aug. 19, 2019, 2:53 p.m. | #1
On Tue, Aug 6, 2019 at 3:40 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>

> Currently, Kbuild treats an object as multi-used when any of

> $(foo-objs), $(foo-y), $(foo-m) is set. It makes more sense to

> check $(foo-) as well.

>

> In the context of foo-$(CONFIG_FOO_FEATURE1), CONFIG_FOO_FEATURE1

> could be unset.

>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


Only this patch applied for now.


> ---

>

>  scripts/Makefile.lib | 10 +++++-----

>  1 file changed, 5 insertions(+), 5 deletions(-)

>

> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib

> index 41c50f9461e5..0a540599823e 100644

> --- a/scripts/Makefile.lib

> +++ b/scripts/Makefile.lib

> @@ -41,9 +41,9 @@ obj-m         := $(filter-out %/, $(obj-m))

>  # Subdirectories we need to descend into

>  subdir-ym      := $(sort $(subdir-y) $(subdir-m))

>

> -# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object

> -multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))

> -multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m))))

> +# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object

> +multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))), $(m))))

> +multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(m))))

>  multi-used   := $(multi-used-y) $(multi-used-m)

>

>  # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to

> @@ -52,8 +52,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y))

>

>  # Replace multi-part objects by their individual parts,

>  # including built-in.a from subdirectories

> -real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))

> -real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))

> +real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))

> +real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))

>

>  # DTB

>  # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built

> --

> 2.17.1

>



-- 
Best Regards
Masahiro Yamada

Patch

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 41c50f9461e5..0a540599823e 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -41,9 +41,9 @@  obj-m		:= $(filter-out %/, $(obj-m))
 # Subdirectories we need to descend into
 subdir-ym	:= $(sort $(subdir-y) $(subdir-m))
 
-# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object
-multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
-multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m))))
+# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object
+multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))), $(m))))
+multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(m))))
 multi-used   := $(multi-used-y) $(multi-used-m)
 
 # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
@@ -52,8 +52,8 @@  subdir-obj-y := $(filter %/built-in.a, $(obj-y))
 
 # Replace multi-part objects by their individual parts,
 # including built-in.a from subdirectories
-real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
-real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
+real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
+real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
 
 # DTB
 # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built