obj-m += lkm.o CC := gcc SOURCES := $(wildcard *.c) TARGETS := $(SOURCES:.c=.o) CFLAGS += -g CFLAGS += -O0 CFLAGS += -Wall CFLAGS += -Wextra all: $(TARGETS) run: leak ./leak.o %.o: %.c $(CC) $< $(CFLAGS) -o $@ lkm: make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean rm -f *.o insert: module insmod lkm.ko chmod 666 /dev/lkm remove: rmmod lkm