两个编译2.4与2.6内核模块的Makefile 模板(支持交叉编译)

 

Makefile for linux 2.4 kernel

TARGET  := modulename

INCLUDE := -I/opt/celinux-040503/include

CFLAGS  := -O2 -Wall -DMODULE -D__KERNEL__ -DLINUX

CC  := arm-926ejs-linux-gcc

 

${TARGET}.o: ${TARGET}.c

$(CC) $(CFLAGS) ${INCLUDE} -c ${TARGET}.c

 

 

Makefile for linux 2.6 kernel

obj-m += modulename.o

#EXTRA_CFLAGS += -I/linux-2.6.19.2-mx/drivers/media/video/

 

KDIR := /linux-2.6.19.2

PWD:= $(shell pwd)

CROSS_ARCH := ARCH=arm CROSS_COMPILE=arm-926ejs-linux-

default:

    $(MAKE) $(CROSS_ARCH) -C $(KDIR) SUBDIRS=$(PWD) modules

 

 

clean:

    $(MAKE) $(CROSS_ARCH) -C $(KDIR) SUBDIRS=$(PWD) clean

    -@rm -f Module.symvers

你可能感兴趣的:(linux,shell,include,makefile)