# Makefile for DMFT-MPI (Version 2.0 by Nils Bluemer)
# Options have to be defined in Configure and are used dependent
# on architecture
#
# Just run the command "make SIZE=<size>"
# Some systems require running "./Configure > options.arch" beforehand

SHELL = /bin/sh
.SUFFIXES: .F .f .o

FC = f77
DISTNAME = DMFT-MPI
#CPP = cc -E -C  (Problem auf SP)
CPP = cc -P -C 
#Meist geht auch cpp -C
CPPVAR = -D

include options.arch


.F.f: options.arch
	$(CPP) $(CPPVAR)LMAX=0$(SIZE) $(CPPOPTIONS) $< && mv $*.i  $@
.f.o: options.arch
	$(FC)  $(FOPTIONS) -c $<


$(DISTNAME): $(DISTNAME).o lib$(DISTNAME).o options.arch
	$(FC) $(DISTNAME).o lib$(DISTNAME).o -o $@ $(FOPTIONS) 

$(DISTNAME).o: $(DISTNAME).f
lib$(DISTNAME).o: lib$(DISTNAME).f

options.arch: Configure
	./Configure > $@

clean:
	(rm -f *.o $(DISTNAME) $(DISTNAME).f lib$(DISTNAME).f options.arch $(DISTNAME).uum *~)

$(DISTNAME).uum: $(DISTNAME).F lib$(DISTNAME).F Configure uumfiles Makefile
	echo "$(DISTNAME).F lib$(DISTNAME).F Configure uumfiles Makefile" | ./uumfiles $(DISTNAME)

