# Makefile 2.4
KDIR=/lib/modules/$(shell uname -r)/build
OBJS=mymodule.o
CFLAGS=-D__KERNEL__ -I$(KDIR)/include -DMODULE -D_KERNEL_SYSCALLS__ -DEXPORT_SYMTAB -O2 -fomit-frame-pointer -Wall -DMODVERSIONS -include $(KDIR)/include/linux/modversions.h
all:$(OBJS)
mymodule.o:file1.o file2.o
ld -r -o $@ $^
clean:
rm -f *.o
# Makefile 2.6
ifneq ($(KERNELRELEASE),)
obj-m:=mymodule.o
else
PWD:=$(shell pwd)
KDIR:=/lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD)
clean:
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions
endif