Linux驱动编程--基于I2C子系统的I2C驱动的Makefile

ifeq ($(KERNELRELEASE),)



KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd) TEST = test modules: $(MAKE) -C $(KERNELDIR) M=$(PWD) clean: rm -rvf *.ko *.o *.mod.c Module* module* test: gcc $(TEST).c -o $(TEST) mknod: sudo mknod /dev/my_hello c 365 0 insmod: sudo insmod my_hello.ko .PHONY:modules clean mknod test insmod else obj-m := 你的驱动文件名.o endif

你可能感兴趣的:(makefile)