#!/bin/bash
#
# usage:  compile-c source_file
#
if [ -z "$1" ]
then
    echo usage is `basename $0` source-file
    exit 1
fi
if [ ! -f "$1" ]
then
    echo file $1 not found
    exit 2
fi
# options for compiling and linking
compile_opts="-Wall -pedantic -O -std=c99"
link_opts="-lm"

touch $1
pgm=`basename $1 .c`
CFLAGS=${compile_opts} LDFLAGS=${link_opts} make $pgm


