linux device driver .ko module Makefile 模板

#
# Makefile module first.ko
#

CROSS_PATH:=../../mips-4.3/bin
CROSS_ARCH:=ARCH=mips CROSS_COMPILE=$(CROSS_PATH)/mips-linux-gnu-
DEVICE=first

ifneq ($(KERNELRELEASE),)
 obj-m:=$(DEVICE).o
 $(DEVICE)-objs:=file1.o file2.o
else
 KERNELDIR=../../kernel_2.6.18
 PWD:=$(shell pwd)

default:
 $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
endif

clean:
 $(shell rm -f *.bak)
 $(shell rm -f *.o)
 $(shell rm -f *.mod.c)
 $(shell rm -f *.order)
 $(shell rm -f *.symvers)
 $(shell rm -f *.ko)

fcp:
 cp -f *.ko /pub/NFS_Root/home/alex/module/
 chmod 755 /pub/NFS_Root/home/alex/module/*.ko
 @echo "*_*  ^_^  @_@  #_#  &_&  |-_-|  *_*"

你可能感兴趣的:(linux device driver .ko module Makefile 模板)