1 #include "<DEVELOPER_DIR>/Makefiles/CoreOS/Xcode/BSD.xcconfig"
4 SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator iphoneosnano iphonesimulatornano bridgeos
6 SDK_INSTALL_VARIANT = $(SDK_INSTALL_VARIANT_$(DRIVERKIT))
7 SDK_INSTALL_VARIANT_1 = driverkit
8 SDK_INSTALL_VARIANT_ = default
9 SDK_INSTALL_ROOT = $(SDK_INSTALL_ROOT_$(SDK_INSTALL_VARIANT))
10 SDK_INSTALL_ROOT_driverkit = $(DRIVERKITROOT)
11 SDK_INSTALL_HEADERS_ROOT = $(SDK_INSTALL_HEADERS_ROOT_$(SDK_INSTALL_VARIANT))
12 SDK_INSTALL_HEADERS_ROOT_driverkit = $(SDK_INSTALL_ROOT)/$(SDK_RUNTIME_HEADERS_PREFIX)
13 SDK_RUNTIME_HEADERS_PREFIX = Runtime
15 SRCROOT_SEARCH_PATHS = $(SRCROOT) $(SRCROOT)/include $(SRCROOT)/gen $(SRCROOT)/locale $(SRCROOT)/locale/FreeBSD $(SRCROOT)/stdtime/FreeBSD $(SRCROOT)/darwin
16 SYSTEM_FRAMEWORK_HEADERS = $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
17 SDK_SYSTEM_FRAMEWORK_HEADERS = $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders
18 HEADER_SEARCH_PATHS = $($(TARGET_NAME)_SEARCH_PATHS) $(DERIVED_FILES_DIR)/dtrace $(SRCROOT_SEARCH_PATHS) $(inherited)
19 SYSTEM_HEADER_SEARCH_PATHS = $(SYSTEM_FRAMEWORK_HEADERS) $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/usr/local/include $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/usr/include
20 SYSTEM_FRAMEWORK_SEARCH_PATHS = $(SDKROOT)/$(SDK_INSTALL_HEADERS_ROOT)/System/Library/Frameworks
21 ALWAYS_SEARCH_USER_PATHS = YES
23 BUILD_VARIANTS = normal
24 GCC_OPTIMIZATION_LEVEL = s
25 GCC_C_LANGUAGE_STANDARD = gnu11
26 GCC_ENABLE_OBJC_EXCEPTIONS = YES
27 GCC_SYMBOLS_PRIVATE_EXTERN = NO
28 GCC_DYNAMIC_NO_PIC = NO
29 GCC_THUMB_SUPPORT = YES
30 GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
32 //CLANG_WARN_INT_CONVERSION = YES
33 //CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
34 //GCC_WARN_64_TO_32_BIT_CONVERSION = YES
35 //GCC_WARN_SHADOW = YES
36 GCC_WARN_UNINITIALIZED_AUTOS = YES;
37 GCC_WARN_UNUSED_VARIABLE = YES;
38 GCC_WARN_ABOUT_RETURN_TYPE = YES;
39 //WARNING_CFLAGS = -Wall -Wextra
40 WARNING_CFLAGS = -Wall -Werror -Wno-error=shorten-64-to-32 -Wno-error=incompatible-pointer-types-discards-qualifiers -Wno-nullability-completeness
44 INSTALLHDRS_SCRIPT_PHASE = YES
45 INSTALLHDRS_COPY_PHASE = YES
47 VERSION_INFO_PREFIX = __attribute__((visibility("hidden")))
49 STRIP_INSTALLED_PRODUCT = NO
50 LD_DYLIB_INSTALL_NAME = $(SDK_INSTALL_ROOT)/usr/lib/system/$(EXECUTABLE_NAME)
53 BUILD_VARIANTS = normal debug
54 BUILD_ARCHIVES = Platform Base FreeBSD NetBSD TRE vCancelable vDarwinExtsn vDarwinExtsnCancelable vPre1050 vLegacy vInode32 FortifySource
56 // clang is desired over llvm-gcc for OSAtomics. However, it isn't capable of building armv6 correctly.
57 GCC_VERSION = com.apple.compilers.llvm.clang.1_0
58 GCC_VERSION[arch=armv6] = com.apple.compilers.llvmgcc42
60 EXECUTABLE_PREFIX = libsystem_
61 INSTALL_PATH = $(SDK_INSTALL_ROOT)/usr/lib/system
62 PUBLIC_HEADERS_FOLDER_PATH = $(SDK_INSTALL_HEADERS_ROOT)/usr/include
63 PRIVATE_HEADERS_FOLDER_PATH = $(SDK_INSTALL_HEADERS_ROOT)/usr/local/include
65 DARWIN_PUBLIC_HEADERS_FOLDER_PATH = $(SDK_INSTALL_HEADERS_ROOT)/usr/include/os
66 DARWIN_PRIVATE_HEADERS_FOLDER_PATH = $(SDK_INSTALL_HEADERS_ROOT)/usr/local/include/os
69 BASE_PREPROCESSOR_MACROS = __LIBC__ __DARWIN_UNIX03=1 __DARWIN_64_BIT_INO_T=1 __DARWIN_NON_CANCELABLE=1 __DARWIN_VERS_1050=1 _FORTIFY_SOURCE=0
70 OTHER_CFLAGS = -fdollars-in-identifiers -fno-common -fverbose-asm $($(TARGET_NAME)_CFLAGS) $(VARIANT_PREPROCESSOR_MACROS)
71 OTHER_CFLAGS_debug = -fstack-protector -fno-inline -O0 -DDEBUG=1
72 SIM_SUFFIX[sdk=*simulator*] = _sim
74 GCC_PREPROCESSOR_DEFINITIONS = $(BASE_PREPROCESSOR_MACROS)
76 // libsystem_c.dylib linking
77 CR_LDFLAGS = -lCrashReporterClient
78 LIBCOMPILER_RT_LDFLAGS = -lcompiler_rt
79 LIBMALLOC_LDFLAGS = -lsystem_malloc
80 LIBBLOCKS_LDFLAGS = -lsystem_blocks
81 LIBC_LDFLAGS = -lsystem_c
82 LIBDISPATCH_LDFLAGS = -ldispatch
83 LIBXPC_LDFLAGS = -lxpc
84 LIBPLATFORM_LDFLAGS = -lsystem$(SIM_SUFFIX)_platform
85 LIBPTHREAD_LDFLAGS = -lsystem$(SIM_SUFFIX)_pthread
86 LIBSYSCALL_LDFLAGS = -lsystem$(SIM_SUFFIX)_kernel
87 LIBM_LDFLAGS = -lsystem_m
88 LIBDYLD_LDFLAGS = -ldyld
89 LIBSYSTEM_C_LDFLAGS = -all_load -nostdlib -L$(SDK_INSTALL_ROOT)/usr/lib/system -umbrella System $(CR_LDFLAGS) $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBM_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(UPWARD_LDFLAGS) $(LIBSYSTEM_C_EXTRA_LDFLAGS_$(CURRENT_ARCH)) -Wl,-interposable_list,$(DERIVED_FILES_DIR)/interposable.list -Wl,-unexported_symbols_list,$(DERIVED_FILES_DIR)/unexport.list -Wl,-alias_list,$(SRCROOT)/xcodescripts/alias.list -Wl,-order_file,$(SRCROOT)/xcodescripts/Libc.order @$(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist
90 LIBSYSTEM_C_EXTRA_LDFLAGS_i386 = -Wl,-alias_list,$(SRCROOT)/xcodescripts/legacy_alias.list
93 // TODO: Remove upward links - mostly <rdar://problem/13183469>, macho is for assumes.c
94 UPWARD_LDFLAGS = -Wl,-upward-ldispatch -Wl,-upward-lmacho -Wl,-upward-lsystem_asl -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_info -Wl,-upward-lsystem_notify -Wl,-upward-lxpc -Wl,-upward-lcorecrypto -Wl,-upward-lsystem_trace $(OTHER_UPWARD_LDFLAGS)
95 UPWARD_LDFLAGS[sdk=driverkit*] = -Wl,-upward-lmacho -Wl,-upward-lsystem_blocks -Wl,-upward-lcorecrypto
97 LIBSYSTEM_DARWIN_LDFLAGS = -all_load -nostdlib -L$(SDK_INSTALL_ROOT)/usr/lib/system -umbrella System $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBM_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBBLOCKS_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBC_LDFLAGS) $(LIBDISPATCH_LDFLAGS) $(LIBXPC_LDFLAGS) -lmacho -ldyld -Wl,-upward-lsystem_trace
99 // libPlatform.a architectures
100 ARCH_FAMILY = $(ARCH_FAMILY_$(CURRENT_ARCH))
101 ARCH_FAMILY_x86_64 = x86_64
102 ARCH_FAMILY_i386 = i386
103 ARCH_FAMILY_armv6 = arm
104 ARCH_FAMILY_armv7 = arm
105 ARCH_FAMILY_armv7s = arm
106 ARCH_FAMILY_armv7f = arm
107 ARCH_FAMILY_armv7k = arm
108 ARCH_FAMILY_arm64 = arm64
111 Platform_INCLUDED_SOURCE_FILE_NAMES = forceLibcToBuild.c $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen)
112 Platform_INCLUDED_SOURCE_FILE_NAMES_gen = $(ARCH_FAMILY)/gen/*.c $(ARCH_FAMILY)/gen/*.s $(ARCH_FAMILY)/gen/*.S
115 FreeBSD_CFLAGS = -include $(SRCROOT)/fbsdcompat/_fbsd_compat_.h
116 FreeBSD_SEARCH_PATHS = $(SRCROOT)/fbsdcompat $(SRCROOT)/gdtoa $(SRCROOT)/gdtoa/FreeBSD
117 FreeBSD_EXCLUDED_SOURCE_GDTOA = gdtoa/FreeBSD/machdep* gdtoa-strtopx.c
118 // Include the correct parts of gdtoa per-arch
119 FreeBSD_INCLUDED_SOURCE_FILE_NAMES = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_$(ARCH_FAMILY))
120 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_x86_64 = gdtoa-strtopx.c machdep_ldisx.c
121 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_i386 = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_x86_64)
122 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_arm = machdep_ldisd.c
123 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_arm64 = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_arm)
126 NetBSD_CFLAGS = -include $(SRCROOT)/nbsdcompat/_nbsd_compat_.h
127 NetBSD_SEARCH_PATHS = $(SRCROOT)/nbsdcompat
130 TRE_CFLAGS = -DHAVE_CONFIG_H
131 TRE_SEARCH_PATHS = $(SRCROOT)/regex/TRE $(SRCROOT)/regex/FreeBSD
133 // libc_dyld static library
134 libc_dyld_CFLAGS = -fno-stack-check
136 // Files per architecture to exclude from the non-platform builds (because optimised versions exist in Platform)
137 BASE_INCLUDED_SOURCE_FILE_NAMES = $(BASE_INCLUDED_SOURCE_FILE_NAMES_$(ARCH_FAMILY))
138 BASE_EXCLUDED_SOURCE_FILE_NAMES = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_$(ARCH_FAMILY)) $(BASE_EXCLUDED_SOURCE_FILE_NAMES_$(VARIANT_PLATFORM_NAME))
139 BASE_EXCLUDED_SOURCE_FILE_NAMES_x86_64 = kvm.c nlist.c
140 BASE_EXCLUDED_SOURCE_FILE_NAMES_arm64 = kvm.c nlist.c
142 // Rune support isn't included on iOS but there's no better way to exclude their complication
143 BASE_EXCLUDED_SOURCE_FILE_NAMES_macosx = OSMemoryNotification.c
144 BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos = frune.c login.c logout.c mbrune.c runedepreciated.c setinvalidrune.c getmntinfo64.c
145 BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos)
146 BASE_EXCLUDED_SOURCE_FILE_NAMES_appletvos = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos)
147 BASE_EXCLUDED_SOURCE_FILE_NAMES_appletvsimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator)
148 BASE_EXCLUDED_SOURCE_FILE_NAMES_watchos = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos)
149 BASE_EXCLUDED_SOURCE_FILE_NAMES_watchsimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator)
150 BASE_EXCLUDED_SOURCE_FILE_NAMES_bridgeos = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos)
151 BASE_EXCLUDED_SOURCE_FILE_NAMES_driverkit = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_macosx) $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos) getlogin.c setlogin.c logwtmp.c utmpx.c utmpx-darwin.c daemon.c authentication.c pty.c opendev.c fparseln.c psort*.c crypt.c glob.c readpassphrase.c atexit_receipt.c debug_private.c sourcefilter.c inet*.c nsap_addr.c ascii2addr.c addr2ascii.c acl*.c filesec.c chmodx_np.c openx_np.c umaskx_np.c statx_np.c
153 // TODO: Remove these legacy platform names:
154 BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneosnano = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_watchos)
155 BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulatornano = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_watchsimulator)
158 SUPPORTS_TEXT_BASED_API = YES
159 TAPI_VERIFY_MODE = Pedantic
160 OTHER_TAPI_FLAGS = --no-infer-include-paths -umbrella System -extra-public-header $(TAPI_PUBLIC_HEADER_PATH) -extra-private-header $(TAPI_PRIVATE_HEADER_PATH)
161 TAPI_PUBLIC_HEADER_PATH = $(TAPI_PUBLIC_HEADER_PATH_$(DEPLOYMENT_LOCATION))
162 TAPI_PUBLIC_HEADER_PATH_NO = $(BUILT_PRODUCTS_DIR)$(PUBLIC_HEADERS_FOLDER_PATH)
163 TAPI_PUBLIC_HEADER_PATH_YES = $(DSTROOT)$(PUBLIC_HEADERS_FOLDER_PATH)
164 TAPI_PRIVATE_HEADER_PATH = $(TAPI_PRIVATE_HEADER_PATH_$(DEPLOYMENT_LOCATION))
165 TAPI_PRIVATE_HEADER_PATH_NO = $(BUILT_PRODUCTS_DIR)$(PRIVATE_HEADERS_FOLDER_PATH)
166 TAPI_PRIVATE_HEADER_PATH_YES = $(DSTROOT)$(PRIVATE_HEADERS_FOLDER_PATH)
167 TAPI_HEADER_SEARCH_PATHS =
169 // TODO: Remove this hack once Marzipan bringup is done
170 VARIANT_PLATFORM_NAME = $(VARIANT_PLATFORM_NAME_$(RC_MARZIPAN))
171 VARIANT_PLATFORM_NAME_YES = macosx
172 VARIANT_PLATFORM_NAME_ = $(VARIANT_PLATFORM_NAME_$(SDK_INSTALL_VARIANT))
173 VARIANT_PLATFORM_NAME_default = $(PLATFORM_NAME)
174 VARIANT_PLATFORM_NAME_driverkit = driverkit