LDD-Makefile模板

745阅读 0评论2009-07-09 yuchuan2008
分类:LINUX

# Comment/uncomment the following line to enable/disable debugging
#DEBUG = y

ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DSCULLC_DEBUG # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2
endif
 
###############################################  add for my linux cross-complete enviroment start yc
CROSS=arm-uclibc-linux-
CC  = $(CROSS)gcc
AR := $(CROSS)ar -rv
###############################################  add for my linux cross-complete enviroment over yc
 
CFLAGS += $(DEBFLAGS) -I$(LDDINC)

#modify with your project
TARGET = scullc
#modify with your project

ifneq ($(KERNELRELEASE),)

###############################################  modify with your project
scullc-objs := main.o
obj-m := scullc.o
###############################################  modify with your project

else
 

###############################################  modify the kernel for my enviromentstart yc
KERNELDIR ?= /home/yc/workspace/dev/linux/kernel/linux-2.6.14
###############################################  modify the kernel for my enviromentstart yc
 

PWD       := $(shell pwd)
modules:
 $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD) modules
endif

install:
 install -d $(INSTALLDIR)
 install -c $(TARGET).o $(INSTALLDIR)
clean:
 rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

depend .depend dep:
 $(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
上一篇:Kbuild Makefile简要总结
下一篇:https://www.google.com/adsense/login/zh_CN/?gsessi