1 # --------------------------------------------------------------------------
4 # Markus Wittmann, 2016-2017
5 # RRZE, University of Erlangen-Nuremberg, Germany
6 # markus.wittmann -at- fau.de or hpc -at- rrze.fau.de
9 # LSS, University of Erlangen-Nuremberg, Germany
11 # This file is part of the Lattice Boltzmann Benchmark Kernels (LbmBenchKernels).
13 # LbmBenchKernels is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
18 # LbmBenchKernels is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with LbmBenchKernels. If not, see <http://www.gnu.org/licenses/>.
26 # --------------------------------------------------------------------------
28 # TODO: add AVX512/HBM/Memkind support for GCC
30 # ------------------------------------------------------------------------
31 # C ompiler/linker to use.
32 # Flags are specified at the end of the file.
33 # ------------------------------------------------------------------------
37 # ------------------------------------------------------------------------
39 # Preprocessing variables.
44 # Architecture to optimize for.
47 # Generated dependencies, can be left empty.
48 MAKE_DEPEND = $(CC) -MM -MQ'$(OBJECT_DIR)/$(<:%.c=%.o)' -MF'$(DEP_DIR)/$(<:%.c=%.d)' $(PP_FLAGS) $< > /dev/null
50 # Generates dependencies, can be left empty.
51 # $(call make_depend,<source-file>,<source-file-to-generate-dependency-for)
53 $(CC) -MM -MQ'$(OBJECT_DIR)/$(2:%.c=%.o)' -MF'$(DEP_DIR)/$(2:%.c=%.d)' $(PP_FLAGS) $1 > /dev/null
58 OPENMP_C_FLAGS += -fopenmp
59 OPENMP_LD_FLAGS += -fopenmp
63 ifeq (release,$(BUILD))
65 C_FLAGS += -O3 $(TARCH)
66 LD_FLAGS += -O3 $(TARCH)
73 C_FLAGS += -O0 $(TARCH) -g -ggdb
74 LD_FLAGS += -O0 $(TARCH) -g -ggdb
79 $(error unknown BUILD=$(BUILD), specify release or debug)
83 ifeq (on,$(ADDRESS_SANITIZER))
84 # see https://github.com/google/sanitizers/wiki/AddressSanitizerFlags for details
85 C_FLAGS += -fsanitize=address
86 LD_FLAGS += -fsanitize=address
89 ifeq (on,$(DEBUG_SYMBOLS))
94 C_FLAGS += -Wall -Wuninitialized -Wunused-variable -Wshadow -fargument-noalias -fargument-noalias-anything -std=c99 \
95 -MT $@ -MF $(patsubst $(OBJECT_DIR)/%.o,$(DEP_DIR)/%.d,$@) -MMD $(OPENMP_C_FLAGS)
96 LD_FLAGS += -Wall $(OPENMP_LD_FLAGS)