
EXE  = 	veget_outp_to_nc EvoluCat2NetCDF EvoluCat2NetCDFan PutUnlimited OceanGrideChange LochGrideChange NoisyVolc crop_grille_ecbilt

EXEC =	$(EXE)

all:$(EXEC)

veget_outp_to_nc: veget_outp_to_nc.f90
	$(COMPILFORTAN) $(FORTANFLAGS) $(INCS) -o $(<D)/$@ $^ $(LIBSFORTRAN)

EvoluCat2NetCDF: EvoluCat2NetCDF.cpp
	$(COMPILCPP) $(CPPFLAGS) $(INCS) -o $(<D)/$@ $^ $(LIBSCPP)

EvoluCat2NetCDFan: EvoluCat2NetCDFan.cpp
	$(COMPILCPP) $(CPPFLAGS) $(INCS) -o $(<D)/$@ $^ $(LIBSCPP)

PutUnlimited: PutUnlimited.cpp
	$(COMPILCPP) $(CPPFLAGS) $(INCS) -o $(<D)/$@ $^ $(LIBSCPP)

OceanGrideChange: OceanGrideChange.f90
	$(COMPILFORTAN) $(FORTANFLAGS) $(INCS) -o $(<D)/$@ $^ $(LIBSFORTRAN)

LochGrideChange: LochGrideChange.f90
	$(COMPILFORTAN) $(FORTANFLAGS) $(INCS) -o $(<D)/$@ $^ $(LIBSFORTRAN)

NoisyVolc: NoisyVolc.cpp
	$(COMPILCPP) $(CPPFLAGS) $(INCS) -o $(<D)/$@ $^ $(LIBSCPP)

crop_grille_ecbilt: crop_grille_ecbilt.f90
	$(COMPILFORTAN) $(FORTANFLAGS) $(INCS) -o $(<D)/$@ $^ $(LIBSFORTRAN)

%.o: %.cpp
	$(COMPILCPP) -o $@ -c $<

%.o: %.f90
	$(COMPILFORTAN) $(FORTANFLAGS) $(INCS) -module $(<D) -o $@ -c $<

clean:
	@for i in ${EXE}; do \
	  resu=`find . -name "$${i}"`; \
	  if [ "$${resu}" != "" ]; then echo "rm -f $${resu}"; rm -f $${resu}; fi;\
        done; \
	resu=`find . -name "*.o"`; if [ "$${resu}" != "" ]; then echo "rm -f $${resu}"; rm -f $${resu}; fi;\
	resu=`find . -name "*.mod"`; if [ "$${resu}" != "" ]; then echo "rm -f $${resu}"; rm -f $${resu}; fi;\
	resu=`find . -name "*__genmod.f90" -exec rm -rf {} \;`;\
