Skip to content

Commit 29128da

Browse files
t-8chshuahkh
authored andcommitted
kunit: Always descend into kunit directory during build
For kbuild to properly clean up these build artifacts in the subdirectory, even after CONFIG_KUNIT changed do disabled, the directory needs to be processed always. Pushing the special logic for hook.o into the kunit Makefile also makes the logic easier to understand. Link: https://lore.kernel.org/r/20250813-kunit-always-descend-v1-1-7bbd387ff13b@linutronix.de Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 8f5ae30 commit 29128da

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

lib/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ test_fpu-y := test_fpu_glue.o test_fpu_impl.o
109109
CFLAGS_test_fpu_impl.o += $(CC_FLAGS_FPU)
110110
CFLAGS_REMOVE_test_fpu_impl.o += $(CC_FLAGS_NO_FPU)
111111

112-
# Some KUnit files (hooks.o) need to be built-in even when KUnit is a module,
113-
# so we can't just use obj-$(CONFIG_KUNIT).
114-
ifdef CONFIG_KUNIT
115112
obj-y += kunit/
116-
endif
117113

118114
ifeq ($(CONFIG_DEBUG_KOBJECT),y)
119115
CFLAGS_kobject.o += -DDEBUG

lib/kunit/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ kunit-objs += debugfs.o
1717
endif
1818

1919
# KUnit 'hooks' are built-in even when KUnit is built as a module.
20-
obj-y += hooks.o
20+
obj-$(if $(CONFIG_KUNIT),y) += hooks.o
2121

2222
obj-$(CONFIG_KUNIT_TEST) += kunit-test.o
2323
obj-$(CONFIG_KUNIT_TEST) += platform-test.o

0 commit comments

Comments
 (0)