Skip to content

Instantly share code, notes, and snippets.

@garyachy
Created August 27, 2016 15:22
Show Gist options
  • Save garyachy/1dc7fcb52bde291cece426f4e49b52de to your computer and use it in GitHub Desktop.
Save garyachy/1dc7fcb52bde291cece426f4e49b52de to your computer and use it in GitHub Desktop.
Linux kernel module makefile
ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules EXTRA_CFLAGS="-g -DDEBUG"
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
.PHONY: modules modules_install clean
else
# called from kernel build system: just declare what our modules are
obj-m := netdev.o
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment