Makefile revision 0e7a1cf16c361cd247e31472c253663f6ae32feb
15918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva##===- clang/runtime/compiler-rt/Makefile ------------------*- Makefile -*-===## 25918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# 35918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# The LLVM Compiler Infrastructure 45918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# 55918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# This file is distributed under the University of Illinois Open Source 65918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# License. See LICENSE.TXT for details. 75918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# 85918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva##===----------------------------------------------------------------------===## 95918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# 105918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# This file defines support for building the Clang runtime libraries (which are 115918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# implemented by compiler-rt) and placing them in the proper locations in the 125918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# Clang resources directory (i.e., where the driver expects them). 135918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva# 145918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva##===----------------------------------------------------------------------===## 155918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva 166dd7893e8c7234d65cdc47e3f3ce251fdfb35768Will DietzCLANG_LEVEL := ../.. 17cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hinesinclude $(CLANG_LEVEL)/Makefile 18081a1941b595f6294e4ce678fd61ef56a2ceb51eMichael J. Spencer 195918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean SilvaCLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \ 205918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva $(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc)) 215918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva 225918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean SilvaResourceDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/$(CLANG_VERSION) 235918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean SilvaPROJ_resources := $(DESTDIR)$(PROJ_prefix)/lib/clang/$(CLANG_VERSION) 245918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean Silva 255918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean SilvaResourceLibDir := $(ResourceDir)/lib 265918b7a03d4d6a52e18f7c102250c9cfd6ae52ddSean SilvaResourceIncludeDir := $(ResourceDir)/include 272a7e79a30f87be4103963e6049a2f1cf171f502cSean SilvaPROJ_resources_lib := $(PROJ_resources)/lib 282a7e79a30f87be4103963e6049a2f1cf171f502cSean SilvaPROJ_resources_include := $(PROJ_resources)/include 292a7e79a30f87be4103963e6049a2f1cf171f502cSean Silva 30f3f3523b9c714d9b98f6102ce79ed3d0c9050169Sean Silva# Expect compiler-rt to be in llvm/projects/compiler-rt 312a7e79a30f87be4103963e6049a2f1cf171f502cSean SilvaCOMPILERRT_SRC_ROOT := $(LLVM_SRC_ROOT)/projects/compiler-rt 322a7e79a30f87be4103963e6049a2f1cf171f502cSean Silva 33b14f972ed6865a978402fb1c788ee7939b58680dSean Silva# We don't currently support building runtime libraries when we are 342a7e79a30f87be4103963e6049a2f1cf171f502cSean Silva# cross-compiling. The issue is that we really want to be set up so that the 352a7e79a30f87be4103963e6049a2f1cf171f502cSean Silva# available compiler targets are independent of the current build. 36e766884193afeb684fe1e14f74c316405e9d801fSean Silva# 37e766884193afeb684fe1e14f74c316405e9d801fSean Silva# Since we have to build the runtime libraries for the target, it requires we 38e766884193afeb684fe1e14f74c316405e9d801fSean Silva# have a cross compiler from the build machine to the target. Although in the 39e766884193afeb684fe1e14f74c316405e9d801fSean Silva# case where for the current build (host == target), we do have such a cross 40e766884193afeb684fe1e14f74c316405e9d801fSean Silva# compiler, but not defined in a way that is easy for us to reuse. Regardless, 41e766884193afeb684fe1e14f74c316405e9d801fSean Silva# that also wouldn't help for other possible compiler configurations. 42e766884193afeb684fe1e14f74c316405e9d801fSean Silva# 43e766884193afeb684fe1e14f74c316405e9d801fSean Silva# Thus, the simple set up we currently use is to assume that we will be using 44e766884193afeb684fe1e14f74c316405e9d801fSean Silva# the just built Clang to compile the compiler-rt libraries. As we grow better 452a7e79a30f87be4103963e6049a2f1cf171f502cSean Silva# cross compilation support inside Clang and tool support in LLVM, this makes it 46b14f972ed6865a978402fb1c788ee7939b58680dSean Silva# easier for us to achieve the goal of having the compiler targets be easily 47b14f972ed6865a978402fb1c788ee7939b58680dSean Silva# selected at configure time. However, this design does currently preclude the 48e766884193afeb684fe1e14f74c316405e9d801fSean Silva# building of compiler-rt libraries when the Clang itself is being cross 49e766884193afeb684fe1e14f74c316405e9d801fSean Silva# compiled. 50e766884193afeb684fe1e14f74c316405e9d801fSean Silva# 51e766884193afeb684fe1e14f74c316405e9d801fSean Silva# There are three possible solutions: 52e766884193afeb684fe1e14f74c316405e9d801fSean Silva# 1. Require building a build-target version of Clang when cross compiling. This 532a7e79a30f87be4103963e6049a2f1cf171f502cSean Silva# is simplest, but als greatly increases the build time of cross builds. 542a7e79a30f87be4103963e6049a2f1cf171f502cSean Silva# 55f3f3523b9c714d9b98f6102ce79ed3d0c9050169Sean Silva# 2. Require cross builds have a build-target version of Clang available for 562a7e79a30f87be4103963e6049a2f1cf171f502cSean Silva# use. This is a reasonable compromise on #1, as the compiler-rt libraries 57dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# are simple enough that there is not a strong desire to ensure they are 58dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# built with the exact version of Clang being used. Similarly, as Clang 59f3f3523b9c714d9b98f6102ce79ed3d0c9050169Sean Silva# becomes a better cross compiler it is also increasingly more likely that 60dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# the cross compiler being used will already be a version of Clang. 61fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva# 62fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva# 3. Come up with an alternate mechanism to define all the toolchain 63fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva# information that compiler-rt would need to build libraries for all the 64dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# requested targets. This might be a simple short term solution, but is 65dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# likely to be unwieldly and irritating to maintain in the long term. 66fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silvaifneq ($(LLVM_CROSS_COMPILING),1) 67fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silvaifneq ($(CLANG_NO_RUNTIME),1) 68fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silvaifeq ($(shell test -d $(COMPILERRT_SRC_ROOT) && echo OK),OK) 69fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva 70fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva# Select the compiler-rt configuration to use, and install directory. 71fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva# 72dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# FIXME: Eventually, we want some kind of configure support for this. We want to 73dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# build/install runtime libraries for as many targets as clang was configured to 74fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva# support. 75fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean SilvaRuntimeDirs := 76fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silvaifeq ($(OS),Darwin) 77fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean SilvaRuntimeDirs += darwin 78fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean SilvaRuntimeLibrary.darwin.Configs := \ 79fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva eprintf.a 10.4.a osx.a ios.a cc_kext.a cc_kext_ios5.a \ 80f3f3523b9c714d9b98f6102ce79ed3d0c9050169Sean Silva asan_osx_dynamic.dylib \ 81fe57e347a57d643bbbcc9c19c8267a3e8c06b5a6Sean Silva profile_osx.a profile_ios.a \ 82274264ce2ba93d26702f7ebfe6aea121df44113fSean Silva ubsan_osx.a 836dd7893e8c7234d65cdc47e3f3ce251fdfb35768Will Dietzendif 846dd7893e8c7234d65cdc47e3f3ce251fdfb35768Will Dietz 85274264ce2ba93d26702f7ebfe6aea121df44113fSean Silva# On Linux, include a library which has all the runtime functions. 86274264ce2ba93d26702f7ebfe6aea121df44113fSean Silvaifeq ($(OS),Linux) 87274264ce2ba93d26702f7ebfe6aea121df44113fSean SilvaRuntimeDirs += linux 886dd7893e8c7234d65cdc47e3f3ce251fdfb35768Will DietzRuntimeLibrary.linux.Configs := 896dd7893e8c7234d65cdc47e3f3ce251fdfb35768Will Dietz 90274264ce2ba93d26702f7ebfe6aea121df44113fSean Silva# TryCompile compiler source flags 91274264ce2ba93d26702f7ebfe6aea121df44113fSean Silva# Returns exit code of running a compiler invocation. 92274264ce2ba93d26702f7ebfe6aea121df44113fSean SilvaTryCompile = \ 93274264ce2ba93d26702f7ebfe6aea121df44113fSean Silva $(shell \ 94274264ce2ba93d26702f7ebfe6aea121df44113fSean Silva cflags=""; \ 95274264ce2ba93d26702f7ebfe6aea121df44113fSean Silva for flag in $(3); do \ 96274264ce2ba93d26702f7ebfe6aea121df44113fSean Silva cflags="$$cflags $$flag"; \ 970382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva done; \ 980382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva $(1) $$cflags $(2) -o /dev/null > /dev/null 2> /dev/null ; \ 990382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva echo $$?) 1000382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva 1010382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva# We try to build 32-bit runtimes both on 32-bit hosts and 64-bit hosts. 1020382b30eb5ecdde9749841a2f39960ab8e2de87cSean SilvaRuntime32BitConfigs = \ 10336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines full-i386.a profile-i386.a san-i386.a asan-i386.a ubsan-i386.a \ 10436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines ubsan_cxx-i386.a 10536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 106dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# We currently only try to generate runtime libraries on x86. 107dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinesifeq ($(ARCH),x86) 10836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesRuntimeLibrary.linux.Configs += $(Runtime32BitConfigs) 1090382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silvaendif 1100382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva 1110382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silvaifeq ($(ARCH),x86_64) 11236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesRuntimeLibrary.linux.Configs += \ 11336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines full-x86_64.a profile-x86_64.a san-x86_64.a asan-x86_64.a \ 114c18f66e70dea8abc8c9d86d40088fc8fc8247b20Sean Silva tsan-x86_64.a msan-x86_64.a ubsan-x86_64.a ubsan_cxx-x86_64.a \ 115dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines dfsan-x86_64.a lsan-x86_64.a 116dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# We need to build 32-bit ASan/UBsan libraries on 64-bit platform, and add them 11736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# to the list of runtime libraries to make 11836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# "clang -fsanitize=(address|undefined) -m32" work. 11936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# We check that Clang can produce working 32-bit binaries by compiling a simple 120dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# executable. 121dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinestest_source = $(LLVM_SRC_ROOT)/tools/clang/runtime/compiler-rt/clang_linux_test_input.c 12236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesifeq ($(call TryCompile,$(ToolDir)/clang,$(test_source),-m32),0) 12336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesRuntimeLibrary.linux.Configs += $(Runtime32BitConfigs) 12436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesendif 12536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesifneq ($(LLVM_ANDROID_TOOLCHAIN_DIR),) 12636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesRuntimeLibrary.linux.Configs += asan-arm-android.so 12736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesendif 12836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesendif 12936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 13036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesendif 13136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 132dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines#### 133dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# The build rules below are designed to be generic and should only need to be 134dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# modified based on changes in the compiler-rt layout or build system. 135dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines#### 136dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 137dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# Rule to build the compiler-rt libraries we need. 13836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# 13936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# We build all the libraries in a single shot to avoid recursive make as much as 14036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# possible. 14136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesBuildRuntimeLibraries: 14236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \ 14336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \ 14436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines ProjObjRoot=$(PROJ_OBJ_DIR) \ 14536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines CC="$(ToolDir)/clang" \ 14636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines LLVM_ANDROID_TOOLCHAIN_DIR="$(LLVM_ANDROID_TOOLCHAIN_DIR)" \ 1470382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva $(RuntimeDirs:%=clang_%) 14836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.PHONY: BuildRuntimeLibraries 1490382b30eb5ecdde9749841a2f39960ab8e2de87cSean SilvaCleanRuntimeLibraries: 15036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \ 15136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \ 1520382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva ProjObjRoot=$(PROJ_OBJ_DIR) \ 1530382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva clean 1540382b30eb5ecdde9749841a2f39960ab8e2de87cSean Silva.PHONY: CleanRuntimeLibraries 155552d7cd31a0f6eb0e1434981196f477ae741a184Sean SilvaRuntimeHeader: $(ResourceIncludeDir)/sanitizer 15636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 15736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(PROJ_resources_lib): 15836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) $(MKDIR) $@ 15936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 16036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(ResourceIncludeDir): 16136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) $(MKDIR) $@ 16236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 16336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(ResourceIncludeDir)/sanitizer: $(ResourceIncludeDir) 16436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) $(MKDIR) $@ 16536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) cp $(COMPILERRT_SRC_ROOT)/include/sanitizer/*.h $@ 16636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 16736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# Expand rules for copying/installing each individual library. We can't use 16836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# implicit rules here because we need to match against multiple things. 16936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesdefine RuntimeLibraryTemplate 17036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a: BuildRuntimeLibraries 17136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines @true 17236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.so: BuildRuntimeLibraries 17336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines @true 17436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.dylib: BuildRuntimeLibraries 17536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines @true 17636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.PRECIOUS: $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a 17736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 17836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# Rule to copy the libraries to their resource directory location. 17936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(ResourceLibDir)/$1/libclang_rt.%.a: \ 18036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a \ 18136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(ResourceLibDir)/$1/.dir 18236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Echo) Copying runtime library $1/$$* to build dir 18336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.a $$@ 18436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(ResourceLibDir)/$1/libclang_rt.%.so: \ 18536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.so \ 18636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(ResourceLibDir)/$1/.dir 18736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Echo) Copying runtime library $1/$$* to build dir 18836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.so $$@ 18936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(ResourceLibDir)/$1/libclang_rt.%.dylib: \ 19036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.dylib \ 191dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(ResourceLibDir)/$1/.dir 192dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Echo) Copying runtime library $1/$$* to build dir 193dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.dylib $$@ 194dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Echo) Fixing LC_ID_DYLIB of $$@ 19536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) install_name_tool $$@ -id $$@ 19636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesRuntimeLibrary.$1: \ 197dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(RuntimeLibrary.$1.Configs:%=$(ResourceLibDir)/$1/libclang_rt.%) 198dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines.PHONY: RuntimeLibrary.$1 199dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 200dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines$(PROJ_resources_lib)/$1: $(PROJ_resources_lib) 201dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Verb) $(MKDIR) $$@ 20236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 203dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines$(PROJ_resources_lib)/$1/libclang_rt.%.a: \ 204326c193e0aa221c7836adfa16a3ec85857d7d8b7Sean Silva $(ResourceLibDir)/$1/libclang_rt.%.a | $(PROJ_resources_lib)/$1 205dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Echo) Installing compiler runtime library: $1/$$* 206dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1 207dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines$(PROJ_resources_lib)/$1/libclang_rt.%.so: \ 208dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(ResourceLibDir)/$1/libclang_rt.%.so | $(PROJ_resources_lib)/$1 209326c193e0aa221c7836adfa16a3ec85857d7d8b7Sean Silva $(Echo) Installing compiler runtime library: $1/$$* 21036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines $(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1 21136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines$(PROJ_resources_lib)/$1/libclang_rt.%.dylib: \ 212dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(ResourceLibDir)/$1/libclang_rt.%.dylib | $(PROJ_resources_lib)/$1 213dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Echo) Installing compiler runtime library: $1/$$* 214dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1 215dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 216dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines# Rule to install runtime libraries. 217dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen HinesRuntimeLibraryInstall.$1: \ 218dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(RuntimeLibrary.$1.Configs:%=$(PROJ_resources_lib)/$1/libclang_rt.%) 219dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines.PHONY: RuntimeLibraryInstall.$1 220dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinesendef 221dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines$(foreach lib,$(RuntimeDirs), $(eval $(call RuntimeLibraryTemplate,$(lib)))) 222dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 223dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines$(PROJ_resources_include): 224dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Verb) $(MKDIR) $@ 225dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 226dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines$(PROJ_resources_include)/sanitizer: $(ResourceIncludeDir)/sanitizer $(PROJ_resources_include) 227dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Verb) $(MKDIR) $@ 228dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Echo) Installing compiler runtime headers 229dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(Verb) $(DataInstall) $(ResourceIncludeDir)/sanitizer/* \ 230dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines $(PROJ_resources_include)/sanitizer 231dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines 232dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen HinesRuntimeHeaderInstall: $(PROJ_resources_include)/sanitizer 23336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.PHONY: RuntimeHeaderInstall 2344235ba32f2610ee2ed1e0c4bfca5c67835e9f97dSean Silva 23536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# Hook into the standard Makefile rules. 2364235ba32f2610ee2ed1e0c4bfca5c67835e9f97dSean Silvaall-local:: $(RuntimeDirs:%=RuntimeLibrary.%) RuntimeHeader 2374235ba32f2610ee2ed1e0c4bfca5c67835e9f97dSean Silvainstall-local:: $(RuntimeDirs:%=RuntimeLibraryInstall.%) RuntimeHeaderInstall 238afcf60fe15999ea07193118f447a34f41171e433Sean Silvaclean-local:: CleanRuntimeLibraries 23936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 24036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesendif 24136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesendif 242dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinesendif 243068463b714bd53fffd41322a5654b4f359c2166cSean Silva