#!/bin/sh
#you can compile QPxTool simply by run "make"
#if it fails (mostly because your QT paths differs from my) try this script
inspath=/usr/bin
bin="pxcontrol"
if [ -r $bin.pro ] ; then
    echo "project file found..."
else
    qmake -project
fi
qmake	# this will regenerate Makefile - enable, if you have compilation problems

#b_os=`uname -s`
#b_release=`uname -r`
#b_version=`uname -v`
#b_machine=`uname -m`
#b_node=`uname -n`

#echo "// This file generated by \"build\" script
#
##define b_os      \"$b_os\"
##define b_release \"$b_release\"
##define b_version \"$b_version\"
##define b_machine \"$b_machine\"
##define b_node    \"$b_node\"
#" > buildhost.h

make
if [ "$?" == "0" ] ; then

    strip --strip-unneeded $bin
#chown root $bin  # this needed to get full functionality
    cp $bin $inspath/$bin
    chmod 4755 $inspath/$bin       # of Plextor features

    echo "*****************************************"
    echo "   $bin binary ready:)"
    echo "	 type qpxtool to run"
    echo "*****************************************"
else
    echo "*****************************************"
    echo "	failed to compile $bin"
    echo "*****************************************"
fi
