1 #include "<DEVELOPER_DIR>/Makefiles/CoreOS/Xcode/BSD.xcconfig"
4 SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator
5 SRCROOT_SEARCH_PATHS = $(SRCROOT) $(SRCROOT)/include $(SRCROOT)/gen $(SRCROOT)/locale $(SRCROOT)/locale/FreeBSD $(SRCROOT)/stdtime/FreeBSD
6 SYSTEM_FRAMEWORK_HEADERS = $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
7 HEADER_SEARCH_PATHS = $($(TARGET_NAME)_SEARCH_PATHS) $(DERIVED_FILES_DIR)/dtrace $(SRCROOT_SEARCH_PATHS) $(SYSTEM_FRAMEWORK_HEADERS) $(SDKROOT)/usr/local/include $(inherited)
8 ALWAYS_SEARCH_USER_PATHS = YES
10 BUILD_VARIANTS = normal
11 GCC_OPTIMIZATION_LEVEL = s
12 GCC_C_LANGUAGE_STANDARD = gnu99
13 GCC_ENABLE_OBJC_EXCEPTIONS = YES
14 GCC_SYMBOLS_PRIVATE_EXTERN = NO
15 GCC_DYNAMIC_NO_PIC = NO
16 GCC_THUMB_SUPPORT = YES
17 GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
18 GCC_WARN_UNINITIALIZED_AUTOS = YES;
19 GCC_WARN_UNUSED_VARIABLE = YES;
20 GCC_WARN_ABOUT_RETURN_TYPE = YES;
21 WARNING_CFLAGS = "-Wall";
25 INSTALLHDRS_SCRIPT_PHASE = YES
28 STRIP_INSTALLED_PRODUCT = NO
29 LD_DYLIB_INSTALL_NAME = /usr/lib/system/$(EXECUTABLE_NAME)
31 BUILD_VARIANTS = normal debug
32 BUILD_ARCHIVES = Platform Base FreeBSD NetBSD TRE vCancelable vDarwinExtsn vDarwinExtsnCancelable vPre1050 vLegacy vInode32 FortifySource
34 // clang is desired over llvm-gcc for OSAtomics. However, it isn't capable of building armv6 correctly.
35 GCC_VERSION = com.apple.compilers.llvm.clang.1_0
36 GCC_VERSION[arch=armv6] = com.apple.compilers.llvmgcc42
38 EXECUTABLE_PREFIX = libsystem_
39 INSTALL_PATH = /usr/lib/system
40 PUBLIC_HEADERS_FOLDER_PATH = /usr/include
41 PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include
44 EXECUTABLE_PREFIX[sdk=iphonesimulator*] = libsystem_sim_
45 PUBLIC_HEADERS_FOLDER_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/include
46 PRIVATE_HEADERS_FOLDER_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/local/include
47 INSTALL_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/lib/system
49 BASE_PREPROCESSOR_MACROS = __LIBC__ __DARWIN_UNIX03=1 __DARWIN_64_BIT_INO_T=1 __DARWIN_NON_CANCELABLE=1 __DARWIN_VERS_1050=1 _FORTIFY_SOURCE=0
50 OTHER_CFLAGS = -fdollars-in-identifiers -fno-common -fverbose-asm $($(TARGET_NAME)_CFLAGS) $(VARIANT_PREPROCESSOR_MACROS)
51 OTHER_CFLAGS_debug = -fstack-protector -fno-inline -O0 -DDEBUG=1
53 GCC_PREPROCESSOR_DEFINITIONS = $(BASE_PREPROCESSOR_MACROS)
54 GCC_PREPROCESSOR_DEFINITIONS[sdk=iphone*] = $(BASE_PREPROCESSOR_MACROS) LIBC_NO_LIBCRASHREPORTERCLIENT=1
56 // libsystem_c.dylib linking
57 CR_LDFLAGS[sdk=macosx*] = -lCrashReporterClient
58 LIBCOMPILER_RT_LDFLAGS = -lcompiler_rt
59 LIBCOMPILER_RT_LDFLAGS[sdk=iphonesimulator*] = -lcompiler_rt_sim
60 LIBMALLOC_LDFLAGS = -lsystem_malloc
61 LIBMALLOC_LDFLAGS[sdk=iphonesimulator*] =
62 LIBPLATFORM_LDFLAGS = -lsystem_platform
63 LIBPLATFORM_LDFLAGS[sdk=iphonesimulator*] =
64 LIBPTHREAD_LDFLAGS = -lsystem_pthread
65 LIBPTHREAD_LDFLAGS[sdk=iphonesimulator*] =
66 LIBSYSCALL_LDFLAGS = -lsystem_kernel
67 LIBSYSCALL_LDFLAGS[sdk=iphonesimulator*] =
68 LIBM_LDFLAGS = -lsystem_m
69 LIBM_LDFLAGS[sdk=iphonesimulator*] = -lsystem_sim_m
70 LIBDYLD_LDFLAGS = -ldyld
71 LIBDYLD_LDFLAGS[sdk=iphonesimulator*] = -ldyld_sim
72 LIBSYSTEM_C_LDFLAGS = -all_load -nostdlib -L/usr/lib/system -umbrella System $(CR_LDFLAGS) $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBM_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(UPWARD_LDFLAGS) -Wl,-interposable_list,$(DERIVED_FILES_DIR)/interposable.list -Wl,-unexported_symbols_list,$(DERIVED_FILES_DIR)/unexport.list -Wl,-alias_list,$(SRCROOT)/string/alias.list @$(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist
74 // TODO: Remove upward links - mostly <rdar://problem/13183469>, macho is for assumes.c
75 UPWARD_LDFLAGS = -Wl,-upward-ldispatch -Wl,-upward-llaunch -Wl,-upward-lmacho -Wl,-upward-lsystem_asl -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_info -Wl,-upward-lsystem_notify -Wl,-upward-lxpc
76 UPWARD_LDFLAGS[sdk=iphonesimulator*] = -Wl,-upward-ldispatch -Wl,-upward-lmacho_sim -Wl,-upward-lsystem_sim_blocks -Wl,-upward-lsystem_sim_info -Wl,-upward-lnotify_sim -Wl,-upward-lxpc -Wl,-upward-lSystem
78 // libPlatform.a architectures
79 ARCH_FAMILY = $(ARCH_FAMILY_$(CURRENT_ARCH))
80 ARCH_FAMILY_x86_64 = x86_64
81 ARCH_FAMILY_i386 = i386
82 ARCH_FAMILY_armv6 = arm
83 ARCH_FAMILY_armv7 = arm
84 ARCH_FAMILY_armv7s = arm
85 ARCH_FAMILY_armv7f = arm
86 ARCH_FAMILY_armv7k = arm
89 Platform_INCLUDED_SOURCE_FILE_NAMES = $(Platform_INCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME))
90 Platform_INCLUDED_SOURCE_FILE_NAMES_macosx = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) $(Platform_INCLUDED_SOURCE_FILE_NAMES_sys)
91 Platform_INCLUDED_SOURCE_FILE_NAMES_iphoneos = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) $(Platform_INCLUDED_SOURCE_FILE_NAMES_sys)
92 Platform_INCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string)
94 Platform_INCLUDED_SOURCE_FILE_NAMES_gen = $(ARCH_FAMILY)/gen/*.c $(ARCH_FAMILY)/gen/*.s $(ARCH_FAMILY)/gen/*.S
95 Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib = $(ARCH_FAMILY)/stdlib/*.c $(ARCH_FAMILY)/stdlib/*.s $(ARCH_FAMILY)/stdlib/*.S
96 Platform_INCLUDED_SOURCE_FILE_NAMES_string = $(ARCH_FAMILY)/string/*.c $(ARCH_FAMILY)/string/*.s $(ARCH_FAMILY)/string/*.S
97 Platform_INCLUDED_SOURCE_FILE_NAMES_sys = $(ARCH_FAMILY)/sys/*.c $(ARCH_FAMILY)/sys/*.s $(ARCH_FAMILY)/sys/*.S
100 FreeBSD_CFLAGS = -include $(SRCROOT)/fbsdcompat/_fbsd_compat_.h
101 FreeBSD_SEARCH_PATHS = $(SRCROOT)/fbsdcompat $(SRCROOT)/gdtoa $(SRCROOT)/gdtoa/FreeBSD
102 FreeBSD_EXCLUDED_SOURCE_GDTOA = gdtoa/FreeBSD/machdep* gdtoa-strtopx.c
103 // Include the correct parts of gdtoa per-arch
104 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_x86_64 = gdtoa-strtopx.c machdep_ldisx.c
105 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_i386 = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_x86_64)
106 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7 = machdep_ldisd.c
107 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7s = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7)
108 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7k = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7)
109 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7f = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7)
110 FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv6 = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7)
113 NetBSD_CFLAGS = -include $(SRCROOT)/nbsdcompat/_nbsd_compat_.h
114 NetBSD_SEARCH_PATHS = $(SRCROOT)/nbsdcompat
117 TRE_CFLAGS = -DHAVE_CONFIG_H
118 TRE_SEARCH_PATHS = $(SRCROOT)/regex/TRE $(SRCROOT)/regex/FreeBSD
120 // Files per architecture to exclude from the non-platform builds (because optimised versions exist in Platform)
121 BASE_EXCLUDED_SOURCE_FILE_NAMES = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH)) $(BASE_EXCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME))
122 BASE_EXCLUDED_SOURCE_FILE_NAMES_x86_64 = kvm.c nlist.c strcpy.c strlen.c strncpy.c strnlen.c
123 BASE_EXCLUDED_SOURCE_FILE_NAMES_i386 = strcpy.c strlcat.c strlcpy.c strlen.c strncpy.c
124 BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7 = strlen.c strnlen.c strstr.c
125 BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7s = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7)
126 BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7k = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7)
127 BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7f = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7)
128 BASE_EXCLUDED_SOURCE_FILE_NAMES_armv6 = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7)
130 // utmp/utmpx doesn't really fit in iOS, and this has some dependence on
131 // libasl, so ignore it for now.
132 BASE_EXCLUDED_SOURCE_FILE_NAMES_sim_utmpx = utmpx-darwin.c utmpx.c logwtmp.c
134 // Others which at one point in time were tied too closely to the host.
135 // It's probably a good idea to have only one set of functions accessing the
136 // environment at a given time, but the rest may not need to be excluded
137 // any more. This should be investigated.
138 BASE_EXCLUDED_SOURCE_FILE_NAMES_sim_misc = thread_stack_pcs.c backtrace.c getenv.c putenv.c setenv.c stack_protector.c crt_externs.c gettimeofday.c
140 BASE_EXCLUDED_SOURCE_FILE_NAMES_sim = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_sim_utmpx) $(BASE_EXCLUDED_SOURCE_FILE_NAMES_sim_misc)
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 OSThermalNotification.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_sim) $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos)
147 // <rdar://problem/9513665> - collate.c crashes llvm-gcc on armv6 with -Os + -gdwarf-2
148 COLLATE_C_CFLAGS_macosx_armv6 = -O1
150 // ARMv6 thumb doesn't support all the instructions needed for OSAtomics
151 OSATOMIC_C_CFLAGS_macosx_armv6 = -mno-thumb
152 OSATOMIC_C_CFLAGS_iphoneos_armv6 = -mno-thumb
154 // Make sure that OSAtomic isn't build unoptimised, otherwise the inlines
155 // don't do what they are designed to do.
156 OSATOMIC_C_CFLAGS = -Os -momit-leaf-frame-pointer $(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))