#!/bin/sh
#you can compile QPxTool simply by run "make"
#if it fails (mostly because your QT paths differs from my) try this script

#qmakeparms="INCLUDEPATH+= ../lib/qpxtransport/include ../lib/qpxplextor/include ../lib/qpxscan/include LIBS+=-lqpxtransport -lqpxplextor -lqpxscan"

bin="qpxtool"
if [ -r $bin.pro ] ; then
    echo "project file found..."
else
    qmake -project "INCLUDEPATH+= ../lib/qpxtransport/include ../lib/qpxplextor/include ../lib/qpxpioneer/include ../lib/qpxscan/include" "LIBS+=-lqpxtransport -lqpxplextor -lqpxpioneer -lqpxscan" "LIBPATH+=../lib/lib"
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
    mv $bin ../bin

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