Skip to content

Commit

Permalink
kmod/patch: clean only rebuildable objs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
joe-lawrence authored and sm00th committed Oct 1, 2021
1 parent 607ee53 commit 6673c69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kmod/patch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 6673c69

Please sign in to comment.