module_name := XXXX
# if KERNELRELEASE is defined, it builds with
# the whole kernel. So use kbuild syntax
ifneq ($(KERNELRELEASE),)
obj-m := $(module_name).o
# otherwise, it's a pure kernel module
# built in a running kernel
else
KERNELDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
.PHONY:clean dist
clean: dist
rm -r $(module_name).ko
dist:
rm -rf $(module_name).o $(module_name).mod.* \
modules.order Module.symvers \
.$(module_name)* .tmp_versions
阅读(1050) | 评论(0) | 转发(0) |