Skip to content
Merged
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
12 changes: 12 additions & 0 deletions install/DEFAULTS.inc
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ else
$(error "Unsupported C compiler. Must set environment variable CC to a C compiler (e.g. gcc, icc, pgcc)")
endif

# Pass the selected toolchain to dependency configure scripts and sub-makes.
export FC CC
export F77 = $(FC)

# List of needed dependencies, will be appended if math or netcdf
# libraries are not found
NEEDED_DEPS =
Expand Down Expand Up @@ -560,6 +564,14 @@ else
endif
endif

# Embed the configured netcdf library directories for runtime lookup.
# These paths must remain available when running the executables.
NETCDF_RPATH = -Wl,-rpath,$(NETCDFDIR)
Comment thread
matt-pharr marked this conversation as resolved.
ifneq ($(NETCDF_C_DIR),$(NETCDFDIR))
NETCDF_RPATH += -Wl,-rpath,$(NETCDF_C_DIR)
endif
NETCDF_EXTRA_LIBS += $(NETCDF_RPATH)

# Intel specifics
#----------------
# include compiler specific libs for intel fast moves
Expand Down
5 changes: 3 additions & 2 deletions install/TARGETS.inc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ netcdf-c: v hdf5
if [ ! -f ../deps/src/netcdf-c/Makefile ]; then \
cd ../deps/src/netcdf-c; \
CPPFLAGS="-I$(realpath $(DEPSINSTALLDIR))/include" \
LDFLAGS="-L$(realpath $(DEPSINSTALLDIR))/lib" \
LDFLAGS="-L$(realpath $(DEPSINSTALLDIR))/lib -Wl,-rpath,$(realpath $(DEPSINSTALLDIR))/lib" \
./configure --prefix=$(realpath $(DEPSINSTALLDIR)); \
fi
cd ../deps/src/netcdf-c; \
Expand All @@ -57,7 +57,7 @@ netcdf-fortran: v netcdf-c
if [ ! -f ../deps/src/netcdf-fortran/Makefile ]; then \
cd ../deps/src/netcdf-fortran; \
CPPFLAGS="-I$(realpath $(DEPSINSTALLDIR))/include" \
LDFLAGS="-L$(realpath $(DEPSINSTALLDIR))/lib" \
LDFLAGS="-L$(realpath $(DEPSINSTALLDIR))/lib -Wl,-rpath,$(realpath $(DEPSINSTALLDIR))/lib" \
./configure --prefix=$(realpath $(DEPSINSTALLDIR)); \
fi
cd ../deps/src/netcdf-fortran; \
Expand All @@ -69,6 +69,7 @@ hdf5: v
cd ../; git submodule update --init deps/src/hdf5;
if [ ! -f ../deps/src/hdf5/Makefile ]; then \
cd ../deps/src/hdf5; \
LDFLAGS="-Wl,-rpath,$(realpath $(DEPSINSTALLDIR))/lib" \
./configure --prefix=$(realpath $(DEPSINSTALLDIR)); \
fi
cd ../deps/src/hdf5; \
Expand Down
12 changes: 8 additions & 4 deletions install/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,23 @@ clear:
cd ../docs/examples/solovev_kinetic_example; rm -f *.out *.bin *.nc
cd ../docs/examples/solovev_resistive_example; rm -f *.out *.bin *.nc *.dat

# Revert to clean state
# Remove build products and dependency configuration before switching compilers.
# Dependency sources stay in ../deps/src; custom install prefixes are respected.
realclean: clean clear
rm -rf ../deps/lib/* ../deps/hdf5 ../deps/include/* ../deps/bin/* ../deps/share ../bin
if [ -f ../deps/src/OpenBLAS/Makefile ]; then cd ../deps/src/OpenBLAS && make clean; fi
if [ -f ../deps/src/hdf5/Makefile ]; then cd ../deps/src/hdf5 && make clean; fi
if [ -f ../deps/src/netcdf-c/Makefile ]; then cd ../deps/src/netcdf-c && make clean; fi
if [ -f ../deps/src/netcdf-fortran/Makefile ]; then cd ../deps/src/netcdf-fortran && make clean; fi
if [ -f ../deps/src/hdf5/Makefile ]; then cd ../deps/src/hdf5 && $(MAKE) distclean; fi
if [ -f ../deps/src/netcdf-c/Makefile ]; then cd ../deps/src/netcdf-c && $(MAKE) distclean; fi
if [ -f ../deps/src/netcdf-fortran/Makefile ]; then cd ../deps/src/netcdf-fortran && $(MAKE) distclean; fi
rm -f "$(DEPSINSTALLDIR)"/lib/libnetcdf* "$(DEPSINSTALLDIR)"/lib/libhdf5* \
"$(DEPSINSTALLDIR)"/include/netcdf*.mod "$(DEPSINSTALLDIR)"/include/typesizes.mod

# Dependency graph (DEPENDENCIES.inc) maintenance.
# Building GPEC never needs these -- DEPENDENCIES.inc is committed. They are
# only for regenerating it when source USE/MODULE relationships change, and
# require python3 (used by maintainers and the CI deps job, not end users).
PYTHON ?= python3

.PHONY: deps checkdeps
deps:
$(PYTHON) gen_deps.py > DEPENDENCIES.inc
Expand Down
Loading