[PATCH 5/5] selftests/nolibc: generate config automatically

From: Thomas Weißschuh
Date: Tue Oct 10 2023 - 08:34:37 EST


This new target generates a .config if none exists yet.

Also drop the defconfig target with its hidden call to 'mrproper' which
is fairly invasive.
If users want to overwrite their kernel existing kernel configuration
they can do so easily from the toplevel directory.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
tools/testing/selftests/nolibc/Makefile | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 21e3f7da2ecf..5a3623680f1a 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -173,7 +173,7 @@ all: run

sysroot: sysroot/$(ARCH)/include

-sysroot/$(ARCH)/include:
+sysroot/$(ARCH)/include: $(objtree)/.config
$(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot
$(QUIET_MKDIR)mkdir -p sysroot
$(Q)$(MAKE) -C $(srctree) outputmakefile
@@ -216,13 +216,13 @@ initramfs: nolibc-test
$(call QUIET_INSTALL, initramfs/init)
$(Q)cp nolibc-test initramfs/init

-defconfig:
- $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare
+$(objtree)/.config:
+ $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(DEFCONFIG)

-kernel:
+kernel: $(objtree)/.config
$(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME)

-kernel-standalone: initramfs
+kernel-standalone: $(objtree)/.config initramfs
$(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs

# run the tests after building the kernel

--
2.42.0