linux 內核模塊makefile通用模板

ifneq ($(KERNELRELEASE),)
# 在 mylist 後面添加須要編譯的模塊數量 mylist
=hello.o a.o
# 爲每個模塊添加所需的文件 hello
-objs := main.o a.o b.o
a-objs:= a.o
obj
-m:=$(mylist) else #generate the path CURRENT_PATH:=$(shell pwd) #the absolute path LINUX_KERNEL_PATH:=/lib/modules/$(shell uname -r)/build #complie object default: make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules clean: make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean endif
相關文章
相關標籤/搜索