字符设备编译makefile

#AR = ar
ARCH = arm
CC = /opt/gcc-linaro-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
#DEBFLAGS=-O2
obj-m:=simple.o
KERNELDIR?=/opt/workspace/zz/linux-nand-3.2.0
PWD     :=$(shell pwd)
modules:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../include modules
clean:

        rm -rf *.o *.ko


例子2


obj-m:=hello.o
KERNELDIR:=/opt/workspace/zz/linux-nand-3.2.0
PWD:=$(shell pwd)
modules:                                                                                         
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install




clean:
        rm -rf *.o *.ko
~                            


ifneq ($(KERNELRELEASE),)
# call from kernel build system
scull-objs := main.o pipe.o access.o

obj-m   := scull.o

else

KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)

modules:
        $(MAKE)  -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../include modules 

endif

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chinazhangzhong123/article/details/51559369
上一篇linux编译出错
下一篇嵌入式Linux字符设备驱动LED驱动编写
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭