# building hdf5 utilities
# Mac-OSX 10.9.5 version gfortran v 4.2
# Ron Ghosh, November 2014
LROOT = ../lbo/
SRC = ../utisrc/
LIBP = $(LROOT)libpgplot.a -L/usr/X11R6/lib -lX11 
LIBH = $(LROOT)libhdf5_fortran.a $(LROOT)libhdf5.a
COML = gfortran -c 
LINK = gfortran 


all: h5pp h5nopp scannxs nxs2as runnex metnxs nx_names
h5pp: h5bits.o $(SRC)h5pp.f h5visc.o
	$(LINK) -o h5pp $(SRC)h5pp.f h5visc.o h5bits.o $(LIBH) -lz $(LIBP)
h5nopp: $(SRC)h5nopp.f h5bits.o $(LIBH)
	$(LINK) -o h5nopp $(SRC)h5nopp.f h5visc.o h5bits.o  $(LIBH)  -lz
metnxs: $(SRC)metnxs.f h5bits.o $(LIBH)
	$(LINK) -o metnxs $(SRC)metnxs.f  h5bits.o  $(LIBH)  -lz
runnex: $(SRC)runnex.f h5bits.o $(LIBH)
	$(LINK) -o runnex $(SRC)runnex.f h5visc.o h5bits.o  $(LIBH)  -lz
scannxs: $(SRC)scannxs.f h5bits.o
	$(LINK) -o scannxs $(SRC)scannxs.f h5bits.o $(LIBH) -lz
nxs2as: $(SRC)nxs2as.f h5bits.o sasanx.o
	$(LINK) -o nxs2as $(SRC)nxs2as.f sasanx.o h5bits.o $(LIBH) -lz
nx_names: $(SRC)nx_names.f h5bits.o 
	$(LINK) -o nx_names $(SRC)nx_names.f h5bits.o $(LIBH) -lz
sasanx.o: $(SRC)sasanx.f
	$(COML) $(SRC)sasanx.f
h5bits.o: $(SRC)h5bits.f90 hdf5.mod
	$(COML) $(SRC)h5bits.f90
h5visc.o: $(SRC)h5visc.c
	/usr/local/hdf5/bin/h5cc -c $(SRC)h5visc.c
clean:
	rm h5pp h5nopp scannxs nxs2as runnex metnxs h5bits.o h5visc.o sasanx.o \
	nx_names
	
	
		
