Makefile 743 B

1234567891011121314151617181920212223242526
  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_livepatch.o \
  9. test_klp_state.o \
  10. test_klp_state2.o \
  11. test_klp_state3.o \
  12. test_klp_shadow_vars.o \
  13. test_klp_syscall.o
  14. # Ensure that KDIR exists, otherwise skip the compilation
  15. modules:
  16. ifneq ("$(wildcard $(KDIR))", "")
  17. $(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
  18. endif
  19. # Ensure that KDIR exists, otherwise skip the clean target
  20. clean:
  21. ifneq ("$(wildcard $(KDIR))", "")
  22. $(Q)$(MAKE) -C $(KDIR) clean KBUILD_EXTMOD=$(TESTMODS_DIR)
  23. endif