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.
Showing the changes to lib/kunit (1 of 2 files). Show all
Unified · Split
| @@ -17,7 +17,7 @@ kunit-objs += debugfs.o · 16 unmodified lines | ||
| 17 | 17 | endif |
| 18 | 18 | |
| 19 | 19 | # 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 | |
| 21 | 21 | |
| 22 | 22 | obj-$(CONFIG_KUNIT_TEST) += kunit-test.o |
| 23 | 23 | obj-$(CONFIG_KUNIT_TEST) += platform-test.o |