Skip to content

Commit

Permalink
bug fix:
Browse files Browse the repository at this point in the history
1. modify the Makefile so the gfortran compiler can be
   used now. Codes have been tested on ifort on Mac, and
   gfortran on linux
  • Loading branch information
cd10kfsu committed Apr 6, 2017
1 parent efe5363 commit da5667b
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 16 deletions.
Binary file modified include/mod_f90gio.mod
Binary file not shown.
Binary file modified include/mod_f90gioh4.mod
Binary file not shown.
Binary file modified include/mod_f90gioh5.mod
Binary file not shown.
Binary file modified include/mod_f90gionc.mod
Binary file not shown.
Binary file modified lib/libf90gio.a
Binary file not shown.
Binary file modified lib/libf90gioh4.a
Binary file not shown.
Binary file modified lib/libf90gioh5.a
Binary file not shown.
Binary file modified lib/libf90gionc.a
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ libf90gio.a: mod_f90gionc.o mod_f90gioh4.o mod_f90gioh5.o mod_f90gio.o
$(ARCHIVER) $(ARCHIEVER_FLAGS) $@ $^

mod_f90gio.o: mod_f90gio.f90
$(FC) -c $(FC_CFLAGS) $(NC_CFALGS) $(H4_CFLAGS) $(H5_CFLAGS) $<
$(FC) -c $(FC_CFLAGS) $(NC_CFLAGS) $(H4_CFLAGS) $(H5_CFLAGS) $<

mod_f90gionc.o: mod_f90gionc.f90
$(FC) -c $(FC_CFLAGS) $(NC_CFLAGS) $<
Expand Down
22 changes: 11 additions & 11 deletions src/makefile.config
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@

FC=ifort
FC_CFLAGS= -warn
FC_LFLAGS=
FC=gfortran
FC_CFLAGS=
FC_LFLAGS=

ARCHIVER=ar
ARCHIEVER_FLAGS= -crvs

# config for F90GIO installation
F90GIO_DIR=/Users/cda/Documents/work/pkg/model/F90GIO-ifort
F90GIO_DIR=/home/cda/Documents/model/F90GIO-fortran
F90GIO_LIB_DIR=$(F90GIO_DIR)/lib
F90GIO_INCLUDE_DIR=$(F90GIO_DIR)/include

# config for Netcdf
NC_CFLAGS=-I/Users/cda/Documents/work/pkg/model/netcdf-fortran-4.4.4-ifort/include
NC_LFLAGS=-L/Users/cda/Documents/work/pkg/model/netcdf-fortran-4.4.4-ifort/lib -lnetcdff -L/Users/cda/Documents/work/pkg/model/netcdf-4.4.1.1-gcc/lib -lnetcdf -lnetcdf
NC_CFLAGS=-I/home/cda/Documents/model/netcdf-fortran-4.4.4-gfortran/include
NC_LFLAGS=-L/home/cda/Documents/model/netcdf-fortran-4.4.4-gfortran/lib -lnetcdff -L/home/cda/Documents/model/netcdf-4.4.1.1-gcc/lib -lnetcdf -lnetcdf

# config for HDF4
H4_CFLAGS=-I/Users/cda/Documents/work/pkg/model/hdf-4.2.12-ifort/include
H4_LFLAGS=-L/Users/cda/Documents/work/pkg/model/zlib-1.2.11-gcc/lib -L/Users/cda/Documents/work/pkg/model/jpeg-6b-gcc/lib -L/Users/cda/Documents/work/pkg/model/hdf-4.2.12-ifort/lib -lmfhdf -ldf -ljpeg -lz
H4_CFLAGS=-I/home/cda/Documents/model/hdf-4.2.12-gfortran/include
H4_LFLAGS=-L/home/cda/Documents/model/zlib-1.2.11-gcc/lib -L/home/cda/Documents/model/jpeg-6b-gcc/lib -L/home/cda/Documents/model/hdf-4.2.12-gfortran/lib -lmfhdf -ldf -ljpeg -lz


# config for HDF4
H5_CFLAGS=-I/Users/cda/Documents/work/pkg/model/hdf5-1.8.18-ifort/include
#H5_LFLAGS=-L/Users/cda/Documents/work/pkg/model/hdf5-1.8.18-ifort/lib /Users/cda/Documents/work/pkg/model/hdf5-1.8.18-ifort/lib/libhdf5hl_fortran.a /Users/cda/Documents/work/pkg/model/hdf5-1.8.18-ifort/lib/libhdf5_hl.a /Users/cda/Documents/work/pkg/model/hdf5-1.8.18-ifort/lib/libhdf5_fortran.a /Users/cda/Documents/work/pkg/model/hdf5-1.8.18-ifort/lib/libhdf5.a -L/Users/cda/Documents/work/pkg/model/zlib-1.2.11-gcc/include -lz -ldl -lm
H5_CFLAGS=-I/home/cda/Documents/model/hdf5-1.8.18-gfortran/include
H5_LFLAGS=-L/home/cda/Documents/model/hdf5-1.8.18-gfortran/lib /home/cda/Documents/model/hdf5-1.8.18-gfortran/lib/libhdf5hl_fortran.a /home/cda/Documents/model/hdf5-1.8.18-gfortran/lib/libhdf5_hl.a /home/cda/Documents/model/hdf5-1.8.18-gfortran/lib/libhdf5_fortran.a /home/cda/Documents/model/hdf5-1.8.18-gfortran/lib/libhdf5.a -L/home/cda/Documents/model/zlib-1.2.11-gcc/lib -lz -ldl -lm -Wl,-rpath -Wl,/home/cda/Documents/model/hdf5-1.8.18-gfortran/lib
#H5_LFLAGS=-L/home/cda/Documents/model/hdf5-1.8.18-gfortran/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -L/home/cda/Documents/model/zlib-1.2.11-gcc/lib -lz -ldl -lm -Wl,-rpath -Wl,/home/cda/Documents/model/hdf5-1.8.18-gfortran/lib

H5_LFLAGS=-L/Users/cda/Documents/work/pkg/model/hdf5-1.8.18-ifort/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -L/Users/cda/Documents/work/pkg/model/zlib-1.2.11-gcc/include -lz -ldl -lm
1 change: 1 addition & 0 deletions test-nolib/test_hdf4.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ H4_LFLAGS=`cat ../src/makefile.config |grep H4_LFLAGS|cut -d '=' -f2`
cp ../src/mod_f90gioh4.f90 .
cp ../test/test_h4.f90 .

echo "$FC ${FC_CFLAGS} ${H4_CFLAGS} mod_f90gioh4.f90 test_h4.f90 ${FC_LFLAGS} -o test_h4.exe ${H4_LFLAGS}"
$FC ${FC_CFLAGS} ${H4_CFLAGS} mod_f90gioh4.f90 test_h4.f90 ${FC_LFLAGS} -o test_h4.exe ${H4_LFLAGS}

./test_h4.exe > results.hdf
Expand Down
1 change: 1 addition & 0 deletions test-nolib/test_hdf5.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cp ../src/mod_f90gioh5.f90 .
cp ../test/test_h5.f90 .
ln -sf ../test/hdf5_testdata.h5 .

echo "$FC ${FC_CFLAGS} ${H5_CFLAGS} mod_f90gioh5.f90 test_h5.f90 ${FC_LFLAGS} -o test_h5.exe ${H5_LFLAGS}"
$FC ${FC_CFLAGS} ${H5_CFLAGS} mod_f90gioh5.f90 test_h5.f90 ${FC_LFLAGS} -o test_h5.exe ${H5_LFLAGS}

./test_h5.exe > results.h5
Expand Down
2 changes: 2 additions & 0 deletions test-nolib/test_netcdf.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ cp ../src/mod_f90gionc.f90 .
cp ../test/test_nc.f90 .
ln -sf ../test/netcdf_testdata.nc .

echo "$FC ${FC_CFLAGS} ${NC_CFLAGS} mod_f90gionc.f90 test_nc.f90 ${FC_LFLAGS} -o test_nc.exe ${NC_LFLAGS}"
$FC ${FC_CFLAGS} ${NC_CFLAGS} mod_f90gionc.f90 test_nc.f90 ${FC_LFLAGS} -o test_nc.exe ${NC_LFLAGS}


./test_nc.exe > results.nc
diff results.nc ../test/nc.results_correct
nl=`diff results.nc ../test/nc.results_correct | wc -l`
Expand Down
8 changes: 4 additions & 4 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ F90GIO_CFLAGS=-I$(F90GIO_INCLUDE_DIR)
F90GIO_NC_LFLAGS=-L$(F90GIO_LIB_DIR) -lf90gionc
F90GIO_H4_LFLAGS=-L$(F90GIO_LIB_DIR) -lf90gioh4
F90GIO_H5_LFLAGS=-L$(F90GIO_LIB_DIR) -lf90gioh5
F90GIO_ALL_LFLAGS=$(NC_LFLAGS) $(H4_LFLAGS) $(H5_LFLAGS) -L$(F90GIO_LIB_DIR) -lf90gio
F90GIO_ALL_LFLAGS=-L$(F90GIO_LIB_DIR) -lf90gio $(NC_LFLAGS) $(H4_LFLAGS) $(H5_LFLAGS)

all: test-netcdf test-hdf4 test-hdf5 test-f90gio

Expand All @@ -22,13 +22,13 @@ clean:
rm *.exe *.o *.hdf

test_nc.exe: test_nc.o
$(FC) $< -o $@ $(NC_LFLAGS) $(F90GIO_NC_LFLAGS)
$(FC) $< -o $@ $(F90GIO_NC_LFLAGS) $(NC_LFLAGS)

test_h4.exe: test_h4.o
$(FC) $< -o $@ $(H4_LFLAGS) $(F90GIO_H4_LFLAGS)
$(FC) $< -o $@ $(F90GIO_H4_LFLAGS) $(H4_LFLAGS)

test_h5.exe: test_h5.o
$(FC) $< -o $@ $(H5_LFLAGS) $(F90GIO_H5_LFLAGS)
$(FC) $< -o $@ $(F90GIO_H5_LFLAGS) $(H5_LFLAGS)

test_nc.o: test_nc.f90
$(FC) -c $(FC_CFLAGS) $(F90GIO_CFLAGS) $<
Expand Down

0 comments on commit da5667b

Please sign in to comment.