Makefile 764 B

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