merge with kernels from MH's master thesis
[LbmBenchmarkKernelsPublic.git] / src / config.linux-gcc.mk
1 # --------------------------------------------------------------------------
2 #
3 # Copyright
4 #   Markus Wittmann, 2016-2017
5 #   RRZE, University of Erlangen-Nuremberg, Germany
6 #   markus.wittmann -at- fau.de or hpc -at- rrze.fau.de
7 #
8 #   Viktor Haag, 2016
9 #   LSS, University of Erlangen-Nuremberg, Germany
10 #
11 #  This file is part of the Lattice Boltzmann Benchmark Kernels (LbmBenchKernels).
12 #
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.
17 #
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.
22 #
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/>.
25 #
26 # --------------------------------------------------------------------------
27
28 # TODO: add AVX512/HBM/Memkind support for GCC
29
30 # ------------------------------------------------------------------------
31 # C ompiler/linker to use.
32 # Flags are specified at the end of the file.
33 # ------------------------------------------------------------------------
34 CC              = gcc
35 LD              = gcc
36
37 # ------------------------------------------------------------------------
38
39 # Preprocessing variables.
40 D          = -D
41 I          = -I
42 PP_FLAGS  +=
43
44 # Architecture to optimize for.
45 TARCH      ?= -mavx
46
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
49
50 # Generates dependencies, can be left empty.
51 # $(call make_depend,<source-file>,<source-file-to-generate-dependency-for)
52 define make_depend
53         $(CC) -MM -MQ'$(OBJECT_DIR)/$(2:%.c=%.o)' -MF'$(DEP_DIR)/$(2:%.c=%.d)' $(PP_FLAGS) $1 > /dev/null
54 endef
55
56
57 ifeq (on,$(OPENMP))
58   OPENMP_C_FLAGS  += -fopenmp
59   OPENMP_LD_FLAGS += -fopenmp
60 endif
61
62
63 ifeq (release,$(BUILD))
64
65   C_FLAGS      += -O3 $(TARCH)
66   LD_FLAGS     += -O3 $(TARCH)
67
68   PP_FLAGS     +=
69
70 else
71 ifeq (debug,$(BUILD))
72
73   C_FLAGS      += -O0 $(TARCH) -g -ggdb
74   LD_FLAGS     += -O0 $(TARCH) -g -ggdb
75
76   PP_FLAGS     += $(D)DEBUG
77
78 else
79   $(error unknown BUILD=$(BUILD), specify release or debug)
80 endif
81 endif
82
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
87 endif
88
89 ifeq (on,$(DEBUG_SYMBOLS))
90   C_FLAGS      += -g -ggdb
91   LD_FLAGS     += -g -ggdb
92 endif
93
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)
97 LD_LIBS        += -lm
98
This page took 0.079674 seconds and 4 git commands to generate.