Skip to content

Instantly share code, notes, and snippets.

@ychsiao168
Created April 18, 2023 01:47
Show Gist options
  • Save ychsiao168/351cda3eefd98fe2e8f85e8d18b1c442 to your computer and use it in GitHub Desktop.
Save ychsiao168/351cda3eefd98fe2e8f85e8d18b1c442 to your computer and use it in GitHub Desktop.
kernel module Makefile Template
#===============================================================================
# Description: kernel module Makefile Template
#===============================================================================
#===============================================================================
# Project VARS
#===============================================================================
PWD := $(shell pwd)
KVERSION := $(shell uname -r)
KERNEL_DIR := /usr/src/linux-headers-$(KVERSION)/
MOD_NAME := foo
#===============================================================================
# rules
#===============================================================================
obj-m := $(MOD_NAME).o
all:
make -C $(KERNEL_DIR) M=$(PWD) modules
clean:
make -C $(KERNEL_DIR) M=$(PWD) clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment