| 1 |
TESTMODS_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) |
| 2 |
KDIR ?= /lib/modules/$(shell uname -r)/build |
| 3 |
|
| 4 |
obj-m += test_klp_atomic_replace.o \ |
| 5 |
test_klp_callbacks_busy.o \ |
| 6 |
test_klp_callbacks_demo.o \ |
| 7 |
test_klp_callbacks_demo2.o \ |
| 8 |
test_klp_callbacks_mod.o \ |
| 9 |
test_klp_kprobe.o \ |
| 10 |
test_klp_livepatch.o \ |
| 11 |
test_klp_mod_patch.o \ |
| 12 |
test_klp_mod_target.o \ |
| 13 |
test_klp_shadow_vars.o \ |
| 14 |
test_klp_state.o \ |
| 15 |
test_klp_state2.o \ |
| 16 |
test_klp_state3.o \ |
| 17 |
test_klp_syscall.o |
| 18 |
|
| 19 |
# Ensure that KDIR exists, otherwise skip the compilation |
| 20 |
modules: |
| 21 |
ifneq ("$(wildcard $(KDIR))", "") |
| 22 |
$(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR) |
| 23 |
endif |
| 24 |
|
| 25 |
# Ensure that KDIR exists, otherwise skip the clean target |
| 26 |
clean: |
| 27 |
ifneq ("$(wildcard $(KDIR))", "") |
| 28 |
$(Q)$(MAKE) -C $(KDIR) clean KBUILD_EXTMOD=$(TESTMODS_DIR) |
| 29 |
endif |