2014-02-13 03:53:05 +00:00
|
|
|
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
|
2021-08-02 21:36:17 +00:00
|
|
|
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(PWD) CFLAGS_MODULE='$(CFLAGS_MODULE)'
|
2017-01-23 20:43:43 +00:00
|
|
|
LDFLAGS += $(KPATCH_LDFLAGS)
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2020-07-24 19:33:28 +00:00
|
|
|
# object files that this Makefile can (re)build on its own
|
|
|
|
BUILDABLE_OBJS=$(filter-out output.o, $(wildcard *.o))
|
|
|
|
|
2017-09-20 20:30:00 +00:00
|
|
|
obj-m += $(KPATCH_NAME).o
|
2018-11-14 14:09:34 +00:00
|
|
|
ldflags-y += -T $(src)/kpatch.lds
|
2020-12-04 11:29:55 +00:00
|
|
|
targets += kpatch.lds
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2018-12-07 15:46:08 +00:00
|
|
|
$(KPATCH_NAME)-objs += patch-hook.o output.o
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2017-09-20 20:30:00 +00:00
|
|
|
all: $(KPATCH_NAME).ko
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2017-09-20 20:30:00 +00:00
|
|
|
$(KPATCH_NAME).ko:
|
2018-12-07 15:46:08 +00:00
|
|
|
$(KPATCH_MAKE)
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2020-12-04 11:29:55 +00:00
|
|
|
$(obj)/$(KPATCH_NAME).o: $(src)/kpatch.lds
|
|
|
|
|
2015-01-22 17:05:52 +00:00
|
|
|
patch-hook.o: patch-hook.c kpatch-patch-hook.c livepatch-patch-hook.c
|
2015-01-22 00:28:31 +00:00
|
|
|
$(KPATCH_MAKE) patch-hook.o
|
2014-02-11 16:25:48 +00:00
|
|
|
|
|
|
|
clean:
|
2020-07-24 19:33:28 +00:00
|
|
|
$(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions $(BUILDABLE_OBJS) *.ko *.mod.c \
|
2014-02-11 16:25:48 +00:00
|
|
|
Module.symvers
|