
if [ "x$1" == "xinstall" ]
then

  cd jhead/libjhead
  if [ -e Makefile.interface ];
  then
    make -f Makefile.interface install
  else
    make install
  fi;
elif [ "x$1" == "xclean" ]
then

  cd jhead; make clean
  rm -r *.o core* *~

  cd libjhead; make clean
  rm -r .ui .moc .obj ../../../lib/libjhead*
  rm Makefile* Makefile core*

  cd jheadGui; make clean
  rm -r .ui .moc .obj jheadGui
  rm Makefile* core*

else
  CORES=`cat /proc/cpuinfo | grep processor | wc -l`
  if [ $# -gt 0 ]; then
    if [ $1 -eq $1 2> /dev/null ]; then
      CORES=$1
    fi;
  fi;

  QMAKE=$QTDIR/bin/qmake
  if [ ! -e $QMAKE ]; then
    QMAKE=qmake
  fi;

  cd jhead/libjhead
  $QMAKE -o Makefile.tmp
  sed "10 s,^,QTDIR = $QTDIR\n," Makefile.tmp > Makefile
  make -j $CORES

  cd jheadGui
  $QMAKE -o Makefile.tmp
  sed "10 s,^,QTDIR = $QTDIR\n," Makefile.tmp > Makefile
  make -j $CORES

fi;

