多个C源文件编译成一个内核模块之makefile模板
Sometimes it makes sense to divide a kernel module between several source files. Lets say you have 2 source files :
start.c and stop.c
you can create a Makefile like this :
obj-m += startstop.o
startstop-objs := start.o stop.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean