Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update make templates to guess HDF5 directories #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.mod
*.DO_NOT_MODIFY.f90
*.x
*.a
38 changes: 25 additions & 13 deletions exec/templates/gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ endif
# variables. If these options are not defined, the makefile will
# attempt to get the correct options from the `nf-config` command.

# HDF_FLAGS
# HDF_LDFLAGS
# HDF_LIBS
# If defined, use the HDF5 compile and link options defined in these
# variables. If these options are note defined, then makefile will
# attempt ot get the correct options from the `h5fc -show` command.

# MPI_FLAGS
# MPI_LIBS
# If defined, use the MPI compile and link options defined in these
# variables. If these options are not defined, the makefile will
# attempt to get the correct options from the `pkg-config` for mpich2
# MPI library.
# variables.

# VERBOSE
# If non-blank, add additional verbosity compiler options
Expand Down Expand Up @@ -96,9 +101,7 @@ else
FPPFLAGS += $(NETCDF_FLAGS)
endif
# Fortran Compiler flags for the MPICH MPI library
ifndef MPI_FLAGS
FPPFLAGS += $(shell pkg-config --cflags-only-I mpich2-c)
else
ifdef MPI_FLAGS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@underwoo did you intend to also change the MPI flags in the make templates? It's not mentioned in the commit message.

FPPFLAGS += $(MPI_FLAGS)
endif

Expand All @@ -125,10 +128,8 @@ else
CPPFLAGS += $(NETCDF_FLAGS)
endif
# C Compiler flags for the MPICH MPI library
ifndef MPI_FLAGS
ifdef MPI_FLAGS
CPPFLAGS += $(shell pkg-config --cflags-only-I mpich2-c)
else
CPPFLAGS += $(MPI_FLAGS)
endif

# Base set of C compiler flags
Expand Down Expand Up @@ -159,6 +160,19 @@ LDFLAGS_OPENMP := -fopenmp
LDFLAGS_VERBOSE :=
LDFLAGS_COVERAGE :=

# HDF flags
ifndef HDF5_FFLAGS
FFLAGS += $(shell myflags=''; for c in $$(h5fc -show); do if [ x"$$(echo $$c | cut -c1-2)" = "x-I" ]; then myflags="$${myflags} $$c"; fi; done; echo $${myflags})
else
FFLAGS += $(HDF5_FFLAGS)
endif

# ifndef HDF5_LDFLAGS
LDFLAGS += $(shell myflags=''; for c in $$(h5fc -show); do if [ x"$$(echo $$c | cut -c1-2)" = "x-L" ]; then myflags="$${myflags} $$c"; fi; done; echo $${myflags})
else
LDFLAGS += $(HDF5_LDFLAGS)
endif

# Start with a blank LIBS
LIBS =
# NetCDF library flags
Expand All @@ -167,10 +181,8 @@ LIBS += $(shell nf-config --flibs)
else
LIBS += $(NETCDF_LIBS)
endif
# MPICH MPI library flags
ifndef MPI_LIBS
LIBS += $(shell pkg-config --libs mpich2-f90)
else
# MPI library flags
ifdef MPI_LIBS
LIBS += $(MPI_LIBS)
endif
# HDF library flags
Expand Down
36 changes: 24 additions & 12 deletions exec/templates/intel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ endif
# variables. If these options are not defined, the makefile will
# attempt to get the correct options from the `nf-config` command.

# HDF_FLAGS
# HDF_LDFLAGS
# HDF_LIBS
# If defined, use the HDF5 compile and link options defined in these
# variables. If these options are note defined, then makefile will
# attempt ot get the correct options from the `h5fc -show` command.

# MPI_FLAGS
# MPI_LIBS
# If defined, use the MPI compile and link options defined in these
# variables. If these options are not defined, the makefile will
# attempt to get the correct options from the `pkg-config` for mpich2
# MPI library.
# variables.

# VERBOSE
# If non-blank, add additional verbosity compiler options
Expand Down Expand Up @@ -95,9 +100,7 @@ else
FPPFLAGS += $(NETCDF_FLAGS)
endif
# Fortran Compiler flags for the MPICH MPI library
ifndef MPI_FLAGS
FPPFLAGS += $(shell pkg-config --cflags-only-I mpich2-c)
else
ifdef MPI_FLAGS
FPPFLAGS += $(MPI_FLAGS)
endif

Expand All @@ -124,9 +127,7 @@ else
CPPFLAGS += $(NETCDF_FLAGS)
endif
# C Compiler flags for the MPICH MPI library
ifndef MPI_FLAGS
CPPFLAGS += $(shell pkg-config --cflags-only-I mpich2-c)
else
ifdef MPI_FLAGS
CPPFLAGS += $(MPI_FLAGS)
endif

Expand Down Expand Up @@ -158,6 +159,19 @@ LDFLAGS_OPENMP := -qopenmp
LDFLAGS_VERBOSE := -Wl,-V,--verbose,-cref,-M
LDFLAGS_COVERAGE = -prof-gen=srcpos

# HDF flags
ifndef HDF5_FFLAGS
FFLAGS += $(shell myflags=''; for c in $$(h5fc -show); do if [ x"$$(echo $$c | cut -c1-2)" = "x-I" ]; then myflags="$${myflags} $$c"; fi; done; echo $${myflags})
else
FFLAGS += $(HDF5_FFLAGS)
endif

ifndef HDF5_LDFLAGS
LDFLAGS += $(shell myflags=''; for c in $$(h5fc -show); do if [ x"$$(echo $$c | cut -c1-2)" = "x-L" ]; then myflags="$${myflags} $$c"; fi; done; echo $${myflags})
else
LDFLAGS += $(HDF5_LDFLAGS)
endif

# Start with a blank LIBS
LIBS =
# NetCDF library flags
Expand All @@ -167,9 +181,7 @@ else
LIBS += $(NETCDF_LIBS)
endif
# MPICH MPI library flags
ifndef MPI_LIBS
LIBS += $(shell pkg-config --libs mpich2-f90)
else
ifdef MPI_LIBS
LIBS += $(MPI_LIBS)
endif
# HDF library flags
Expand Down