1 PROJECT := xnu/darwintests
3 # When building as part of xnu_tests, we get passed a DSTROOT that's got the
4 # unit test path in it already. But, BASEDSTROOT doesn't, so use that instead.
6 override DSTROOT = $(BASEDSTROOT)
11 OTHER_LTE_INCLUDE_FILES += \
12 /System/Library/PrivateFrameworks/LoggingSupport.framework, \
13 /System/Library/PrivateFrameworks/MobileKeyBag.framework, \
14 /usr/local/lib/libdarwintest_utils.dylib, \
15 /usr/lib/libapple_crypto.dylib,
17 DEVELOPER_DIR ?= /Applications/Xcode.app/Contents/Developer/
19 # the xnu build system will only ever call us with the default target
20 .DEFAULT_GOAL := install
22 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.common
24 OTHER_CFLAGS = -Weverything -Wno-gnu-union-cast -Wno-missing-field-initializers -Wno-partial-availability
25 OTHER_CFLAGS += -Wno-missing-noreturn -Wno-vla -Wno-reserved-id-macro -Wno-documentation-unknown-command
26 OTHER_CFLAGS += -Wno-padded -Wno-used-but-marked-unused -Wno-covered-switch-default -Wno-nullability-extension
27 OTHER_CFLAGS += --std=gnu11 -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
28 OTHER_CFLAGS += -DT_NAMESPACE_PREFIX=xnu
29 OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
31 CODESIGN:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign)
32 CODESIGN_ALLOCATE:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign_allocate)
34 # to have custom compiler flags to
35 # target: OTHER_CFLAGS += <my flags>
37 avx: INVALID_ARCHS = i386
38 avx: OTHER_CFLAGS += -mavx512f -mavx512bw -mavx512vl
39 avx: OTHER_CFLAGS += -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
40 avx: CONFIG_FLAGS := $(filter-out -O%,$(CONFIG_FLAGS))
41 # Level 2 optimization must be used to prevent compiler from generating
42 # invalid instructions when compiling with AVX-512 flags.
43 avx: CONFIG_FLAGS += -O2
44 ifneq (osx,$(TARGET_NAME))
45 EXCLUDED_SOURCES += avx.c
48 backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
50 data_protection: OTHER_LDFLAGS += -framework IOKit
52 kdebug: INVALID_ARCHS = i386
53 kdebug: OTHER_LDFLAGS = -framework ktrace
55 EXCLUDED_SOURCES += kperf_helpers.c xnu_quick_test_helpers.c
57 ifeq ($(PLATFORM),iPhoneOS)
58 CONFIG_FREEZE_DEFINE:= -DCONFIG_FREEZE
60 CONFIG_FREEZE_DEFINE:=
61 EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c
64 perf_compressor: OTHER_CFLAGS += $(CONFIG_FREEZE_DEFINE)
65 perf_compressor: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
67 stackshot: OTHER_LDFLAGS += -lkdd -framework Foundation
68 stackshot: INVALID_ARCHS = i386
70 memorystatus_zone_test: INVALID_ARCHS = i386
71 memorystatus_zone_test: OTHER_CFLAGS += -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
72 memorystatus_zone_test: OTHER_LDFLAGS += -framework ktrace
73 memorystatus_zone_test: OTHER_LDFLAGS += -ldarwintest_utils
75 kpc: OTHER_LDFLAGS += -framework kperf
77 kperf: INVALID_ARCHS = i386
78 kperf: OTHER_CFLAGS += kperf_helpers.c
79 kperf: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace -ldarwintest_utils
81 kperf_backtracing: INVALID_ARCHS = i386
82 kperf_backtracing: OTHER_CFLAGS += kperf_helpers.c
83 kperf_backtracing: OTHER_LDFLAGS += -framework kperf -framework kperfdata -framework ktrace
84 kperf_backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
86 kevent_qos: OTHER_CFLAGS += -Wno-unused-macros
87 kevent_qos: OTHER_CFLAGS += -I $(OBJROOT)/
89 mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
91 monotonic_core: OTHER_LDFLAGS += -framework ktrace
92 monotonic_core: INVALID_ARCHS = i386
94 perf_exit: OTHER_LDFLAGS = -framework ktrace
95 perf_exit: INVALID_ARCHS = i386
96 perf_exit: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
98 perf_spawn_fork: CODE_SIGN_ENTITLEMENTS=./private_entitlement.plist
100 os_thread_self_restrict: os_thread_self_restrict.c os_thread_self_restrict-entitlements.plist
101 os_thread_self_restrict: CODE_SIGN_ENTITLEMENTS=os_thread_self_restrict-entitlements.plist
103 task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
104 task_inspect: OTHER_CFLAGS += -DENTITLED=1
106 CUSTOM_TARGETS += perf_exit_proc
109 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
111 install-perf_exit_proc: perf_exit_proc
112 mkdir -p $(INSTALLDIR)
113 cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
115 perf_kdebug: INVALID_ARCHS = i386
117 stackshot_idle_25570396: INVALID_ARCHS = i386
118 stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
120 stackshot_block_owner_14362384: INVALID_ARCHS = i386
121 stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
123 xnu_quick_test: OTHER_CFLAGS += xnu_quick_test_helpers.c
125 ifeq ($(PLATFORM),iPhoneOS)
126 OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled
127 jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
128 jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1
129 jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
131 jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
132 jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
133 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
136 task_info_28439149: CODE_SIGN_ENTITLEMENTS = ./task_for_pid_entitlement.plist
138 disk_mount_conditioner: disk_mount_conditioner*
139 disk_mount_conditioner: CODE_SIGN_ENTITLEMENTS=./disk_mount_conditioner-entitlements.plist
140 disk_mount_conditioner: OTHER_LDFLAGS += -ldarwintest_utils
142 OTHER_TEST_TARGETS += disk_mount_conditioner_unentitled
143 disk_mount_conditioner_unentitled: OTHER_CFLAGS += -DTEST_UNENTITLED
144 disk_mount_conditioner_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
145 disk_mount_conditioner_unentitled: disk_mount_conditioner.c
146 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
148 work_interval_test: CODE_SIGN_ENTITLEMENTS = work_interval_test.entitlements
149 work_interval_test: OTHER_CFLAGS += -DENTITLED=1
151 settimeofday_29193041_entitled: CODE_SIGN_ENTITLEMENTS = settimeofday_29193041.entitlements
152 thread_group_set_32261625: OTHER_LDFLAGS = -framework ktrace
153 thread_group_set_32261625: INVALID_ARCHS = i386
155 task_info: CODE_SIGN_ENTITLEMENTS = task_for_pid_entitlement.plist
157 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets