SHELL=/bin/sh

# makefile for MUFPOT program and module
#
# the MUFPOT source code is not included in the public distribution.
# please obtain the MUFPOT code from the original author,
# and copy it to this directory before compilation.
#
# see the top-level makefile for additional information.

.SUFFIXES:
.SUFFIXES: .c .cpp .cxx .exe .f .h .i .o .py .pyf .so
.PHONY: all clean edac msc mufpot

FC=gfortran
FCCOPTS=
F2PY=f2py
F2PYOPTS=
CC=gcc
CCOPTS=
SWIG=swig
SWIGOPTS=
PYTHON=python2
PYTHONOPTS=

all: mufpot

mufpot: mufpot.exe mufpot.so

mufpot.exe: mufpot.f
	$(FC) $(FCOPTS) -o mufpot.exe mufpot.f

mufpot.pyf: | mufpot.f
	$(F2PY) -h mufpot.pyf -m mufpot mufpot.f only: mufpot

mufpot.so: mufpot.f mufpot.pyf
	$(F2PY) -c $(F2PYOPTS) mufpot.pyf mufpot.f -m mufpot

revision.f: msc.f
	echo "      character*50 coderev" > revision.f
	echo "      parameter(coderev=" >> revision.f
	git log --pretty=format:"     ='Code revision %h, %ad')" --date=iso -1 $< >> $@ || echo "     ='Code revision unknown, "`date +"%F %T %z"`"')" >> $@

clean:
	rm -f *.so *.o *.exe
	rm -f revision.f
