summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2024-11-27 14:10:57 -0800
committerLuis Chamberlain <mcgrof@kernel.org>2024-11-28 11:17:07 -0800
commit7ea13556f7d287fb55f7cacc316ff7647550c702 (patch)
treed05b51e518532b4d077d5bee532952337d6ec4bc /lib
parentb86545e02e8c22fb89218f29d381fa8e8b91d815 (diff)
selftests: kallsyms: fix double build stupidity
The current arrangement will have the test modules rebuilt on any make without having the script or code actually change. Take Masahiro Yamada's suggested fix and cleanups on the Makefile to fix this. Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Fixes: 84b4a51fce4ccc66 ("selftests: add new kallsyms selftests") Closes: https://lore.kernel.org/all/CAK7LNATRDODmfz1tE=inV-DQqPA4G9vKH+38zMbaGdpTuFWZFw@mail.gmail.com/T/#me6c8f98e82acbee6e75a31b34bbb543eb4940b15 Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/module/Makefile17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/tests/module/Makefile b/lib/tests/module/Makefile
index af5c27b996cb..2f3e1a772c2c 100644
--- a/lib/tests/module/Makefile
+++ b/lib/tests/module/Makefile
@@ -3,13 +3,12 @@ obj-$(CONFIG_TEST_KALLSYMS_B) += test_kallsyms_b.o
obj-$(CONFIG_TEST_KALLSYMS_C) += test_kallsyms_c.o
obj-$(CONFIG_TEST_KALLSYMS_D) += test_kallsyms_d.o
-$(obj)/%.c: FORCE
- @$(kecho) " GEN $@"
- $(Q)$(srctree)/lib/tests/module/gen_test_kallsyms.sh $@\
- $(CONFIG_TEST_KALLSYMS_NUMSYMS) \
- $(CONFIG_TEST_KALLSYMS_SCALE_FACTOR)
+quiet_cmd_gen_test_kallsyms = GEN $@
+ cmd_gen_test_kallsyms = $< $@ \
+ $(CONFIG_TEST_KALLSYMS_NUMSYMS) \
+ $(CONFIG_TEST_KALLSYMS_SCALE_FACTOR)
-clean-files += test_kallsyms_a.c
-clean-files += test_kallsyms_b.c
-clean-files += test_kallsyms_c.c
-clean-files += test_kallsyms_d.c
+$(obj)/%.c: $(src)/gen_test_kallsyms.sh FORCE
+ $(call if_changed,gen_test_kallsyms)
+
+targets += $(foreach x, a b c d, test_kallsyms_$(x).c)