#!/usr/bin/env bash
#author: lzh
#echo `pwd`
if test -z $1;then
	echo "./make.sh -[sources]"
	exit 1
fi
echo "prepare"
if [ ! -d "./out" ];then
	mkdir out
	echo "mkdir out"
fi
echo "prepare finish \n compile"
resource="/sources/$1"
tmp=`echo ${resource} | sed -e "s:sources:out:g"`
out=`echo ${tmp} | sed "s:.c:\.o:g"`
outPath=`dirname ${out}`
if [ ! -d "`pwd`${outPath}" ];then
	mkdir `pwd`${outPath}
	echo "mkdir `pwd`${outPath}"
fi
gcc -g `pwd`${resource} -o `pwd`${out}
echo "finish"
