[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9b52e26748eda1ac108d569207bf428bf37b3bbc.1690489039.git.falcon@tinylab.org>
Date: Fri, 28 Jul 2023 04:26:03 +0800
From: Zhangjin Wu <falcon@...ylab.org>
To: thomas@...ch.de, w@....eu
Cc: falcon@...ylab.org, arnd@...db.de, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: [PATCH v3 04/12] selftests/nolibc: string the core targets
To avoid run targets one by one manually and boringly, let's string them
with IMAGE and .config, the MAKE command will trigger the dependencies
for us.
Note, defconfig target is only triggered while the .config is not there,
it means only trigger defconfig for the first run or after a mrproper.
Suggested-by: Willy Tarreau <w@....eu>
Link: https://lore.kernel.org/lkml/20230725142017.37103-1-falcon@tinylab.org/
Signed-off-by: Zhangjin Wu <falcon@...ylab.org>
---
tools/testing/selftests/nolibc/Makefile | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index f5680b9ed85c..3a61fa7e42a0 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -153,6 +153,7 @@ all: run
sysroot: sysroot/$(ARCH)/include
+PHONY = sysroot/$(ARCH)/include
sysroot/$(ARCH)/include:
$(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot
$(QUIET_MKDIR)mkdir -p sysroot
@@ -205,14 +206,21 @@ defconfig:
$(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(objtree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c))
$(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG="$(KERNEL_CONFIG)" allnoconfig
-kernel: initramfs
+PHONY += $(KERNEL_CONFIG)
+$(KERNEL_CONFIG):
+ $(Q)if [ ! -f "$(KERNEL_CONFIG)" ]; then $(MAKE) --no-print-directory defconfig; fi
+
+kernel: $(KERNEL_CONFIG)
+ $(Q)$(MAKE) --no-print-directory initramfs
$(Q)$(MAKE_KERNEL) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs
# common macros for qemu run/rerun targets
QEMU_SYSTEM_RUN = qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(KERNEL_IMAGE)" -serial stdio $(QEMU_ARGS)
# run the tests after building the kernel
-run: kernel
+PHONY += $(KERNEL_IMAGE)
+$(KERNEL_IMAGE): kernel
+run: $(KERNEL_IMAGE)
$(Q)$(QEMU_SYSTEM_RUN) > "$(RUN_OUT)"
$(Q)$(REPORT) "$(RUN_OUT)"
@@ -237,4 +245,4 @@ clean:
$(call QUIET_CLEAN, run.out)
$(Q)rm -rf run.out
-.PHONY: sysroot/$(ARCH)/include
+.PHONY: $(PHONY)
--
2.25.1
Powered by blists - more mailing lists