view ctobinnotify @ 187:5e752cf2d6b1

Add versions of compile and ctobin scripts that have desktop notifications
author Mike Pavone <pavone@retrodev.com>
date Fri, 07 Oct 2011 00:11:30 -0700
parents
children
line wrap: on
line source

#!/bin/sh

if test ! -f "$1.c"; then
	echo "C file missing! Maybe you need to do a full compile?"
	exit 1
fi

cp runtime/* build/
cp "$1.c" build/
cd build
bin=`echo $1 | sed s/\.rhope//`

if test -f "$bin"; then
	rm "$bin"
fi

if test -z $CC; then
	CC="gcc"
fi

file=$1
shift
echo "$CC -o $bin $@ $file.c blueprint.c context.c fixed_alloc.c object.c transaction.c net.c"
$CC -o $bin $@ "$file.c" blueprint.c context.c fixed_alloc.c object.c transaction.c net.c 2>&1 | tee cc_output.txt

if test -f "$bin"; then
	notify-send -i dialog-ok 'Compilation complete' "Compilation of $file to native code completed successfully"
else
	cc_errors=`grep error cc_output.txt | head -n 3`
	notify-send -i error 'Compilation failed' "Compilation of $file to native code from C failed. Details\n$cc_errors"
fi
cd ..