#!/bin/bash
#
source_path="/lib/modules/`uname -r`/build"
#./clean
cp ${source_path}/.config ${source_path}/config.orig;
cp ${source_path}/.config .
sed -e '/CONFIG_FUSION=m/ c\CONFIG_FUSION=y' .config > config.new;
mv config.new .config
sed -e '/CONFIG_FUSION_MAX_SGE=40/ c\CONFIG_FUSION_MAX_SGE=128' .config > config.new;
mv config.new .config
if [ `grep -c CONFIG_FUSION_SPI .config` -eq 0 ]; then
	sed -e '/CONFIG_FUSION=/ a\CONFIG_FUSION_SPI=m' .config > config.new;
	mv -f config.new .config
fi;
if [ `grep -c CONFIG_FUSION_FC .config` -eq 0 ]; then
	sed -e '/CONFIG_FUSION=/ a\CONFIG_FUSION_FC=m' .config > config.new;
	mv -f config.new .config
fi;
if [ `grep -c CONFIG_FUSION_SAS .config` -eq 0 ]; then
	sed -e '/CONFIG_FUSION=/ a\CONFIG_FUSION_SAS=m' .config > config.new;
	mv -f config.new .config
fi;
sed -e '/CONFIG_FUSION_ISENSE/d' .config > config.new;
mv -f config.new ${source_path}/.config
rm -f .config
cp Makefile.for_testing Makefile
make -j3 CONFIG_DEBUG_INFO=1 V=1 -C /lib/modules/`uname -r`/build M=`pwd`
mv -f ${source_path}/config.orig ${source_path}/.config;
cp Makefile_builds Makefile
