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
15ifneq ($(arch),$(filter $(arch),ia32 intel64 armv7 armv7s arm64))
16  $(error $(arch) is unknown architecture. Known arhitechtures are ia32 intel64 armv7 armv7s arm64)
17endif
18
19# If target is ios but arch is ia32/intel64 then build for 32/64 simulator!
20ifeq (,$(SDKROOT))
21  ifeq ($(arch),$(filter $(arch),ia32 intel64))
22    export SDKROOT:=$(shell xcodebuild -sdk -version | grep -o -E '/.*SDKs/iPhoneSimulator.*' 2>/dev/null)
23  else
24    export SDKROOT:=$(shell xcodebuild -sdk -version | grep -o -E '/.*SDKs/iPhoneOS.*' 2>/dev/null)
25  endif
26endif
27ifeq (,$(SDKROOT))
28  $(error iOS* SDK not found)
29endif
30
31ios_version:=$(shell echo $(SDKROOT) | sed -e "s/.*[a-z,A-Z]\(.*\).sdk/\1/")
32runtime:=cc$(clang_version)_ios$(ios_version)
33
34IPHONEOS_DEPLOYMENT_TARGET ?= 8.0
35