History

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.

Thomas Weißschuh committed 1 year ago

Commit 29128da1 parent 8f5ae302 files · +1 −5Browse files

Unified · Split

2 files
  1. lib/Makefile +0 −4
  2. lib/kunit/Makefile +1 −1
lib/Makefile+0−4
@@ -109,11 +109,7 @@ test_fpu-y := test_fpu_glue.o test_fpu_impl.o · 108 unmodified lines
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+1−1
@@ -17,7 +17,7 @@ kunit-objs += debugfs.o · 16 unmodified lines
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