version 0.1
[LbmBenchmarkKernelsPublic.git] / src / config.linux-gcc.mk
CommitLineData
10988083
MW
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
29# ------------------------------------------------------------------------
30# C ompiler/linker to use.
31# Flags are specified at the end of the file.
32# ------------------------------------------------------------------------
33CC = gcc
34LD = gcc
35
36# ------------------------------------------------------------------------
37
38# Preprocessing variables.
39D = -D
40I = -I
41PP_FLAGS +=
42
43# Architecture to optimize for.
44TARCH ?= -mavx
45
46# Generated dependencies, can be left empty.
47MAKE_DEPEND = $(CC) -MM -MQ'$(OBJECT_DIR)/$(<:%.c=%.o)' -MF'$(DEP_DIR)/$(<:%.c=%.d)' $(PP_FLAGS) $< > /dev/null
48
49# Generates dependencies, can be left empty.
50# $(call make_depend,<source-file>,<source-file-to-generate-dependency-for)
51define make_depend
52 $(CC) -MM -MQ'$(OBJECT_DIR)/$(2:%.c=%.o)' -MF'$(DEP_DIR)/$(2:%.c=%.d)' $(PP_FLAGS) $1 > /dev/null
53endef
54
55
56ifeq (on,$(OPENMP))
57 OPENMP_C_FLAGS += -fopenmp
58 OPENMP_LD_FLAGS += -fopenmp
59endif
60
61
62ifeq (release,$(BUILD))
63
64 C_FLAGS += -O3 $(TARCH)
65 LD_FLAGS += -O3 $(TARCH)
66
67 PP_FLAGS +=
68
69else
70ifeq (debug,$(BUILD))
71
72 C_FLAGS += -O0 $(TARCH) -g -ggdb
73 LD_FLAGS += -O0 $(TARCH) -g -ggdb
74
75 PP_FLAGS += $(D)DEBUG
76
77else
78 $(error unknown BUILD=$(BUILD), specify release or debug)
79endif
80endif
81
82ifeq (on,$(ADDRESS_SANITIZER))
83 # see https://github.com/google/sanitizers/wiki/AddressSanitizerFlags for details
84 C_FLAGS += -fsanitize=address
85 LD_FLAGS += -fsanitize=address
86endif
87
88ifeq (on,$(DEBUG_SYMBOLS))
89 C_FLAGS += -g -ggdb
90 LD_FLAGS += -g -ggdb
91endif
92
93C_FLAGS += -Wall -Wuninitialized -Wunused-variable -Wshadow -fargument-noalias -fargument-noalias-anything -std=c99 \
94 -MT $@ -MF $(patsubst $(OBJECT_DIR)/%.o,$(DEP_DIR)/%.d,$@) -MMD $(OPENMP_C_FLAGS)
95LD_FLAGS += -Wall $(OPENMP_LD_FLAGS)
96LD_LIBS += -lm
97
This page took 0.070303 seconds and 5 git commands to generate.