2 # NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install
3 # this separately; see below.
7 show_usage_and_exit () {
8 echo -e "Usage: ${IDENT} <options> <compile|check|clean>"
11 echo -e "\t--file <config file>"
13 echo -e "\t--kernel <kernel path>"
14 echo -e "\t--arch <arm|i386>"
15 echo -e "\t[--toolchain <cross compile path>]"
19 TEMP=`getopt -o vk:t:a:f: --long verbose,kernel:,toolchain:,arch:,file: \
20 -n '${IDENT}' -- "$@"`
26 # Note the quotes around `$TEMP': they are essential!
31 CONFIG_FILE="build.config"
38 -v | --verbose ) VERBOSE=true; shift ;;
39 -k | --kernel ) KERNELDIR="$2"; shift 2 ;;
40 -t | --toolchain ) TOOLCHAIN="$2"; shift 2;;
41 -a | --arch ) ARCH="$2"; shift 2;;
42 -f | --file ) CONFIG_FILE="$2"; shift 2;;
48 if [ "${1}" != "compile" -a "${1}" != "clean" -a "${1}" != "check" ] ; then
52 if [ "${3}" != "" ] ; then
56 if [ -r ${CONFIG_FILE} ]; then
59 TOOLCHAIN=${toolchain}
65 if [ "${KERNELDIR}" = "" ] ; then
69 if [ "${ARCH}" = "arm" ] ; then
71 elif [ "${ARCH}" = "i386" ] ; then
80 CMDLINE_ARGS="CROSS_COMPILE=${TOOLCHAIN} ARCH=${ARCH} -C ${KERNELDIR}"
81 CMDLINE_ARGS="${CMDLINE_ARGS} M=${MDIR} MCFLAGS=${MCFLAGS} LINKNAME=${LINKNAME}"
83 if [ "${ACTION}" = "check" ] ; then
84 CMDLINE="make C=2 CF=\"-Wsparse-all\" ${CMDLINE_ARGS} modules"
85 elif [ "${ACTION}" = "clean" ] ; then
86 CMDLINE="make ${CMDLINE_ARGS} clean"
88 CMDLINE="make ${CMDLINE_ARGS} modules"
91 if [ ${VERBOSE} = "true" ] ; then
92 CMDLINE="${CMDLINE} V=1"
95 #echo -n "CMDLINE ${CMDLINE}\n"