- obj-m := module.o
- KERNELDIR := /lib/modules/$(shell uname -r)/build
- PWD := $(shell pwd)
- default:
- $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
- clean:
- rm -f *.o *.ko *.mod.c modules.* Module.*
- obj-m := module.o
- module-objs += file1.o
- module-objs += file2.o
- module-objs += file3.o
- KERNELDIR := /lib/modules/$(shell uname -r)/build
- PWD := $(shell pwd)
- default:
- $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
- clean:
- rm -f *.o *.ko *.mod.c modules.* Module.*
编译选项定义: -C 到指定目录下读取Makefile M 执行当前目录下的Makefile