1# Copyright (c) 2005-2020 Intel Corporation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15CPLUS ?= clang++
16CONLY ?= clang
17COMPILE_ONLY = -c -MMD
18PREPROC_ONLY = -E -x c++
19INCLUDE_KEY = -I
20DEFINE_KEY = -D
21OUTPUT_KEY = -o #
22OUTPUTOBJ_KEY = -o #
23PIC_KEY = -fPIC
24WARNING_AS_ERROR_KEY = -Werror
25WARNING_KEY = -Wall -Wextra
26TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor
27WARNING_SUPPRESS = -Wno-parentheses -Wno-non-virtual-dtor -Wno-dangling-else
28DYLIB_KEY = -shared
29EXPORT_KEY = -Wl,--version-script,
30LIBDL = -ldl
31
32LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
33LIBS += -lrt
34LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
35C_FLAGS = $(CPLUS_FLAGS)
36
37ifeq ($(cfg), release)
38        # -g is set intentionally in the release mode. It should not affect performance.
39        CPLUS_FLAGS = -O2
40endif
41ifeq ($(cfg), debug)
42        CPLUS_FLAGS = -DTBB_USE_DEBUG -O0 -g
43endif
44
45CPLUS_FLAGS += $(ITT_NOTIFY) -DUSE_PTHREAD -pthread
46LIB_LINK_FLAGS += -pthread
47
48ifneq (,$(stdlib))
49    CPLUS_FLAGS    += -stdlib=$(stdlib)
50    LIB_LINK_FLAGS += -stdlib=$(stdlib)
51endif
52
53ifneq (,$(gcc_version))
54    # TODO: do not assume that GCC minor and patchlevel versions are always single-digit.
55    CPLUS_FLAGS += -DTBB_USE_GLIBCXX_VERSION=$(subst .,0,$(gcc_version))
56endif
57
58TBB_ASM.OBJ=
59MALLOC_ASM.OBJ=
60
61ifeq (intel64,$(arch))
62    ITT_NOTIFY = -DDO_ITT_NOTIFY
63    CPLUS_FLAGS += -m64
64    LIB_LINK_FLAGS += -m64
65endif
66
67ifeq (ia32,$(arch))
68    ITT_NOTIFY = -DDO_ITT_NOTIFY
69    CPLUS_FLAGS += -m32 -march=pentium4
70    LIB_LINK_FLAGS += -m32
71endif
72
73ifeq (ppc64,$(arch))
74    CPLUS_FLAGS += -m64
75    LIB_LINK_FLAGS += -m64
76endif
77
78ifeq (ppc32,$(arch))
79    CPLUS_FLAGS += -m32
80    LIB_LINK_FLAGS += -m32
81endif
82
83ifeq (bg,$(arch))
84    CPLUS = bgclang++
85    CONLY = bgclang
86endif
87
88#------------------------------------------------------------------------------
89# Setting assembler data.
90#------------------------------------------------------------------------------
91ASM = as
92ifeq (intel64,$(arch))
93    ASM_FLAGS += --64
94endif
95ifeq (ia32,$(arch))
96    ASM_FLAGS += --32
97endif
98ifeq ($(cfg),debug)
99    ASM_FLAGS += -g
100endif
101
102ASSEMBLY_SOURCE=$(arch)-gas
103#------------------------------------------------------------------------------
104# End of setting assembler data.
105#------------------------------------------------------------------------------
106
107#------------------------------------------------------------------------------
108# Setting tbbmalloc data.
109#------------------------------------------------------------------------------
110
111M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
112
113#------------------------------------------------------------------------------
114# End of setting tbbmalloc data.
115#------------------------------------------------------------------------------
116