]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/Makefile.common
xnu-3248.60.10.tar.gz
[apple/xnu.git] / tools / tests / Makefile.common
1 #
2 # Common definitions for test directories
3 #
4
5 XCRUN := /usr/bin/xcrun
6 SDKROOT ?= 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
11 SDKROOT_RESOLVED := $(shell xcrun -sdk $(SDKROOT) -show-sdk-path)
12 ifeq ($(strip $(SDKROOT)_$(SDKROOT_RESOLVED)),/_)
13 SDKROOT_RESOLVED := /
14 endif
15 override SDKROOT = $(SDKROOT_RESOLVED)
16
17 SDKVERSION := $(shell $(XCRUN) -sdk $(SDKROOT) -show-sdk-version)
18
19 PLATFORMPATH := $(shell xcrun -sdk $(SDKROOT) -show-sdk-platform-path)
20 PLATFORM := $(shell echo $(PLATFORMPATH) | sed 's,^.*/\([^/]*\)\.platform$$,\1,')
21
22 ifeq ($(PLATFORM),watchOS)
23 PLATFORM := WatchOS
24 endif
25
26 SUPPORTED_EMBEDDED_PLATFORMS := iPhoneOS iPhoneOSNano tvOS AppleTVOS WatchOS
27 Embedded = $(if $(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),YES,NO)
28
29 #
30 # Deployment target flag
31 #
32 ifeq ($(PLATFORM),MacOSX)
33 DEPLOYMENT_TARGET_FLAGS = -mmacosx-version-min=$(SDKVERSION)
34 else ifeq ($(PLATFORM),WatchOS)
35 DEPLOYMENT_TARGET_FLAGS = -mwatchos-version-min=$(SDKVERSION)
36 else ifeq ($(PLATFORM),tvOS)
37 DEPLOYMENT_TARGET_FLAGS = -mtvos-version-min=$(SDKVERSION)
38 else ifeq ($(PLATFORM),AppleTVOS)
39 DEPLOYMENT_TARGET_FLAGS = -mtvos-version-min=$(SDKVERSION)
40 else ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),)
41 DEPLOYMENT_TARGET_FLAGS = -miphoneos-version-min=$(SDKVERSION)
42 else ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
43 DEPLOYMENT_TARGET_FLAGS =
44 else
45 DEPLOYMENT_TARGET_FLAGS =
46 endif
47
48 DEPLOYMENT_TARGET_DEFINES = -DPLATFORM_$(PLATFORM)
49
50 ifeq ($(RC_XBS),YES)
51 _v =
52 else ifeq ($(VERBOSE),YES)
53 _v =
54 else
55 _v = @
56 endif