ifeq ("$(wildcard $(NETCDF)/lib/libnetcdff*)", "")
NETCDF_LIB=-L$(NETCDF)/lib -lnetcdf 
else
NETCDF_LIB=-L$(NETCDF)/lib -lnetcdff -lnetcdf -lcurl
endif

all: da_decimation.exe da_bilin.exe da_bdy.exe

da_decimation.exe: da_decimation.o
	$(SFC) -o $@ da_decimation.o $(NETCDF_LIB)


da_decimation.o: da_decimation.f90
	$(SFC) -c -I$(NETCDF)/include $< -o $@

da_bilin.exe: da_bilin.o
	$(SFC) -o $@ da_bilin.o $(NETCDF_LIB)

da_bilin.o: da_bilin.f90
	$(SFC) -c -I$(NETCDF)/include $< -o $@

da_bdy.exe: da_bdy.o
	$(SFC) -o $@ da_bdy.o $(NETCDF_LIB)

da_bdy.o: da_bdy.f90
	$(SFC) -c -I$(NETCDF)/include $< -o $@ 

clean: 
	rm -rf *.o da_decimation.exe da_bilin.exe da_bdy.exe
