#!/bin/sh
VER=`uname -r | cut -d. -f1,2`
KVER=`uname -r`

if [ $VER == "2.4" ]; then
	cp Makefile.2.4 Makefile
	if [ -f precompiled/ftcard-$KVER.o ]; then
                cp precompiled/ftcard-$KVER.o ftcard.o
                echo compile finished!
        else
		if [ -d /lib/modules/`uname -r`/build/include/linux ]; then
			make clean
			make 
			echo compile finished!
		else
			echo Please install kernel source!
		fi
	fi
fi

if [ $VER == "2.6" ]; then
	cp Makefile.2.6 Makefile
	if [ -f precompiled/ftcard-$KVER.ko ]; then
                cp precompiled/ftcard-$KVER.ko ftcard.ko
                echo compile finished!
        else
		if [ -d /lib/modules/`uname -r`/build/include/linux ]; then
			make clean
			make 
			echo compile finished!
		else
			echo Please install kernel source!
		fi
	fi
fi
