aa2923baf7a3d62cf568692fc3ef61ba27ff936e
[platform/upstream/tbb.git] / build / macos.inc
1 # Copyright (c) 2005-2019 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 ####### Detections and Commands ###############################################
16
17 ifeq (icc,$(compiler))
18   export COMPILER_VERSION := ICC: $(shell icc -V </dev/null 2>&1 | grep 'Version')
19   ifneq (,$(findstring running on IA-32, $(COMPILER_VERSION)))
20     export arch:=ia32
21   else
22     ifneq (,$(findstring running on Intel(R) 64, $(COMPILER_VERSION)))
23       export arch:=intel64
24     endif
25   endif
26   ifeq (,$(arch))
27     $(warning "Unknown Intel compiler")
28   endif
29 endif
30
31 ifndef arch
32  ifeq ($(shell /usr/sbin/sysctl -n hw.machine),Power Macintosh)
33    ifeq ($(shell /usr/sbin/sysctl -n hw.optional.64bitops),1)
34      export arch:=ppc64
35    else
36      export arch:=ppc32
37    endif
38  else
39    ifeq ($(shell /usr/sbin/sysctl -n hw.optional.x86_64 2>/dev/null),1)
40      export arch:=intel64
41    else
42      export arch:=ia32
43    endif
44  endif
45 endif
46
47 ifndef runtime
48   clang_version:=$(shell clang -v 2>&1 >/dev/null | grep version | sed -e "s/.*version \(.*[0-9]\) .*/\1/")
49   ifndef os_version
50     os_version:=$(shell /usr/bin/sw_vers -productVersion)
51   endif
52   export runtime:=cc$(clang_version)_os$(os_version)
53 endif
54
55 native_compiler := clang
56 export compiler ?= clang
57 debugger ?= lldb
58
59 export stdlib ?= libc++
60
61 CMD=$(SHELL) -c
62 CWD=$(shell pwd)
63 RM?=rm -f
64 RD?=rmdir
65 MD?=mkdir -p
66 NUL= /dev/null
67 SLASH=/
68 MAKE_VERSIONS=sh $(tbb_root)/build/version_info_macos.sh $(VERSION_FLAGS) >version_string.ver
69 MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh DY
70
71 ifdef DYLD_LIBRARY_PATH
72         export DYLD_LIBRARY_PATH := .:$(DYLD_LIBRARY_PATH)
73 else
74         export DYLD_LIBRARY_PATH := .
75 endif
76
77 ####### Build settings ########################################################
78
79 OBJ=o
80 DLL=dylib
81 MALLOC_DLL?=$(DLL)
82 LIBEXT=dylib
83
84 def_prefix = $(if $(findstring 64,$(arch)),mac64,mac32)
85
86 TBB.LST = $(tbb_root)/src/tbb/$(def_prefix)-tbb-export.lst
87 TBB.DEF = $(TBB.LST:.lst=.def)
88 TBB.DLL = libtbb$(CPF_SUFFIX)$(DEBUG_SUFFIX).$(DLL)
89 TBB.LIB = $(TBB.DLL)
90 LINK_TBB.LIB = $(TBB.LIB)
91
92 MALLOC.DEF = $(MALLOC_ROOT)/$(def_prefix)-tbbmalloc-export.def
93 MALLOC.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(MALLOC_DLL)
94 MALLOC.LIB = $(MALLOC.DLL)
95 LINK_MALLOC.LIB = $(MALLOC.LIB)
96
97 MALLOCPROXY.DLL = libtbbmalloc_proxy$(DEBUG_SUFFIX).$(MALLOC_DLL)
98 MALLOCPROXY.LIB = $(MALLOCPROXY.DLL)
99 LINK_MALLOCPROXY.LIB = $(MALLOCPROXY.LIB)
100
101 TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh $(largs)
102
103 OPENCL.LIB = -framework OpenCL
104
105 MACOSX_DEPLOYMENT_TARGET ?= 10.11