内核模块Makefile模板:
模块源文件只两个C文件组成:main.c add.c
# --------------------------------------------------------------------------------------------------------------
ifneg ($(KERNELRELEASE), )
obj-m := hello.o
hello.o-objs := main.o add.o
else
KDIR := /lib/modules/2.6.18-53.e15/build # the directory of kernel's source code
all:
make -C $(KDIR) M=$(PWD) modules # M=$(WPD) specify the directory of module's source code
clean:
rm -f *.ko *.o *.mod *.mod.c *.symvers
endif
# --------------------------------------------------------------------------------------------------------------