add citation information
[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
8cafd9ea 28# TODO: add AVX512/HBM/Memkind support for GCC
10988083
MW
29
30# ------------------------------------------------------------------------
31# C ompiler/linker to use.
32# Flags are specified at the end of the file.
33# ------------------------------------------------------------------------
34CC = gcc
35LD = gcc
36
37# ------------------------------------------------------------------------
38
39# Preprocessing variables.
40D = -D
41I = -I
42PP_FLAGS +=
43
44# Architecture to optimize for.
45TARCH ?= -mavx
46
47# Generated dependencies, can be left empty.
48MAKE_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)
52define make_depend
53 $(CC) -MM -MQ'$(OBJECT_DIR)/$(2:%.c=%.o)' -MF'$(DEP_DIR)/$(2:%.c=%.d)' $(PP_FLAGS) $1 > /dev/null
54endef
55
56
57ifeq (on,$(OPENMP))
58 OPENMP_C_FLAGS += -fopenmp
59 OPENMP_LD_FLAGS += -fopenmp
60endif
61
62
63ifeq (release,$(BUILD))
64
65 C_FLAGS += -O3 $(TARCH)
66 LD_FLAGS += -O3 $(TARCH)
67
68 PP_FLAGS +=
69
70else
71ifeq (debug,$(BUILD))
72
73 C_FLAGS += -O0 $(TARCH) -g -ggdb
74 LD_FLAGS += -O0 $(TARCH) -g -ggdb
75
76 PP_FLAGS += $(D)DEBUG
77
78else
79 $(error unknown BUILD=$(BUILD), specify release or debug)
80endif
81endif
82
83ifeq (on,$(ADDRESS_SANITIZER))
84 # see https://github.com/google/sanitizers/wiki/AddressSanitizerFlags for details
85 C_FLAGS += -fsanitize=address
86 LD_FLAGS += -fsanitize=address
87endif
88
89ifeq (on,$(DEBUG_SYMBOLS))
90 C_FLAGS += -g -ggdb
91 LD_FLAGS += -g -ggdb
92endif
93
94C_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)
96LD_FLAGS += -Wall $(OPENMP_LD_FLAGS)
97LD_LIBS += -lm
98
This page took 0.094616 seconds and 5 git commands to generate.