this repo has no description
at master 371 lines 15 kB view raw
1/* 2 * Copyright (c) 2000-2014 by Apple Inc.. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24/* 25 File: TargetConditionals.h 26 27 Contains: Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone 28 29 Note: TargetConditionals.h in 3.4 Universal Interfaces works 30 with all compilers. This header only recognizes compilers 31 known to run on Mac OS X. 32 33*/ 34 35#ifndef __TARGETCONDITIONALS__ 36#define __TARGETCONDITIONALS__ 37/**************************************************************************************************** 38 39 TARGET_CPU_* 40 These conditionals specify which microprocessor instruction set is being 41 generated. At most one of these is true, the rest are false. 42 43 TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode 44 TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode 45 TARGET_CPU_68K - Compiler is generating 680x0 instructions 46 TARGET_CPU_X86 - Compiler is generating x86 instructions 47 TARGET_CPU_ARM - Compiler is generating ARM instructions 48 TARGET_CPU_MIPS - Compiler is generating MIPS instructions 49 TARGET_CPU_SPARC - Compiler is generating Sparc instructions 50 TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions 51 52 53 TARGET_OS_* 54 These conditionals specify in which Operating System the generated code will 55 run. Indention is used to show which conditionals are evolutionary subclasses. 56 57 The MAC/WIN32/UNIX conditionals are mutually exclusive. 58 The IOS/TV/WATCH conditionals are mutually exclusive. 59 60 61 TARGET_OS_WIN32 - Generated code will run under 32-bit Windows 62 TARGET_OS_UNIX - Generated code will run under some Unix (not OSX) 63 TARGET_OS_MAC - Generated code will run under Mac OS X variant 64 TARGET_OS_OSX - Generated code will run under OS X devices 65 TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator 66 TARGET_OS_IOS - Generated code will run under iOS 67 TARGET_OS_TV - Generated code will run under Apple TV OS 68 TARGET_OS_WATCH - Generated code will run under Apple Watch OS 69 TARGET_OS_BRIDGE - Generated code will run under Bridge devices 70 TARGET_OS_SIMULATOR - Generated code will run under a simulator 71 TARGET_OS_EMBEDDED - Generated code for firmware 72 73 TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR 74 TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH 75 76 TARGET_RT_* 77 These conditionals specify in which runtime the generated code will 78 run. This is needed when the OS and CPU support more than one runtime 79 (e.g. Mac OS X supports CFM and mach-o). 80 81 TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers 82 TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers 83 TARGET_RT_64_BIT - Generated code uses 64-bit pointers 84 TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used 85 TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used 86 87 88****************************************************************************************************/ 89 90 91/* 92 * gcc based compiler used on Mac OS X 93 */ 94#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) ) 95 #define TARGET_OS_MAC 1 96 #define TARGET_OS_WIN32 0 97 #define TARGET_OS_UNIX 0 98 #define TARGET_OS_OSX 1 99 #define TARGET_OS_IPHONE 0 100 #define TARGET_OS_IOS 0 101 #define TARGET_OS_WATCH 0 102 #define TARGET_OS_BRIDGE 0 103 #define TARGET_OS_TV 0 104 #define TARGET_OS_SIMULATOR 0 105 #define TARGET_OS_EMBEDDED 0 106 #define TARGET_IPHONE_SIMULATOR TARGET_OS_SIMULATOR /* deprecated */ 107 #define TARGET_OS_NANO TARGET_OS_WATCH /* deprecated */ 108 #if defined(__ppc__) 109 #define TARGET_CPU_PPC 1 110 #define TARGET_CPU_PPC64 0 111 #define TARGET_CPU_68K 0 112 #define TARGET_CPU_X86 0 113 #define TARGET_CPU_X86_64 0 114 #define TARGET_CPU_ARM 0 115 #define TARGET_CPU_ARM64 0 116 #define TARGET_CPU_MIPS 0 117 #define TARGET_CPU_SPARC 0 118 #define TARGET_CPU_ALPHA 0 119 #define TARGET_RT_LITTLE_ENDIAN 0 120 #define TARGET_RT_BIG_ENDIAN 1 121 #define TARGET_RT_64_BIT 0 122 #ifdef __MACOS_CLASSIC__ 123 #define TARGET_RT_MAC_CFM 1 124 #define TARGET_RT_MAC_MACHO 0 125 #else 126 #define TARGET_RT_MAC_CFM 0 127 #define TARGET_RT_MAC_MACHO 1 128 #endif 129 #elif defined(__ppc64__) 130 #define TARGET_CPU_PPC 0 131 #define TARGET_CPU_PPC64 1 132 #define TARGET_CPU_68K 0 133 #define TARGET_CPU_X86 0 134 #define TARGET_CPU_X86_64 0 135 #define TARGET_CPU_ARM 0 136 #define TARGET_CPU_ARM64 0 137 #define TARGET_CPU_MIPS 0 138 #define TARGET_CPU_SPARC 0 139 #define TARGET_CPU_ALPHA 0 140 #define TARGET_RT_LITTLE_ENDIAN 0 141 #define TARGET_RT_BIG_ENDIAN 1 142 #define TARGET_RT_64_BIT 1 143 #define TARGET_RT_MAC_CFM 0 144 #define TARGET_RT_MAC_MACHO 1 145 #elif defined(__i386__) 146 #define TARGET_CPU_PPC 0 147 #define TARGET_CPU_PPC64 0 148 #define TARGET_CPU_68K 0 149 #define TARGET_CPU_X86 1 150 #define TARGET_CPU_X86_64 0 151 #define TARGET_CPU_ARM 0 152 #define TARGET_CPU_ARM64 0 153 #define TARGET_CPU_MIPS 0 154 #define TARGET_CPU_SPARC 0 155 #define TARGET_CPU_ALPHA 0 156 #define TARGET_RT_MAC_CFM 0 157 #define TARGET_RT_MAC_MACHO 1 158 #define TARGET_RT_LITTLE_ENDIAN 1 159 #define TARGET_RT_BIG_ENDIAN 0 160 #define TARGET_RT_64_BIT 0 161 #elif defined(__x86_64__) 162 #define TARGET_CPU_PPC 0 163 #define TARGET_CPU_PPC64 0 164 #define TARGET_CPU_68K 0 165 #define TARGET_CPU_X86 0 166 #define TARGET_CPU_X86_64 1 167 #define TARGET_CPU_ARM 0 168 #define TARGET_CPU_ARM64 0 169 #define TARGET_CPU_MIPS 0 170 #define TARGET_CPU_SPARC 0 171 #define TARGET_CPU_ALPHA 0 172 #define TARGET_RT_MAC_CFM 0 173 #define TARGET_RT_MAC_MACHO 1 174 #define TARGET_RT_LITTLE_ENDIAN 1 175 #define TARGET_RT_BIG_ENDIAN 0 176 #define TARGET_RT_64_BIT 1 177 #elif defined(__arm__) 178 #define TARGET_CPU_PPC 0 179 #define TARGET_CPU_PPC64 0 180 #define TARGET_CPU_68K 0 181 #define TARGET_CPU_X86 0 182 #define TARGET_CPU_X86_64 0 183 #define TARGET_CPU_ARM 1 184 #define TARGET_CPU_ARM64 0 185 #define TARGET_CPU_MIPS 0 186 #define TARGET_CPU_SPARC 0 187 #define TARGET_CPU_ALPHA 0 188 #define TARGET_RT_MAC_CFM 0 189 #define TARGET_RT_MAC_MACHO 1 190 #define TARGET_RT_LITTLE_ENDIAN 1 191 #define TARGET_RT_BIG_ENDIAN 0 192 #define TARGET_RT_64_BIT 0 193 #elif defined(__arm64__) 194 #define TARGET_CPU_PPC 0 195 #define TARGET_CPU_PPC64 0 196 #define TARGET_CPU_68K 0 197 #define TARGET_CPU_X86 0 198 #define TARGET_CPU_X86_64 0 199 #define TARGET_CPU_ARM 0 200 #define TARGET_CPU_ARM64 1 201 #define TARGET_CPU_MIPS 0 202 #define TARGET_CPU_SPARC 0 203 #define TARGET_CPU_ALPHA 0 204 #define TARGET_RT_MAC_CFM 0 205 #define TARGET_RT_MAC_MACHO 1 206 #define TARGET_RT_LITTLE_ENDIAN 1 207 #define TARGET_RT_BIG_ENDIAN 0 208 #define TARGET_RT_64_BIT 1 209 #else 210 #error unrecognized GNU C compiler 211 #endif 212 213 214 215/* 216 * CodeWarrior compiler from Metrowerks/Motorola 217 */ 218#elif defined(__MWERKS__) 219 #define TARGET_OS_MAC 1 220 #define TARGET_OS_WIN32 0 221 #define TARGET_OS_UNIX 0 222 #define TARGET_OS_EMBEDDED 0 223 #if defined(__POWERPC__) 224 #define TARGET_CPU_PPC 1 225 #define TARGET_CPU_PPC64 0 226 #define TARGET_CPU_68K 0 227 #define TARGET_CPU_X86 0 228 #define TARGET_CPU_MIPS 0 229 #define TARGET_CPU_SPARC 0 230 #define TARGET_CPU_ALPHA 0 231 #define TARGET_RT_LITTLE_ENDIAN 0 232 #define TARGET_RT_BIG_ENDIAN 1 233 #elif defined(__INTEL__) 234 #define TARGET_CPU_PPC 0 235 #define TARGET_CPU_PPC64 0 236 #define TARGET_CPU_68K 0 237 #define TARGET_CPU_X86 1 238 #define TARGET_CPU_MIPS 0 239 #define TARGET_CPU_SPARC 0 240 #define TARGET_CPU_ALPHA 0 241 #define TARGET_RT_LITTLE_ENDIAN 1 242 #define TARGET_RT_BIG_ENDIAN 0 243 #else 244 #error unknown Metrowerks CPU type 245 #endif 246 #define TARGET_RT_64_BIT 0 247 #ifdef __MACH__ 248 #define TARGET_RT_MAC_CFM 0 249 #define TARGET_RT_MAC_MACHO 1 250 #else 251 #define TARGET_RT_MAC_CFM 1 252 #define TARGET_RT_MAC_MACHO 0 253 #endif 254 255/* 256 * unknown compiler 257 */ 258#else 259 #if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC 260 #define TARGET_CPU_PPC64 0 261 #define TARGET_CPU_68K 0 262 #define TARGET_CPU_X86 0 263 #define TARGET_CPU_X86_64 0 264 #define TARGET_CPU_ARM 0 265 #define TARGET_CPU_ARM64 0 266 #define TARGET_CPU_MIPS 0 267 #define TARGET_CPU_SPARC 0 268 #define TARGET_CPU_ALPHA 0 269 #elif defined(TARGET_CPU_PPC64) && TARGET_CPU_PPC64 270 #define TARGET_CPU_PPC 0 271 #define TARGET_CPU_68K 0 272 #define TARGET_CPU_X86 0 273 #define TARGET_CPU_X86_64 0 274 #define TARGET_CPU_ARM 0 275 #define TARGET_CPU_ARM64 0 276 #define TARGET_CPU_MIPS 0 277 #define TARGET_CPU_SPARC 0 278 #define TARGET_CPU_ALPHA 0 279 #elif defined(TARGET_CPU_X86) && TARGET_CPU_X86 280 #define TARGET_CPU_PPC 0 281 #define TARGET_CPU_PPC64 0 282 #define TARGET_CPU_X86_64 0 283 #define TARGET_CPU_68K 0 284 #define TARGET_CPU_ARM 0 285 #define TARGET_CPU_ARM64 0 286 #define TARGET_CPU_MIPS 0 287 #define TARGET_CPU_SPARC 0 288 #define TARGET_CPU_ALPHA 0 289 #elif defined(TARGET_CPU_X86_64) && TARGET_CPU_X86_64 290 #define TARGET_CPU_PPC 0 291 #define TARGET_CPU_PPC64 0 292 #define TARGET_CPU_X86 0 293 #define TARGET_CPU_68K 0 294 #define TARGET_CPU_ARM 0 295 #define TARGET_CPU_ARM64 0 296 #define TARGET_CPU_MIPS 0 297 #define TARGET_CPU_SPARC 0 298 #define TARGET_CPU_ALPHA 0 299 #elif defined(TARGET_CPU_ARM) && TARGET_CPU_ARM 300 #define TARGET_CPU_PPC 0 301 #define TARGET_CPU_PPC64 0 302 #define TARGET_CPU_X86 0 303 #define TARGET_CPU_X86_64 0 304 #define TARGET_CPU_68K 0 305 #define TARGET_CPU_ARM64 0 306 #define TARGET_CPU_MIPS 0 307 #define TARGET_CPU_SPARC 0 308 #define TARGET_CPU_ALPHA 0 309 #elif defined(TARGET_CPU_ARM64) && TARGET_CPU_ARM64 310 #define TARGET_CPU_PPC 0 311 #define TARGET_CPU_PPC64 0 312 #define TARGET_CPU_X86 0 313 #define TARGET_CPU_X86_64 0 314 #define TARGET_CPU_68K 0 315 #define TARGET_CPU_ARM 0 316 #define TARGET_CPU_MIPS 0 317 #define TARGET_CPU_SPARC 0 318 #define TARGET_CPU_ALPHA 0 319 #else 320 /* 321 NOTE: If your compiler errors out here then support for your compiler 322 has not yet been added to TargetConditionals.h. 323 324 TargetConditionals.h is designed to be plug-and-play. It auto detects 325 which compiler is being run and configures the TARGET_ conditionals 326 appropriately. 327 328 The short term work around is to set the TARGET_CPU_ and TARGET_OS_ 329 on the command line to the compiler (e.g. -DTARGET_CPU_MIPS=1 -DTARGET_OS_UNIX=1) 330 331 The long term solution is to add a new case to this file which 332 auto detects your compiler and sets up the TARGET_ conditionals. 333 Then submit the changes to Apple Computer. 334 */ 335 #error TargetConditionals.h: unknown compiler (see comment above) 336 #define TARGET_CPU_PPC 0 337 #define TARGET_CPU_68K 0 338 #define TARGET_CPU_X86 0 339 #define TARGET_CPU_ARM 0 340 #define TARGET_CPU_ARM64 0 341 #define TARGET_CPU_MIPS 0 342 #define TARGET_CPU_SPARC 0 343 #define TARGET_CPU_ALPHA 0 344 #endif 345 #define TARGET_OS_MAC 1 346 #define TARGET_OS_WIN32 0 347 #define TARGET_OS_UNIX 0 348 #define TARGET_OS_EMBEDDED 0 349 #if TARGET_CPU_PPC || TARGET_CPU_PPC64 350 #define TARGET_RT_BIG_ENDIAN 1 351 #define TARGET_RT_LITTLE_ENDIAN 0 352 #else 353 #define TARGET_RT_BIG_ENDIAN 0 354 #define TARGET_RT_LITTLE_ENDIAN 1 355 #endif 356 #if TARGET_CPU_PPC64 || TARGET_CPU_X86_64 357 #define TARGET_RT_64_BIT 1 358 #else 359 #define TARGET_RT_64_BIT 0 360 #endif 361 #ifdef __MACH__ 362 #define TARGET_RT_MAC_MACHO 1 363 #define TARGET_RT_MAC_CFM 0 364 #else 365 #define TARGET_RT_MAC_MACHO 0 366 #define TARGET_RT_MAC_CFM 1 367 #endif 368 369#endif 370 371#endif /* __TARGETCONDITIONALS__ */