#!/bin/sh 

#      /*
#       *  pb_gcc
#       *
#       *  Copyright (c) 2007 by Kuscsik Peter <kuscsikp@gmail.com>
#       *
#       *  This program is free software; you can redistribute it and/or modify
#       *  it under the terms of the GNU General Public License as published by
#       *  the Free Software Foundation; either version 2 of the License, or
#       *  (at your option) any later version.
#       *
#       *  This program is distributed in the hope that it will be useful,
#       *  but WITHOUT ANY WARRANTY; without even the implied warranty of
#       *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       *  GNU General Public License for more details.
#       *
#       *  You should have received a copy of the GNU General Public License
#       *  along with this program; if not, write to the Free Software
#       *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
#       *  USA.
#       */ 

if [ $# = "0" ]			#no parameters
then
	echo "pb_gcc 0.0.3a, Peter Kuscsik, 2008"
	echo "Experimental release, use at your own risk!"
	echo
	echo "Use:	\"pb_gcc --opt-flags\" to display optimisation flags"
	echo "	\"pb_gcc [options] file\" to compile with optimisation flags"
fi


if [ -f "procbench" ]
then
  	flag=$(./procbench -f)
else
   	if [ -f "/usr/bin/procbench" ]
	then
		flag=$(procbench -f)
	else
		echo "Procbench not found!"
		exit 1
	fi
fi

if [ "$1" = "--opt-flags" ]
	then
	echo $flag
	exit 0
fi

if [ $# != "0" ]			#if no parameters
then
	g++ $flag $@
fi






