# building hdf5 utilities
# mingw32 version gfortran v 4.5
# Ron Ghosh, November 2014
LROOT = ../lbm/
SRC = ../utisrc/
LIBP = $(LROOT)libpgplot.a -mconsole -mwindows 
LIBH = $(LROOT)libhdf5_fortran.a $(LROOT)libhdf5.a
COML = gfortran -c 
LINK = gfortran 


all: h5pp.exe h5nopp.exe scannxs.exe nxs2as.exe runnex.exe metnxs.exe nx_names.exe
h5pp.exe: h5bits.o $(SRC)h5pp.f h5visc.o
	$(LINK) -static -o h5pp $(SRC)h5pp.f h5visc.o h5bits.o $(LIBH) -lz $(LIBP)
h5nopp.exe: $(SRC)h5nopp.f h5bits.o $(LIBH)
	$(LINK) -static -o h5nopp $(SRC)h5nopp.f h5visc.o h5bits.o  $(LIBH)  -lz
metnxs.exe: $(SRC)metnxs.f h5bits.o h5visc.o $(LIBH)
	$(LINK) -static -o metnxs $(SRC)metnxs.f  h5bits.o  $(LIBH)  -lz
runnex.exe: $(SRC)runnex.f h5bits.o $(LIBH)
	$(LINK) -static -o runnex $(SRC)runnex.f h5visc.o h5bits.o  $(LIBH)  -lz
scannxs.exe: $(SRC)scannxs.f h5bits.o
	$(LINK) -static -o scannxs $(SRC)scannxs.f h5bits.o $(LIBH) -lz
nxs2as.exe: $(SRC)nxs2as.f h5bits.o sasanx.o
	$(LINK) -static -o nxs2as $(SRC)nxs2as.f sasanx.o h5bits.o $(LIBH) -lz
nx_names.exe: $(SRC)nx_names.f h5bits.o sasanx.o
	$(LINK) -static -o nx_names $(SRC)nx_names.f sasanx.o h5bits.o $(LIBH) -lz
sasanx.o: $(SRC)sasanx.f
	$(COML) $(SRC)sasanx.f
# h5bits.o is best built fro c:\h5bld directory because hdf5.mod is interminably
# slow to read across network; hence omit from clean...

h5bits.o: $(SRC)h5bits.f90 hdf5.mod
	$(COML) $(SRC)h5bits.f90
clean:
	rm h5pp.exe h5nopp.exe scannxs.exe nx2as.exe runnex.exe metnxs.exe \
	sasanx.o 
	

	
		
