Skip to content

Instantly share code, notes, and snippets.

@artynet
Forked from garyachy/Makefile
Created March 29, 2019 20:12
Show Gist options
  • Save artynet/55df1b7f381585157911165c33abb6be to your computer and use it in GitHub Desktop.
Save artynet/55df1b7f381585157911165c33abb6be 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