lkml.org 
[lkml]   [2022]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 6/7] kbuild: make *.mod not depend on *.o
Date
From: Nick Desaulniers
> Sent: 07 April 2022 18:59
>
> On Wed, Apr 6, 2022 at 8:31 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > The dependency
> >
> > $(obj)/%.mod: $(obj)/%$(mod-prelink-ext).o
> >
> > ... exists because *.mod files previously contained undefined symbols,
> > which are computed from *.o files when CONFIG_TRIM_UNUSED_KSYMS=y.
> >
> > Now that the undefined symbols are put into separate *.usyms files,
> > there is no reason to make *.mod depend on *.o files.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> > Makefile | 3 ++-
> > scripts/Makefile.build | 5 ++---
> > 2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 82ee893909e9..e915aacd02b0 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1792,7 +1792,8 @@ ifdef single-build
> >
> > # .ko is special because modpost is needed
> > single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
> > -single-no-ko := $(sort $(patsubst %.ko,%.mod, $(MAKECMDGOALS)))
> > +single-no-ko := $(filter-out $(single-ko), $(MAKECMDGOALS)) \
> > + $(foreach x, o mod, $(patsubst %.ko, %.$x, $(single-ko)))
>
> I'm on board with this patch, and the overall goal with the series. My
> brain is having a hard time parsing `o mod` though. Can you walk me
> through that? Are those targets for .o and .mod files, respectively?

I think I'd do:
single-no-ko := $(filter-out $(single-ko), $(MAKECMDGOALS))
single-no-ko += $(patsubst %.ko, %.o, $(single-ko))
single-no-ko += $(patsubst %.ko, %.mod, $(single-ko))

Although you can use the simpler SYSV make suffix substitution syntax:
single-no-ko += $(single-ko:.ko=.o) $(single-ko:.ko=.mod)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
\
 
 \ /
  Last update: 2022-04-07 23:40    [W:1.180 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site