#!/bin/bash
#
# Simple shell script for building SPLAT! and associated utilities.
# Written by John A. Magliacane, KD2BD May 2002 -- Last update: Jan 2004
#

build_splat()
{
	echo -n "Compiling SPLAT!... "
	g++ -Wall -O3 -s -lm -lbz2 -fomit-frame-pointer itm.cpp splat.cpp -o splat
	echo "Done!"
}

build_utils()
{
	cd utils
	./build all
	cd ..
}

if [ $# == "0" ]; then
	echo "Usage: build  { splat, utils, all }"
else

	if [ $1 == "splat" ]; then
		build_splat
	fi

	if [ $1 == "utils" ]; then
		build_utils
	fi

	if [ $1 == "all" ]; then
		build_splat
		build_utils
	fi

	if [ $1 != "splat" ] && [ $1 != "utils" ] && [ $1 != "all" ]; then
		echo "Usage: build { splat, utils, all }"
	fi
fi

