From 6673c693d6a02efd90293fd9e648f30a7c0be17c Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Fri, 24 Jul 2020 15:33:28 -0400 Subject: [PATCH] kmod/patch: clean only rebuildable objs Relax the clean target to leave the kpatch-build generated output.o file. This is helpful after invoking kpatch-build in debug mode and rebuilding $CACHEDIR/tmp/patch in a debugging session. Signed-off-by: Joe Lawrence --- kmod/patch/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kmod/patch/Makefile b/kmod/patch/Makefile index 2e53ab1..bb4d49c 100644 --- a/kmod/patch/Makefile +++ b/kmod/patch/Makefile @@ -2,6 +2,9 @@ KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(PWD) CFLAGS_MODULE='$(CFLAGS_MODULE)' LDFLAGS += $(KPATCH_LDFLAGS) +# object files that this Makefile can (re)build on its own +BUILDABLE_OBJS=$(filter-out output.o, $(wildcard *.o)) + obj-m += $(KPATCH_NAME).o ldflags-y += -T $(src)/kpatch.lds targets += kpatch.lds @@ -19,5 +22,5 @@ patch-hook.o: patch-hook.c kpatch-patch-hook.c livepatch-patch-hook.c $(KPATCH_MAKE) patch-hook.o clean: - $(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions *.o *.ko *.mod.c \ + $(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions $(BUILDABLE_OBJS) *.ko *.mod.c \ Module.symvers