+ifeq ($(PLATFORM),MacOSX)
+TARGETS += pthread_jit_write_protection
+pthread_jit_write_protection: CODE_SIGN_ENTITLEMENTS=pthread_jit_write_protection-entitlements.plist
+endif
+
+# this should be CUSTOM_TARGETS, see "Compatibility defines" in Makefile.targets
+OTHER_TARGETS := stackoverflow_crash
+
+OTHER_LTE_INCLUDE_FILES += \
+ /usr/local/lib/libdarwintest_utils.dylib
+
+OTHER_CFLAGS := -DDARWINTEST -Weverything \
+ -Wno-vla -Wno-bad-function-cast -Wno-missing-noreturn \
+ -Wno-missing-field-initializers -Wno-format-pedantic \
+ -Wno-gnu-folding-constant -Wno-used-but-marked-unused \
+ -Wno-padded
+OTHER_LDFLAGS := -ldarwintest_utils
+
+#TARGETS += main_stack_legacy // Disabled by default due to linker warnings
+#main_stack_legacy: OTHER_LDFLAGS += -Wl,-stack_addr,0xc1000000 -Wl,-stack_size,0x0f00000
+#main_stack_legacy: OTHER_CFLAGS += -DSTACKSIZE=0x0f00000
+#main_stack_legacy: ARCH_FLAGS = -arch i386
+#main_stack_legacy: DEPLOYMENT_TARGET_FLAGS = -mmacosx-version-min=10.7
+
+main_stack_custom: OTHER_LDFLAGS += -Wl,-stack_size,0x124000
+main_stack_custom: OTHER_CFLAGS += -DSTACKSIZE=0x124000
+
+bsdthread_set_self: OTHER_CFLAGS += -D_DARWIN_FEATURE_CLOCK_GETTIME
+
+include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets
+
+stackoverflow_crash: helpers/stackoverflow_crash.c
+ mkdir -p $(SYMROOT)/assets/
+ $(CC) -o $(SYMROOT)/assets/$@ $(CFLAGS) -D_POSIX_C_SOURCE=1 $(OTHER_CFLAGS) $(LDFLAGS) $(OTHER_LDFLAGS) $<
+ env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) $(CODESIGN) --force --sign - --timestamp=none $(SYMROOT)/assets/$@
+
+install-stackoverflow_crash: stackoverflow_crash
+ mkdir -p $(INSTALLDIR)/assets
+ @cp $(SYMROOT)/assets/stackoverflow_crash $(INSTALLDIR)/assets