]> git.saurik.com Git - apple/xnu.git/blame - tools/tests/Makefile.common
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tools / tests / Makefile.common
CommitLineData
3e170ce0
A
1#
2# Common definitions for test directories
3#
4
5XCRUN := /usr/bin/xcrun
6SDKROOT ?= macosx.internal
7
8# SDKROOT may be passed as a shorthand like "iphoneos.internal". We
9# must resolve these to a full path and override SDKROOT.
10
11SDKROOT_RESOLVED := $(shell xcrun -sdk $(SDKROOT) -show-sdk-path)
12ifeq ($(strip $(SDKROOT)_$(SDKROOT_RESOLVED)),/_)
13SDKROOT_RESOLVED := /
14endif
15override SDKROOT = $(SDKROOT_RESOLVED)
16
17SDKVERSION := $(shell $(XCRUN) -sdk $(SDKROOT) -show-sdk-version)
18
19PLATFORMPATH := $(shell xcrun -sdk $(SDKROOT) -show-sdk-platform-path)
20PLATFORM := $(shell echo $(PLATFORMPATH) | sed 's,^.*/\([^/]*\)\.platform$$,\1,')
21
22ifeq ($(PLATFORM),watchOS)
23 PLATFORM := WatchOS
24endif
25
5ba3f43e 26SUPPORTED_EMBEDDED_PLATFORMS := iPhoneOS iPhoneOSNano tvOS AppleTVOS WatchOS BridgeOS
3e170ce0
A
27Embedded = $(if $(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),YES,NO)
28
29#
30# Deployment target flag
31#
32ifeq ($(PLATFORM),MacOSX)
33 DEPLOYMENT_TARGET_FLAGS = -mmacosx-version-min=$(SDKVERSION)
34else ifeq ($(PLATFORM),WatchOS)
35 DEPLOYMENT_TARGET_FLAGS = -mwatchos-version-min=$(SDKVERSION)
36else ifeq ($(PLATFORM),tvOS)
37 DEPLOYMENT_TARGET_FLAGS = -mtvos-version-min=$(SDKVERSION)
38else ifeq ($(PLATFORM),AppleTVOS)
39 DEPLOYMENT_TARGET_FLAGS = -mtvos-version-min=$(SDKVERSION)
5ba3f43e
A
40else ifeq ($(PLATFORM),BridgeOS)
41 DEPLOYMENT_TARGET_FLAGS = -mbridgeos-version-min=$(SDKVERSION)
3e170ce0
A
42else ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),)
43 DEPLOYMENT_TARGET_FLAGS = -miphoneos-version-min=$(SDKVERSION)
44else ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
45 DEPLOYMENT_TARGET_FLAGS =
46else
47 DEPLOYMENT_TARGET_FLAGS =
48endif
49
50DEPLOYMENT_TARGET_DEFINES = -DPLATFORM_$(PLATFORM)
490019cf
A
51
52ifeq ($(RC_XBS),YES)
53_v =
54else ifeq ($(VERBOSE),YES)
55_v =
56else
57_v = @
58endif
f427ee49
A
59
60# These are convenience functions for filtering based on substrings, as the
61# normal filter functions only accept one wildcard.
62FILTER_OUT_SUBSTRING=$(strip $(foreach string,$(2),$(if $(findstring $(1),$(string)),,$(string))))
63FILTER_SUBSTRING=$(strip $(foreach string,$(2),$(if $(findstring $(1),$(string)),$(string),)))
64
65#arch configs if not provided
66ifdef RC_ARCHS
67ARCH_CONFIGS:=$(RC_ARCHS)
68endif
69
70ifeq ($(ARCH_CONFIGS),)
71PLATFORM_LOWERCASE:=$(shell echo "$(PLATFORM)" | tr A-Z a-z)
72ARCH_CONFIGS:=$(shell /usr/bin/plutil -extract SupportedTargets.$(PLATFORM_LOWERCASE).Archs json -o - $(SDKROOT)/SDKSettings.plist | tr '",[]' ' ')
73PLATFORM_LOWERCASE:=
74endif
75
76ARCH_CONFIGS_32:=$(call FILTER_OUT_SUBSTRING,64,$(ARCH_CONFIGS))
77ARCH_CONFIGS_64:=$(call FILTER_SUBSTRING,64,$(ARCH_CONFIGS))
78ARCH_CONFIGS_x86:=$(call FILTER_SUBSTRING,x86_64,$(ARCH_CONFIGS))
79
80ARCH_FLAGS:=$(foreach argarch,$(ARCH_CONFIGS), -arch $(argarch) )
81ARCH_FLAGS_32:=$(foreach argarch,$(ARCH_CONFIGS_32), -arch $(argarch) )
82ARCH_FLAGS_64:=$(foreach argarch,$(ARCH_CONFIGS_64), -arch $(argarch) )
83ARCH_FLAGS_x86:=$(foreach argarch,$(ARCH_CONFIGS_x86), -arch $(argarch) )