
VPATH = PDSI/
EXE =  EVisotCat2NetCDF EVlochCat2NetCDF Butter BruitAnnuel BruitSaisonnier BruitMensuel VolcCat2NetCDF VolcCat2NetCDF_oldFormat\
       ChangeGrid SelectLevel EvoluCat2NetCDF EvoluCat2NetCDFan NetCDFwavg\
       PutUnlimited OceanGrideChange MoyenneTempo Boxifaire CorrelSpace CorrelTempo\
       NetCDFensStore VarianceEns MoyenneGlissante Gradsifaire

all:$(EXE)

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

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

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

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

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

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

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

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

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

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

SelectLevel: SelectLevel.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)

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

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

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

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

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

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

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

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

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

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

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

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

Gradsifaire: Gradsifaire.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*"`; if [ "$${resu}" != "" ]; then echo "rm -f $${resu}"; rm -f $${resu}; fi
