#!/bin/bash

# Author: Eric Moore<eric.moore@lsi.com>
# Date: January 8, 2008
# Name: compile
# Description: A script compiling the driver source.


# enable scripting debug
# set -x

KERNEL="`uname -r`"

# Sparse - a semantic parser, provides a set of annotations designed to convey
# semantic information about types, such as what address space pointers point
# to, or what locks a function acquires or releases. You can obtain the latest
# sparse code by typing the following command:
# git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git

# Set SPARSE to non-zero value to enable sparse checking
SPARSE=0

rm -fr output.log
./clean
ctags -R *

if [ ${SPARSE} == 0 ] ; then
	make -j4 CONFIG_DEBUG_INFO=1 -C /lib/modules/${KERNEL}/build \
		M=`pwd` 2>&1 | tee output.log
else
	make C=2 CONFIG_DEBUG_INFO=1 -C /lib/modules/${KERNEL}/build \
		M=`pwd` 2>&1 | tee output.log
fi;
