1 #include "<DEVELOPER_DIR>/Makefiles/CoreOS/Xcode/BSD.xcconfig"
6 SDKROOT = macosx.internal
7 SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator
8 BUILD_VARIANTS = normal debug dyld static
10 EXECUTABLE_PREFIX = lib
12 // Pick the right install locations depending on whether building for DriverKit SDK or not
13 SDK_INSTALL_VARIANT = $(SDK_INSTALL_VARIANT_$(DRIVERKIT))
14 SDK_INSTALL_VARIANT_1 = driverkit
15 SDK_INSTALL_VARIANT_ = default
16 SDK_INSTALL_ROOT = $(SDK_INSTALL_ROOT_$(SDK_INSTALL_VARIANT))
17 SDK_INSTALL_ROOT_driverkit = $(DRIVERKITROOT)
18 SDK_INSTALL_HEADERS_ROOT = $(SDK_INSTALL_HEADERS_ROOT_$(SDK_INSTALL_VARIANT))
19 SDK_INSTALL_HEADERS_ROOT_driverkit = $(SDK_INSTALL_ROOT)/$(SDK_RUNTIME_HEADERS_PREFIX)
20 SDK_RUNTIME_HEADERS_PREFIX = Runtime
22 INSTALL_PATH = $(SDK_INSTALL_ROOT)/usr/lib/system
23 PUBLIC_HEADERS_FOLDER_PATH=$(SDK_INSTALL_HEADERS_ROOT)/usr/include
24 PRIVATE_HEADERS_FOLDER_PATH=$(SDK_INSTALL_HEADERS_ROOT)/usr/local/include
28 INSTALLHDRS_SCRIPT_PHASE = YES
30 GCC_OPTIMIZATION_LEVEL = s
32 // TODO: Remove -fno-stack-protector once it has been moved down (after libproc is moved down)
33 OTHER_CFLAGS = -fno-stack-protector -fdollars-in-identifiers -fno-common -fverbose-asm $(COMPILER_CFLAGS) $(PLATFORM_CFLAGS)
34 OTHER_CFLAGS_normal = -momit-leaf-frame-pointer
35 OTHER_CFLAGS_debug = -fno-inline -O0
37 GCC_PREPROCESSOR_DEFINITIONS = _FORTIFY_SOURCE=0 $(OSATOMIC_PREPROCESSOR_DEFINITIONS) $(PLATFORM_PREPROCESSOR_DEFINITIONS) $(GCC_PREPROCESSOR_DEFINITIONS_$(CURRENT_VARIANT))
38 GCC_PREPROCESSOR_DEFINITIONS_dyld = VARIANT_DYLD=1 VARIANT_NO_RESOLVERS=1 VARIANT_STATIC=1
39 GCC_PREPROCESSOR_DEFINITIONS_static = VARIANT_NO_RESOLVERS=1 VARIANT_STATIC=1
40 GCC_PREPROCESSOR_DEFINITIONS_debug = DEBUG=1
42 OSATOMIC_PREPROCESSOR_DEFINITIONS = OSATOMIC_USE_INLINED=0 OSATOMIC_DEPRECATED=0 OSSPINLOCK_USE_INLINED=1 OS_UNFAIR_LOCK_INLINE=0
44 STRIP_INSTALLED_PRODUCT = $(STRIP_INSTALLED_PRODUCT_$(CURRENT_VARIANT))
45 STRIP_INSTALLED_PRODUCT_normal = YES
46 STRIP_INSTALLED_PRODUCT_dyld = NO
47 STRIP_INSTALLED_PRODUCT_static = NO
48 STRIP_INSTALLED_PRODUCT_debug = YES
50 SRCROOT_SEARCH_PATHS = $(SRCROOT)/private $(SRCROOT)/include $(SRCROOT)/internal
51 HEADER_SEARCH_PATHS = $(SRCROOT_SEARCH_PATHS) $(inherited)
52 SYSTEM_HEADER_SEARCH_PATHS = $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/Frameworks/System.framework/PrivateHeaders $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/usr/local/include $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/usr/include
53 SYSTEM_FRAMEWORK_SEARCH_PATHS = $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/Frameworks
55 DEAD_CODE_STRIPPING = NO
57 LINK_WITH_STANDARD_LIBRARIES = NO
58 DYLIB_CURRENT_VERSION = $(CURRENT_PROJECT_VERSION)
60 PLATFORM_LIBRARIES = $(CONFIGURATION_BUILD_DIR)/libsimple_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libatomics_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libcachecontrol_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libos_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libsetjmp_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libstring_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libucontext_$(CURRENT_VARIANT).a
61 ATOMICS_LIBRARIES = $(CONFIGURATION_BUILD_DIR)/libatomics_i386_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libatomics_x86_64_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libatomics_arm_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libatomics_arm64_$(CURRENT_VARIANT).a $(EXTRA_ATOMICS_LIBRARIES)
62 CACHECONTROL_LIBRARIES = $(CONFIGURATION_BUILD_DIR)/libcachecontrol_i386_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libcachecontrol_x86_64_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libcachecontrol_arm_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libcachecontrol_arm64_$(CURRENT_VARIANT).a $(EXTRA_CACHECONTROL_LIBRARIES)
63 SETJMP_LIBRARIES = $(CONFIGURATION_BUILD_DIR)/libsetjmp_i386_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libsetjmp_x86_64_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libsetjmp_arm_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libsetjmp_arm64_$(CURRENT_VARIANT).a $(EXTRA_SETJMP_LIBRARIES)
64 STRING_LIBRARIES = $(CONFIGURATION_BUILD_DIR)/libstring_i386_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libstring_x86_64_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libstring_arm_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libstring_arm64_$(CURRENT_VARIANT).a $(EXTRA_STRING_LIBRARIES)
65 UCONTEXT_LIBRARIES = $(CONFIGURATION_BUILD_DIR)/libucontext_i386_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libucontext_x86_64_$(CURRENT_VARIANT).a $(CONFIGURATION_BUILD_DIR)/libucontext_arm64_$(CURRENT_VARIANT).a
70 SIMULATOR_LDFLAGS[sdk=macosx*] = -Wl,-simulator_support
72 OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(TARGET_NAME)) $(CR_LDFLAGS)
73 OTHER_LDFLAGS_libsystem_platform = -all_load $(PLATFORM_LIBRARIES) -umbrella System -L$(SDK_INSTALL_ROOT)/usr/lib/system $(ldyld) $(lsystem_kernel) -Wl,-alias_list,$(SRCROOT)/xcodeconfig/libplatform.aliases,$(DIRTY_DATA_LDFLAGS) $(SIMULATOR_LDFLAGS)
75 OTHER_LIBTOOLFLAGS = $(OTHER_LIBTOOLFLAGS_$(TARGET_NAME))
76 OTHER_LIBTOOLFLAGS_libplatform_simple_dyld = $(CONFIGURATION_BUILD_DIR)/libsimple_$(CURRENT_VARIANT).a
77 OTHER_LIBTOOLFLAGS_libplatform_string_dyld = $(CONFIGURATION_BUILD_DIR)/libstring_$(CURRENT_VARIANT).a
78 OTHER_LIBTOOLFLAGS_libplatform_os_dyld =
79 OTHER_LIBTOOLFLAGS_libplatform_dyld = $(PLATFORM_LIBRARIES)
80 OTHER_LIBTOOLFLAGS_libplatform_static = $(PLATFORM_LIBRARIES)
81 OTHER_LIBTOOLFLAGS_libatomics = $(ATOMICS_LIBRARIES)
82 OTHER_LIBTOOLFLAGS_libcachecontrol = $(CACHECONTROL_LIBRARIES)
83 OTHER_LIBTOOLFLAGS_libos = $(OS_LIBRARIES_$(CURRENT_VARIANT))
84 OTHER_LIBTOOLFLAGS_libsetjmp = $(SETJMP_LIBRARIES)
85 OTHER_LIBTOOLFLAGS_libstring = $(STRING_LIBRARIES)
86 OTHER_LIBTOOLFLAGS_libucontext = $(UCONTEXT_LIBRARIES)
88 lsystem_kernel = -lsystem_kernel
89 lsystem_kernel[sdk=iphonesimulator*] = -lsystem_sim_kernel
91 // rdar://problem/46882983&54282933
92 // On macOS, to support the i386 watchOS Simulator, we will continue building
93 // libplatform with an i386 slice for the foreseeable future, even though the
94 // rest of the OS has dropped i386. (This also applies to libpthread and
95 // libsyscall). Normally, dylibs with any dependency on another dylib need
96 // to link libdyld for lazy stub binding. libdyld has many dependencies, so
97 // that would create a dependency cycle that leads to the whole libSystem
98 // umbrella keeping an i386 slice. Instead, ld64 has changed so that the
99 // i386 simulator_support slice of libplatform doesn't use lazy binding and so
100 // doesn't need -ldyld.
101 // So, to break the dependency cycle, macOS libplatform will not link libdyld.
102 // All other platforms (including DriverKit on macOS) will continue to link