目前小弟常用的兩種寫法,敬供參考。
KERNEL_VERSION := `uname -r`
$(KERNEL_SRC)
KERNEL_DIR := /lib/modules/$(KERNEL_VERSION)/build
#KERNEL_DIR :=CROSS_COMPILE := arm-linux-
PWD := $(shell pwd)
obj-m := snd-dummy.o
snd-dummy-objs := dummy.o
all: snd-dummy
snd-dummy:
@echo "Building a dummy driver..."
@(make -C $(KERNEL_DIR) M=$(PWD) CROSS_COMPILE=$(CROSS_COMPILE) modules)
clean:
-rm -f *.o *.ko .*.cmd .*.flags *.mod.c Module.symvers modules.order tags
-rm -rf .tmp_versions
ifneq ($(KERNELRELEASE),)
obj-m :=dummy
.o
elseKERNEL_VERSION := `uname -r`
$(KERNEL_SRC)
KERNEL_DIR := /lib/modules/$(KERNEL_VERSION)/build
#KERNEL_DIR :=
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
rm -r .tmp_versions *.mod.c .*.cmd *.o *.ko
endif
沒有留言:
張貼留言