From 26efc6a4e1ef0f24072b419cdd0ece09544564ab Mon Sep 17 00:00:00 2001 From: Michael Blaschek <michael.blaschek@univie.ac.at> Date: Tue, 28 Sep 2021 14:35:05 +0000 Subject: [PATCH] Update Fortran/Compilers.md --- Fortran/Compilers.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Fortran/Compilers.md diff --git a/Fortran/Compilers.md b/Fortran/Compilers.md new file mode 100644 index 0000000..8d4aa29 --- /dev/null +++ b/Fortran/Compilers.md @@ -0,0 +1,23 @@ +# Compiling & Building + +under development :) + +## Makefile + + +### Environmental Modules & Makefile + +It is quite handy to use environmental modules and load different version of libraries, but how to make use of these ever changing **PATHs**. Take a look at the following examples to help with making your `Makefile` ready for modules. + +``` +# use the environmental variable $INCLUDE +# split the paths separated by : +INC = $(subst :, ,$(INCLUDE)) +# add a -I/path/to/include +INC := $(INC:%=-I%) +# use the environmental variable $LIBRARY_PATH +LIBS = $(subst :, ,$(LIBRARY_PATH)) +LIBS := $(LIBS:%=-L%) +``` + +With this code snippet in your Makefile you should be able to use environmental variables such as `$INCLUDE` or `$LIBRARY_PATH` efficiently. These paths adapt to your loaded modules. -- GitLab