################################################################## # makefile for via raid # Copyright VIA Technologies, Inc. # Optional parameters: KERNELDIR DEBUG BOOT # Example # make -e KERNELDIR=/usr/src/linux2.4 BOOT=1 # will compile a driver for boot kernel ,kernel source code is /usr/src/linux2.4 directory. ################################################################### ifndef KERNELDIR KERNELDIR = /usr/src/linux endif KERNEL_VER=`uname -r` #Here is the chip related information PREDEF = -DVIA_LINUX -DMULTIPLE_CARD_SUPPORT MOD = viamraid VIALIBBASE = viaprvraidm ifeq ($(KERNELDIR)/.config, $(wildcard $(KERNELDIR)/.config)) include $(KERNELDIR)/.config endif VIALIB=$(VIALIBBASE).o COMPOPT = -DMODULE -D__KERNEL__=1 -O ifndef NOMODVER COMPOPT += -DMODVERSIONS endif OBJS = viapubraid.o SRC = viapubraid.c HEADERS = viapubraid.h viaprvdef.h cc=gcc ifeq ($(BOOT), 1) COMPOPT += -D__BOOT_KERNEL_BOOT=1 endif #patch for RedHat7.2 #ifeq ($(BOOT), 1) #ifeq ($(RH72), 1) #ifndef ATHLON #COMPOPT += -D__MODULE_KERNEL_i686=1 #else #COMPOPT += -D__MODULE_KERNEL_athlon=1 #endif #endif #endif #patch ends ifeq ($(DEBUG), 1) COMPOPT += -DVIARAID_DEBUG=1 endif ifdef CONFIG_X86_64 PREDEF += -mcmodel=kernel PREDEF += -D_WIN64 -DX86_64 VIALIB=$(VIALIBBASE)64.o endif INCLS =-I$(KERNELDIR)/include -I$(KERNELDIR)/include/asm -I$(KERNELDIR)/drivers/scsi CFLAGS = $(PREDEF) $(COMPOPT) $(INCLS) -Wall all:$(MOD).o $(MOD).o: $(OBJS) $(VIALIB) ld -r $^ -o $(MOD).o viapubraid.o: $(SRC) $(HEADERS) $(cc) -c $(CFLAGS) viapubraid.c install: find /lib/modules/$(KERNEL_VER) -name $(MOD).o -exec rm '{}' ';' install -m 555 -D $(MOD).o /lib/modules/$(KERNEL_VER)/misc/$(MOD).o depmod -a modprobe $(MOD) clean: rm -f $(OBJS) rm -f $(MOD).o