diff mbox series

[RFC,03/11] kbuild: pass KERNELVERSION and LOCALVERSION explicitly to setlocalversion

Message ID 20240819160309.2218114-4-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
These environment variables are passed when invoking 'make', but if
running 'make -n' we need to pass them explicitly so they become part
of the printed command.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Nicolas Schier Nov. 2, 2024, 9:07 p.m. UTC | #1
On Mon, Aug 19, 2024 at 06:03:00PM +0200 Vegard Nossum wrote:
> These environment variables are passed when invoking 'make', but if
> running 'make -n' we need to pass them explicitly so they become part
> of the printed command.
> 
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
>  Makefile | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index f09c036daf2f5..58f3843ccfac6 100644
--- a/Makefile
+++ b/Makefile
@@ -1165,7 +1165,10 @@  vmlinux: vmlinux.o $(KBUILD_LDS) modpost
 $(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ;
 
 ifeq ($(origin KERNELRELEASE),file)
-filechk_kernel.release = $(srctree)/scripts/setlocalversion $(srctree)
+filechk_kernel.release = \
+	KERNELVERSION="$(KERNELVERSION)" \
+	LOCALVERSION="$(LOCALVERSION)" \
+	$(srctree)/scripts/setlocalversion $(srctree)
 else
 filechk_kernel.release = echo $(KERNELRELEASE)
 endif