#====================================================================
#  NeXus - Neutron & X-ray Common Data Format
#  
#  Makefile for building the NeXus library with the HDF5 libraries
#  
#  Copyright (C) 2002 Mark Koennecke
#  
#  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.nexusformat.org>
#
# $Id: Makefile,v 2.00 2001/27/07 11:00:02
#
#====================================================================

#Edit "makefile_options" to set compiler flags
include makefile_options

LIBNEXUS_OBJ=napi.o napif.o
TEST5_OBJ=napi5_test.o
NXBROWSE_OBJ=NXbrowse.o
NXTOXML_OBJ=NXtoXML.o
NXTODTD_OBJ=NXtoDTD.o
NOPT=-DHDF5

all: libNeXus.a napi5_test napif_test NXbrowse NXtoXML NXtoDTD

.c.o :
	$(CC) $(CFLAGS) $(NOPT) -I$(H5ROOT)/include -c $(FROOT)/$*.c
.f.o:
	$(FC) $(FFLAGS) -c $(FROOT)/$*.f

libNeXus.a : $(LIBNEXUS_OBJ)
	@echo "*** Creating NeXus interface based on HDF5 library (libNeXus.a) ***"
	- rm $@
	ar -cr $@ $(LIBNEXUS_OBJ)
	ranlib $@

napi5_test: libNeXus.a $(TEST5_OBJ) 
	$(CC) $(CFLAGS) -o napi5_test $(TEST5_OBJ) $(FROOT)/libNeXus.a \
	-L$(H5ROOT)/lib -lhdf5 -lz 
		
napif_test: libNeXus.a napif_test.o
	$(FC) $(FFLAGS) -o napif_test napif_test.o $(FROOT)/libNeXus.a \
	-L$(H5ROOT)/lib -lhdf5 -lz

NXbrowse: libNeXus.a $(NXBROWSE_OBJ) 
	$(CC) $(CFLAGS) -o NXbrowse $(NXBROWSE_OBJ) $(FROOT)/libNeXus.a \
	-L$(H5ROOT)/lib -lhdf5 -lz

NXtoXML: libNeXus.a $(NXTOXML_OBJ) 
	$(CC) $(CFLAGS) -o NXtoXML $(NXTOXML_OBJ) $(FROOT)/libNeXus.a \
	-L$(H5ROOT)/lib -lhdf5 -lz

NXtoDTD: libNeXus.a $(NXTODTD_OBJ) 
	$(CC) $(CFLAGS) -o NXtoDTD $(NXTODTD_OBJ) $(FROOT)/libNeXus.a \
	-L$(H5ROOT)/lib -lhdf5 -lz 

	
