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)
9 DEVELOPER_DIR ?= /Applications/Xcode.app/Contents/Developer/
11 # the xnu build system will only ever call us with the default target
12 .DEFAULT_GOAL := install
14 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.common
16 OTHER_CFLAGS = -Weverything -Wno-gnu-union-cast -Wno-missing-field-initializers -Wno-partial-availability
17 OTHER_CFLAGS += -Wno-missing-noreturn -Wno-vla -Wno-reserved-id-macro -Wno-documentation-unknown-command
18 OTHER_CFLAGS += -Wno-padded -Wno-used-but-marked-unused -Wno-covered-switch-default
19 OTHER_CFLAGS += --std=gnu11 -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
20 OTHER_CFLAGS += -DT_NAMESPACE=xnu
22 CODESIGN:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign)
23 CODESIGN_ALLOCATE:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign_allocate)
25 # to have custom compiler flags to
26 # target: OTHER_CFLAGS += <my flags>
28 backtracing: OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
29 backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
31 data_protection: OTHER_LDFLAGS += -framework IOKit
33 kdebug: INVALID_ARCHS = i386
34 kdebug: OTHER_LDFLAGS = -lktrace
36 EXCLUDED_SOURCES += kperf_helpers.c
38 ifeq ($(PLATFORM),iPhoneOS)
39 CONFIG_FREEZE_DEFINE:= -DCONFIG_FREEZE
41 CONFIG_FREEZE_DEFINE:=
42 EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c
45 perf_compressor: OTHER_CFLAGS += $(CONFIG_FREEZE_DEFINE)
47 kperf: INVALID_ARCHS = i386
48 kperf: OTHER_CFLAGS += kperf_helpers.c
49 kperf: OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
50 kperf: OTHER_LDFLAGS += -framework kperf -framework kperfdata -lktrace
52 kperf_backtracing: INVALID_ARCHS = i386
53 kperf_backtracing: OTHER_CFLAGS += kperf_helpers.c
54 kperf_backtracing: OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
55 kperf_backtracing: OTHER_LDFLAGS += -framework kperf -framework kperfdata -lktrace
56 kperf_backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
58 mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
60 perf_exit: OTHER_LDFLAGS = -lktrace
61 perf_exit: INVALID_ARCHS = i386
63 task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
64 task_inspect: OTHER_CFLAGS += -DENTITLED=1
66 CUSTOM_TARGETS += perf_exit_proc
69 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
71 install-perf_exit_proc: perf_exit_proc
72 mkdir -p $(INSTALLDIR)
73 cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
75 perf_kdebug: INVALID_ARCHS = i386
77 stackshot_idle_25570396: INVALID_ARCHS = i386
78 stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
80 stackshot_block_owner_14362384: INVALID_ARCHS = i386
81 stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
83 ifeq ($(PLATFORM),iPhoneOS)
84 OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled
85 jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
86 jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1
87 jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
89 jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
90 jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
91 $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
94 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets