ºìÁªLinuxÃÅ»§
Linux°ïÖú

±àÒë2.6.xÄÚºËÇý¶¯µÄmakefileÎļþ

·¢²¼Ê±¼ä:2008-09-25 00:51:30À´Ô´:ºìÁª×÷Õß:Yisitu
##Îļþ˵Ã÷£¬±àÒë2.6.xµÄlinuxÇý¶¯µÄmakefileÎļþ
# ×÷Õߣºwyj
# ´´½¨Ê±¼ä£º2008-09-23
##ʹÓÃ˵Ã÷£º
# ±äÁ¿DRI_NAME MOD_NAME NOD_NAME ·Ö±ðÉèÖÃαÇý¶¯³ÌÐòµÄÃû³Æ£¬Éú³ÉÄ£¿éµÄÃû³ÆºÍÉ豸½ÚµãµÄÃû³Æ
# ʹÓÃmake install½øÐа²×°Çý¶¯ ÐèÒªrootȨÏÞ
# ʹÓÃmake uninstall½øÐÐжÔØÇý¶¯ ÐèÒªrootȨÏÞ
# ʹÓÃmake cleanÇå³ý¶àÓàµÄÎļþ£¬°üÀ¨Éú³ÉµÄÄ£¿é´úÂë

# Çý¶¯Ãû³Æ
DRI_NAME :=demo
# Ä£¿éÃû³Æ
MOD_NAME :=IMTI_DEMO
# ½ÚµãÃû³Æ
NOD_NAME :=/dev/demo

obj-m :=$(DRI_NAME).o
KERNELDIR ?=/lib/modules/$(shell uname -r)/build
PWD ?=$(shell pwd)

default:
$(MAKE) -C ${KERNELDIR} M=${PWD} modules
#°²×°µÄα´úÂë
.PHONY:install uninstall clean
install:default
insmod demo.ko
mknod $(NOD_NAME) c `awk '$$2=="'${MOD_NAME}'" {print $$1}' /proc/devices` 0
#жÔصÄα´úÂë
uninstall:
rm -f $(NOD_NAME)
rmmod $(DRI_NAME)
#ÇåÀíÀ¬»øµÄα´úÂë
clean:
@rm -rf *.o *.ko .tmp_versions *~ Module.symvers .*.cmd *.mod.c
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. chris078426 ÓÚ 2008-09-25 14:22:11·¢±í:

    :0w5ty(1