# Makefile for gtool4/libsrc/netcdf

OBJS=netcdf.o netcdf_v3.o netcdf_error.o netcdf_filename.o \
	netcdf_file.o netcdf_dimension.o netcdf_variable.o \
	netcdf_attribute.o netcdf_slice.o netcdf_io.o

STRDIR=../string
MODDIR=../../lib
LIBDIR=../../lib
NCLIBDIR=
DCL90DIR=../../../lib
DCL90LIB=-L$(DCL90DIR) -ldcl -ldcl-f90 -lnetcdf
DCL90MOD=../../../lib

FC=frt -Am -M$(MODDIR)

LIBPATH=$(LIBDIR)/libgtool4.a

.SUFFIXES: .f90 .o .exe .3f .htm .mod

all: lib 

lib: $(OBJS)

.f90.o:
	$(FC) -c -I$(DCL90MOD) $< 

.f90:
	$(FC) -I$(DCL90MOD) $< $(OBJS) ../string/*.o $(DCL90LIB)

clean:
	-rm -f *.o *.mod *.bak test.nc *.exe
	
clean.all: clean
	-rm -f *.htm

.3f.htm:
	htroff -man -u -a $<

CHARS=$(MODDIR)/dc_chars.mod
STRING=$(MODDIR)/iso_varying_string.mod

netcdf_error.o: netcdf_v3.o $(STRING)
netcdf_filename.o: $(STRING)
netcdf_file.o: netcdf_filename.o netcdf_error.o
netcdf_dimension.o: netcdf_file.o
netcdf_variable.o: netcdf_dimension.o
netcdf_slice.o: netcdf_variable.o
netcdf_io.o: netcdf_slice.o $(CHARS)
netcdf_attribute.o: netcdf_variable.o
netcdf.o: netcdf_io.o netcdf_attribute.o

