Patch futils/mpiuni for GCC
The bundled futils_src/Makefile.ifort
file works fine, but the futils_src/Makefile.gfortran
needs some work.
I propose to change the Makefile.gfortran
to reflect the Makefile.ifort
file, but with compilers and flags changed from intel to gfortran.
A diff is attached below (from !9 (merged)):
diff --git a/src-f90/futils_src/Makefile.gfortran b/src-f90/futils_src/Makefile.gfortran
index 63b4909..ae5f928 100644
--- a/src-f90/futils_src/Makefile.gfortran
+++ b/src-f90/futils_src/Makefile.gfortran
@@ -1,18 +1,20 @@
PREFIX=$(HOME)/gcc
-F90 = mpif90
+F90 = gfortran
OPT = -g -fbounds-check -fbacktrace # only from 4.3.x
OPT = -g -fbounds-check
-F90FLAGS = $(OPT) -I${HDF5}/lib -I${HDF5}/include
+F90FLAGS = $(OPT) $(INCL_HDF5)
CC = cc
-CFLAGS = -O2
-LDFLAGS = $(OPT) -L. -L${HDF5}/lib
+CFLAGS = -O2 -Impiuni
+LDFLAGS = $(OPT) -L. $(LIBS_HDF5)
-LIBS = -lfutils -lhdf5_fortran -lhdf5 -lz
+LIBS = -lfutils -lhdf5_fortran -lhdf5 -lz -lmpiuni
.SUFFIXES:
.SUFFIXES: .o .c .f90
+.PHONY: mpiuni
+
.f90.o:
$(F90) $(F90FLAGS) -c $<
@@ -21,47 +23,28 @@ lib: libfutils.a getfile
getfile: getfile.o
$(F90) $(LDFLAGS) -o $@ $< $(LIBS)
-libfutils.a: futils.o cutils.o buffer.o vis3d.o
+libfutils.a: futils.o cutils.o buffer.o uniproc.o
ar r $@ $?
ranlib $@
-futils.o: append.tpl zappend.tpl \
- putarr.tpl cputarr.tpl putarrnd.tpl cputarrnd.tpl \
- getarr.tpl cgetarr.tpl getarrnd.tpl cgetarrnd.tpl
-
-buffer.o: futils.o
-
-vis3d.o: futils.o
-
-test:
- make -C ../examples test_s test_p
-
-install: debug opt
-
-debug:
- make distclean
- make "OPT = -g -fbounds-check" libfutils.a
- mkdir -p $(PREFIX)/{lib,include}/g
- cp -p libfutils.a $(PREFIX)/lib/g
- cp -p *.mod $(PREFIX)/include/g
+mpiuni:
+ $(MAKE) -C mpiuni lib FC="$(F90)" FFLAGS="$(OPT)" CC=$(CC)
-opt:
- make distclean
- make "OPT = -O2" libfutils.a
- mkdir -p $(PREFIX)/{lib,include}/O
- cp -p libfutils.a $(PREFIX)/lib/O
- cp -p *.mod $(PREFIX)/include/O
+futils.o: mpiuni \
+ append.tpl zappend.tpl \
+ putarr.tpl cputarr.tpl \
+ getarr.tpl cgetarr.tpl
+ $(F90) $(F90FLAGS) -Impiuni -c futils.f90
-uninstall:
- rm -f $(PREFIX)/include{O,g}/futils.mod
- rm -f $(PREFIX)/include{O,g}/hashtable.mod
- rm -f $(PREFIX)/include{O,g}/vis3d.mod
- rm -f $(PREFIX)/lib{O,g}/libfutils.a
+buffer.o: mpiuni futils.o
+ $(F90) $(F90FLAGS) -Impiuni -c buffer.f90
getfile.o: libfutils.a
clean:
- rm -f *.o *~ a.out fort.* *.h5*
+ rm -f *.o *~ a.out
+ make -C mpiuni clean
distclean: clean
- rm -f getfile *.a *.mod TAGS
+ rm -f $(SERIAL) ex6 getfile *.h5 *.a *.mod
+ make -C mpiuni distclean
Before accepting such a change, we should check if this file is taken as-is from upstream futils, and if yes, we should patch upstream and then re-update futils
from upstream.