2014-02-13 16:04:35 +00:00
|
|
|
# make rules
|
2014-03-05 17:31:15 +00:00
|
|
|
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
|
2018-02-16 10:18:28 +00:00
|
|
|
KERNELRELEASE := $(lastword $(subst /, , $(dir $(patsubst %/,%,$(KPATCH_BUILD)))))
|
2014-02-18 04:37:07 +00:00
|
|
|
THISDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
|
|
|
|
|
|
|
ifeq ($(wildcard $(KPATCH_BUILD)),)
|
2016-02-08 16:46:06 +00:00
|
|
|
$(error $(KPATCH_BUILD) doesn\'t exist. Try installing the kernel-devel-$(KERNELRELEASE) RPM or linux-headers-$(KERNELRELEASE) DEB.)
|
2014-02-18 04:37:07 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(THISDIR)
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2014-03-13 18:02:28 +00:00
|
|
|
kpatch.ko: core.c
|
2014-02-11 16:25:48 +00:00
|
|
|
$(KPATCH_MAKE) kpatch.ko
|
|
|
|
|
|
|
|
all: kpatch.ko
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions *.o *.ko *.mod.c \
|
|
|
|
Module.symvers
|
2014-02-13 16:04:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
# kbuild rules
|
|
|
|
obj-m := kpatch.o
|
2014-08-29 16:27:33 +00:00
|
|
|
kpatch-y := core.o shadow.o
|