xref: /linux/tools/testing/selftests/livepatch/test_modules/Makefile (revision c34e9ab9a612ee8b18273398ef75c207b01f516d)
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 \
9*62597edfSMichael Vetter	test_klp_kprobe.o \
10c4bbe83dSMarcos Paulo de Souza	test_klp_livepatch.o \
11*62597edfSMichael Vetter	test_klp_shadow_vars.o \
12c4bbe83dSMarcos Paulo de Souza	test_klp_state.o \
13c4bbe83dSMarcos Paulo de Souza	test_klp_state2.o \
14c4bbe83dSMarcos Paulo de Souza	test_klp_state3.o \
156a717704SMarcos Paulo de Souza	test_klp_syscall.o
16c4bbe83dSMarcos Paulo de Souza
1754ee3526SMarcos Paulo de Souza# Ensure that KDIR exists, otherwise skip the compilation
18c4bbe83dSMarcos Paulo de Souzamodules:
1954ee3526SMarcos Paulo de Souzaifneq ("$(wildcard $(KDIR))", "")
20c4bbe83dSMarcos Paulo de Souza	$(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
2154ee3526SMarcos Paulo de Souzaendif
22c4bbe83dSMarcos Paulo de Souza
2354ee3526SMarcos Paulo de Souza# Ensure that KDIR exists, otherwise skip the clean target
24c4bbe83dSMarcos Paulo de Souzaclean:
2554ee3526SMarcos Paulo de Souzaifneq ("$(wildcard $(KDIR))", "")
26c4bbe83dSMarcos Paulo de Souza	$(Q)$(MAKE) -C $(KDIR) clean KBUILD_EXTMOD=$(TESTMODS_DIR)
2754ee3526SMarcos Paulo de Souzaendif
28