Re: [PATCH 1/1] kbuild: record real-prereqs in .cmd files
Nathan Chancellor <[email protected]>
| Newsgroups | org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <178708267641.2113250.8208366109143651745.b4-review@b4> |
> Record $(real-prereqs), the non-phony prerequisites of the target, in a > new metadata field: > > make_prereqs_<target> := <prerequisites> > > Write the field from both cmd_and_savecmd and cmd_and_fixdep. > > Update scripts/make_fit.py to read only savedcmd_* instead of parsing the > complete .cmd file. > > Ignore make_prereqs_* in KernelSbom. > > Link: https://lore.kernel.org/r/[email protected] > Assisted-by: Cursor:GPT-5.6 Sol > Co-developed-by: Maximilian Huber <[email protected]> > Signed-off-by: Maximilian Huber <[email protected]> > Signed-off-by: Luis Augenstein <[email protected]> > > diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include > index 8c311b997e24..6daa244ba0ef 100644 > --- a/scripts/Kbuild.include > +++ b/scripts/Kbuild.include > @@ -181,6 +181,9 @@ endif > # (needed for the shell) > make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))) > > +# prerequisites to record in .cmd files, excluding those covered in deps_* > +cmd-prereqs = $(call escsq,$(filter-out $(deps_$@), $(real-prereqs))) Sashiko has a comment that this produces different results based on a clean versus incremental build: https://sashiko.dev/#/patchset/59032 I can reproduce this with: $ make -skj"$(nproc)" ARCH=x86_64 mrproper defconfig lib/oid_registry.o $ grep -n oid_registry_data lib/.oid_registry.o.cmd 3:make_prereqs_lib/oid_registry.o := lib/oid_registry.c lib/oid_registry_data.c 1111: lib/oid_registry_data.c \ $ touch lib/oid_registry.c $ make -skj"$(nproc)" ARCH=x86_64 lib/oid_registry.o $ grep -n oid_registry_data lib/.oid_registry.o.cmd 1111: lib/oid_registry_data.c \ As this is just metadata for external tools (i.e., it does not get consumed by Kbuild again), we could just require them to filter duplicates after the fact? -- Cheers, Nathan