1 Description := Static runtime libraries for clang/Linux. 2 3 ### 4 5 CC := clang 6 Arch := unknown 7 Configs := 8 9 # We don't currently have any general purpose way to target architectures other 10 # than the compiler defaults (because there is no generalized way to invoke 11 # cross compilers). For now, we just find the target archicture of the compiler 12 # and only define configurations we know that compiler can generate. 13 CompilerTargetTriple := $(shell \ 14 $(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2) 15 ifneq ($(DEBUGMAKE),) 16 ifeq ($(CompilerTargetTriple),) 17 $(error "unable to infer compiler target triple for $(CC)") 18 endif 19 endif 20 21 CompilerTargetArch := $(firstword $(subst -, ,$(CompilerTargetTriple))) 22 23 # Only define configs if we detected a linux target. 24 ifneq ($(findstring -linux-,$(CompilerTargetTriple)),) 25 26 # Configurations which just include all the runtime functions. 27 ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true) 28 Configs += full-i386 full-x86_64 29 Arch.full-i386 := i386 30 Arch.full-x86_64 := x86_64 31 endif 32 33 # Configuration for profile runtime. 34 ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true) 35 Configs += profile-i386 profile-x86_64 36 Arch.profile-i386 := i386 37 Arch.profile-x86_64 := x86_64 38 endif 39 40 # Configuration for ASAN runtime. 41 ifeq ($(CompilerTargetArch),i386) 42 Configs += asan-i386 43 Arch.asan-i386 := i386 44 endif 45 ifeq ($(CompilerTargetArch),x86_64) 46 Configs += asan-x86_64 47 Arch.asan-x86_64 := x86_64 48 endif 49 50 endif 51 52 ### 53 54 CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer 55 56 CFLAGS.full-i386 := $(CFLAGS) -m32 57 CFLAGS.full-x86_64 := $(CFLAGS) -m64 58 CFLAGS.profile-i386 := $(CFLAGS) -m32 59 CFLAGS.profile-x86_64 := $(CFLAGS) -m64 60 CFLAGS.asan-i386 := $(CFLAGS) -m32 61 CFLAGS.asan-x86_64 := $(CFLAGS) -m64 62 63 # Use our stub SDK as the sysroot to support more portable building. For now we 64 # just do this for the non-ASAN modules, because the stub SDK doesn't have 65 # enough support to build ASAN. 66 CFLAGS.full-i386 += --sysroot=$(ProjSrcRoot)/SDKs/linux 67 CFLAGS.full-x86_64 += --sysroot=$(ProjSrcRoot)/SDKs/linux 68 CFLAGS.profile-i386 += --sysroot=$(ProjSrcRoot)/SDKs/linux 69 CFLAGS.profile-x86_64 += --sysroot=$(ProjSrcRoot)/SDKs/linux 70 71 FUNCTIONS.full-i386 := $(CommonFunctions) $(ArchFunctions.i386) 72 FUNCTIONS.full-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64) 73 FUNCTIONS.profile-i386 := GCDAProfiling 74 FUNCTIONS.profile-x86_64 := GCDAProfiling 75 FUNCTIONS.asan-i386 := $(AsanFunctions) 76 FUNCTIONS.asan-x86_64 := $(AsanFunctions) 77 78 # Always use optimized variants. 79 OPTIMIZED := 1 80 81 # We don't need to use visibility hidden on Linux. 82 VISIBILITY_HIDDEN := 0 83