Message ID | 20220406153023.500847-3-masahiroy@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kbuild: more misc cleanups | expand |
On Wed, Apr 6, 2022 at 8:31 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > Precisely speaking, when you get the stem of the path, you should use > $(patsubst $(obj)/%,%,...) instead of $(notdir ...). > > I do not see this usecase, but if you create a composite object in a > subdirectory, the Makefile should look like this: > > obj-$(CONFIG_FOO) += dir/foo.o > dir/foo-objs := dir/foo1.o dir/foo2.o > > The member objects should be assigned to dir/foo-objs instead of > foo-objs. > > This syntax is more consistent with commit 54b8ae66ae1a ("kbuild: > change *FLAGS_<basetarget>.o to take the path relative to $(obj)"). > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Thanks for the patch! Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > --- > > scripts/Makefile.lib | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib > index d56cda3c1e8a..0453a1904646 100644 > --- a/scripts/Makefile.lib > +++ b/scripts/Makefile.lib > @@ -236,9 +236,9 @@ endif > # Usage: > # $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add) > define multi_depend > -$(foreach m, $(notdir $1), \ > - $(eval $(obj)/$m: \ > - $(addprefix $(obj)/, $(call suffix-search, $m, $2, $3)))) > +$(foreach m, $1, \ > + $(eval $m: \ > + $(addprefix $(obj)/, $(call suffix-search, $(patsubst $(obj)/%,%,$m), $2, $3)))) > endef > > # Copy a file > -- > 2.32.0 >
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index d56cda3c1e8a..0453a1904646 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -236,9 +236,9 @@ endif # Usage: # $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add) define multi_depend -$(foreach m, $(notdir $1), \ - $(eval $(obj)/$m: \ - $(addprefix $(obj)/, $(call suffix-search, $m, $2, $3)))) +$(foreach m, $1, \ + $(eval $m: \ + $(addprefix $(obj)/, $(call suffix-search, $(patsubst $(obj)/%,%,$m), $2, $3)))) endef # Copy a file
Precisely speaking, when you get the stem of the path, you should use $(patsubst $(obj)/%,%,...) instead of $(notdir ...). I do not see this usecase, but if you create a composite object in a subdirectory, the Makefile should look like this: obj-$(CONFIG_FOO) += dir/foo.o dir/foo-objs := dir/foo1.o dir/foo2.o The member objects should be assigned to dir/foo-objs instead of foo-objs. This syntax is more consistent with commit 54b8ae66ae1a ("kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj)"). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- scripts/Makefile.lib | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)