xref: /linux/tools/testing/selftests/livepatch/test_modules/Makefile (revision 54ee3526796f56c249124686a33e1cc05f76ea21)
1c4bbe83dSMarcos Paulo de SouzaTESTMODS_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
2c4bbe83dSMarcos Paulo de SouzaKDIR ?= /lib/modules/$(shell uname -r)/build
3c4bbe83dSMarcos Paulo de Souza
4c4bbe83dSMarcos Paulo de Souzaobj-m += test_klp_atomic_replace.o \
5c4bbe83dSMarcos Paulo de Souza	test_klp_callbacks_busy.o \
6c4bbe83dSMarcos Paulo de Souza	test_klp_callbacks_demo.o \
7c4bbe83dSMarcos Paulo de Souza	test_klp_callbacks_demo2.o \
8c4bbe83dSMarcos Paulo de Souza	test_klp_callbacks_mod.o \
9c4bbe83dSMarcos Paulo de Souza	test_klp_livepatch.o \
10c4bbe83dSMarcos Paulo de Souza	test_klp_state.o \
11c4bbe83dSMarcos Paulo de Souza	test_klp_state2.o \
12c4bbe83dSMarcos Paulo de Souza	test_klp_state3.o \
136a717704SMarcos Paulo de Souza	test_klp_shadow_vars.o \
146a717704SMarcos Paulo de Souza	test_klp_syscall.o
15c4bbe83dSMarcos Paulo de Souza
16*54ee3526SMarcos Paulo de Souza# Ensure that KDIR exists, otherwise skip the compilation
17c4bbe83dSMarcos Paulo de Souzamodules:
18*54ee3526SMarcos Paulo de Souzaifneq ("$(wildcard $(KDIR))", "")
19c4bbe83dSMarcos Paulo de Souza	$(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
20*54ee3526SMarcos Paulo de Souzaendif
21c4bbe83dSMarcos Paulo de Souza
22*54ee3526SMarcos Paulo de Souza# Ensure that KDIR exists, otherwise skip the clean target
23c4bbe83dSMarcos Paulo de Souzaclean:
24*54ee3526SMarcos Paulo de Souzaifneq ("$(wildcard $(KDIR))", "")
25c4bbe83dSMarcos Paulo de Souza	$(Q)$(MAKE) -C $(KDIR) clean KBUILD_EXTMOD=$(TESTMODS_DIR)
26*54ee3526SMarcos Paulo de Souzaendif
27