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
15#------------------------------------------------------------------------------
16# Defines settings for building the TBB run-time as a static library.
17# Use these only on platforms where dynamic linking is impractical.
18#
19# IF YOU USE TBB AS A STATIC LIBRARY, YOU MUST GUARANTEE THAT ONLY ONE COPY OF
20# THE TBB RUN-TIME IS LINKED INTO AN APPLICATION!  LINKING IN MULTIPLE COPIES
21# OF THE TBB RUN-TIME, DIRECTLY OR INDIRECTLY, MAY CAUSE PROGRAM FAILURE!
22#------------------------------------------------------------------------------
23
24# Note that ITT_NOTIFY allows to selectively remove the definition of
25# DO_ITT_NOTIFY without sabotaging deferred expansion of CPLUS_FLAGS.
26# TODO: currently only in linux.{gcc,xl}.inc
27
28# Note that -pthread with xl gives "1501-210 (W) command option t contains an incorrect subargument";
29# multithreading is instead achieved by using the _r affix in the compiler name.
30# TODO: is -lpthread still relevant/needed with XL and _r affix?
31
32# Note that usage of dynamic (shared) libraries is disabled
33# (via -D__TBB_DYNAMIC_LOAD_ENABLED=0 and LIBDL emptied) primarily for performance.
34
35# OS specific settings =>
36    LIB_LINK_CMD = ar rcs
37    LIB_LINK_FLAGS =
38    LIB_LINK_LIBS =
39    LIB_OUTPUT_KEY =
40    DYLIB_KEY =
41    ifeq ($(tbb_os),linux)
42        ifeq ($(compiler),clang)
43            LIBS = -pthread -lrt
44        endif
45        ifeq ($(compiler),gcc)
46            LIBS = -pthread -lrt
47        endif
48        ifeq ($(compiler),xl)
49            LIBS = -lpthread -lrt
50        endif
51        LINK_FLAGS =
52    endif
53    override CXXFLAGS += -D__TBB_DYNAMIC_LOAD_ENABLED=0 -D__TBB_SOURCE_DIRECTLY_INCLUDED=1
54    ITT_NOTIFY =
55    DLL = a
56    LIBEXT = a
57    LIBPREF = lib
58    LIBDL =
59# <= OS specific settings
60
61TBB.DLL = $(LIBPREF)tbb$(DEBUG_SUFFIX).$(LIBEXT)
62LINK_TBB.LIB = $(TBB.DLL)
63TBB.LST =
64TBB.DEF =
65TBB_NO_VERSION.DLL =
66
67MALLOC.DLL = $(LIBPREF)tbbmalloc$(DEBUG_SUFFIX).$(LIBEXT)
68LINK_MALLOC.LIB = $(MALLOC.DLL)
69MALLOC.DEF =
70MALLOC_NO_VERSION.DLL =
71MALLOCPROXY.DLL =
72MALLOCPROXY.DEF =
73