#!/bin/sh
#====================================================================
#  NeXus - Neutron & X-ray Common Data Format
#  
#  $Id: nxbuild.in,v 1.1 2004/02/18 19:23:58 faa Exp $
#
#  scripts/nxbuild.  Generated from nxbuild.in by configure.
#  
#  Script for building NeXus applications
#
#  Copyright (C) 2004 Freddie Akeroyd
#  
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2 of the License, or (at your option) any later version.
# 
#  This library 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
#  Lesser General Public License for more details.
# 
#  You should have received a copy of the GNU Lesser General Public
#  License along with this library; if not, write to the Free 
#  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
#  MA  02111-1307  USA
#             
#  For further information, see <http://www.neutron.anl.gov/NeXus/>
#
#====================================================================
SHELL="/bin/sh"
srcdir="."
top_srcdir=".."
VPATH=":"
prefix="/usr/users/faa/nexus/installroot/usr/local"
exec_prefix="${prefix}"
bindir="${exec_prefix}/bin"
sbindir="${exec_prefix}/sbin"
libexecdir="${exec_prefix}/libexec"
datadir="${prefix}/share"
libdir="${exec_prefix}/lib"
infodir="${prefix}/info"
mandir="${prefix}/man"
includedir="${prefix}/include"
#pkgdatadir=$(datadir)/nexus
#pkglibdir=$(libdir)/nexus
#pkgincludedir=$(includedir)/nexus
#top_builddir=..
host_alias=""
host_triplet="i686-pc-linux-gnu"
CC="gcc"
F77="g77"
F90=""
F90FLAGS=""
H4ROOT="/usr/local/hdf"
H5ROOT=""
PACKAGE="nexus"
RANLIB="ranlib"
STRIP="strip"
VERSION="2.0.0"
LIBNEXUS="${top_srcdir}/src/libNeXus.a"
LIBNEXUS77="libNeXus77.a"
LIBNEXUS90="libNeXus90.a"
CFLAGS="-g -O2 -fno-common"
FFLAGS="-g -O2"
DEFS="-DHAVE_CONFIG_H"
CPPFLAGS=" -I/usr/local/hdf/include -DHDF4 -I../include"
LDFLAGS=" -L/usr/local/hdf/lib"
LIBS="-lmfhdf -ldf -ljpeg -lz "

OBJS=""
TARGET="a.out"
while [ $# -ne 0 ]; do
    case $1 in
	-o)
	    shift
	    TARGET=$1
	    ;;
	*.f90)
	    $F90 $F90FLAGS -c $1
	    OBJS="$OBJS `basename $1 .f90`.o"
            ;;
	*.c)
	    $CC $CPPFLAGS $DEFS $CFLAGS -c $1
	    OBJS="$OBJS `basename $1 .c`.o"
            ;;
	*.f)
	    $F77 $F77FLAGS -c $1
	    OBJS="$OBJS `basename $1 .f`.o"
            ;;
	--help|-h)
	    echo "usage: nxbuild [-o target] file [file...]"
	    echo "usage: nxbuild --help"
	    echo "usage: nxbuild --version"
	    exit
	    ;;
	--version|-V)
	    echo 'nxbuild $Revision: 1.1 $ for NeXus release' $VERSION
	    echo "Type   nxbuild --help   for usage"
	    exit
	    ;;
	*)		# *.o, *.a etc
	    OBJS="$OBJS $1"
	    ;;
    esac
    shift
done
$CC -o $TARGET $LDFLAGS $OBJS $LIBNEXUS $LIBS
