diff mbox series

[RFC,10/11] kbuild: don't test for file presence in --dry-run mode

Message ID 20240819160309.2218114-11-vegard.nossum@oracle.com (mailing list archive)
State New
Headers show
Series output a valid shell script when running 'make -n' | expand

Commit Message

Vegard Nossum Aug. 19, 2024, 4:03 p.m. UTC
I'm not really sure if this is correct as I'm not sure under which
circumstances the files tested for with $(wildcard) would NOT be
present. I'm not even sure if this is the right approach to take.

However, it _should_ keep working the same as before for regular
'make' invocations and is necessary for 'make --dry-run' to work.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 scripts/Makefile.modpost | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nicolas Schier Nov. 14, 2024, 10:48 a.m. UTC | #1
On Mon, Aug 19, 2024 at 06:03:07PM +0200, Vegard Nossum wrote:
> I'm not really sure if this is correct as I'm not sure under which
> circumstances the files tested for with $(wildcard) would NOT be
> present. I'm not even sure if this is the right approach to take.
> 
> However, it _should_ keep working the same as before for regular
> 'make' invocations and is necessary for 'make --dry-run' to work.

This might become interesting.  Makefile.modpost is called in several
different situations (e.g. in-tree kernel build, single target builds,
out-of-tree module builds), and if we want to get full shell script
output with --dry-run for all these situations, this probably has to be
refactored in more depth.

Kind regards,
Nicolas
diff mbox series

Patch

diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 65f2bdc702369..139fa0b087b6d 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -99,7 +99,7 @@  modpost-args += -t $(addprefix -u , $(ksym-wl))
 modpost-deps += $(ksym-wl)
 endif
 
-ifeq ($(wildcard vmlinux.o),)
+ifeq ($(or $(wildcard vmlinux.o), $(dry_run)),)
 missing-input := vmlinux.o
 output-symdump := modules-only.symvers
 else
@@ -119,7 +119,7 @@  include $(kbuild-file)
 
 output-symdump := $(KBUILD_EXTMOD)/Module.symvers
 
-ifeq ($(wildcard Module.symvers),)
+ifeq ($(or $(wildcard Module.symvers), $(dry_run)),)
 missing-input := Module.symvers
 else
 modpost-args += -i Module.symvers