# interpose.ko — out-of-tree kernel module build.
#
# Standard Kbuild M= invocation. Requires the running kernel's headers:
#
#   sudo apt install linux-headers-$(uname -r)     # Debian / Ubuntu
#   sudo dnf install kernel-devel                  # Fedora
#
# `sudo interpose doctor --fix` will install the headers for you on
# Debian-family systems (v0.30.13+).
#
# Build:
#   make
#
# Load / unload (root):
#   sudo insmod interpose.ko
#   sudo rmmod  interpose
#   dmesg | tail   # confirms "interpose: kernel module loaded" line
#
# v0.30.16 ships a DKMS .deb that does this automatically per kernel
# upgrade. Until then, manual build is the path.

obj-m := interpose.o

KDIR ?= /lib/modules/$(shell uname -r)/build
PWD  := $(shell pwd)

.PHONY: all clean install

all:
	$(MAKE) -C $(KDIR) M=$(PWD) modules

clean:
	$(MAKE) -C $(KDIR) M=$(PWD) modules clean

install:
	$(MAKE) -C $(KDIR) M=$(PWD) modules_install
	depmod -a
