On Mon, Aug 19, 2024 at 06:02:59PM +0200 Vegard Nossum wrote: > When running 'make --dry-run', make will invoke itself recursively for > recipes using $(MAKE), but otherwise not execute the other commands in > a recipe. > > However, if a prerequisite is missing and 'make' does not how to create it > (which will be the case when running 'make -n'), it will complain with an > error message like this: > > $ make -n > ... > make -f ./scripts/Makefile.modpost > make[1]: *** No rule to make target 'modules.order', needed by 'modules-only.symvers'. Stop. > make: *** [Makefile:1868: modpost] Error 2 > > In this case, the top-level makefile has reached a recipe that ran 'make' > recursively on scripts/Makefile.modpost, which itself has a rule with > modules.order as a prerequisite. Since the file doesn't exist, and make > doesn't know how to create it, it errors out. > > We can document such prerequisites (which are expected to be created by > the parent Makefile) by adding them to the PHONY list of each respective > Makefile. > > Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx> > --- > arch/x86/boot/compressed/Makefile | 6 ++++++ > scripts/Makefile.modfinal | 5 +++++ > scripts/Makefile.modpost | 4 ++++ > scripts/Makefile.vmlinux | 7 +++++++ > scripts/Makefile.vmlinux_o | 3 +++ > 5 files changed, 25 insertions(+) > > diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile > index f2051644de943..ccef6f0e04bc7 100644 > --- a/arch/x86/boot/compressed/Makefile > +++ b/arch/x86/boot/compressed/Makefile > @@ -80,6 +80,9 @@ quiet_cmd_voffset = VOFFSET $@ > > targets += ../voffset.h > > +# We don't know how to build this A comment for documentation is a good idea, but I think this one is not very helpful to those who don't know the patch description. What about something like this? # Provided by a recursive-make predecessor Kind regards Nicolas