Makefile revision 7a0c064770355a4918df69f95de8dea6338a59a2
1da79da2a8748e4d58eeedd1b7f39bf4fb8a86d10Bob Wilson##===- clang/runtime/compiler-rt/Makefile ------------------*- Makefile -*-===##
2562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson#
3253521bacfc70dcc8f8205f8b1192816458beb34Daniel Dunbar#                     The LLVM Compiler Infrastructure
4253521bacfc70dcc8f8205f8b1192816458beb34Daniel Dunbar#
5253521bacfc70dcc8f8205f8b1192816458beb34Daniel Dunbar# This file is distributed under the University of Illinois Open Source
6253521bacfc70dcc8f8205f8b1192816458beb34Daniel Dunbar# License. See LICENSE.TXT for details.
7562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson#
8562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson##===----------------------------------------------------------------------===##
9562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson#
10562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# This file defines support for building the Clang runtime libraries (which are
11562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# implemented by compiler-rt) and placing them in the proper locations in the
12562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# Clang resources directory (i.e., where the driver expects them).
13562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson#
14253521bacfc70dcc8f8205f8b1192816458beb34Daniel Dunbar##===----------------------------------------------------------------------===##
15253521bacfc70dcc8f8205f8b1192816458beb34Daniel Dunbar
16484fc57c8d2d3ba645a03f9e294dcebc5aacaf44Nick LewyckyCLANG_LEVEL := ../..
17562627d782393c0d8045625a53a97f4fbad091bcOwen Andersoninclude $(CLANG_LEVEL)/Makefile
18253521bacfc70dcc8f8205f8b1192816458beb34Daniel Dunbar
19562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonCLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \
20562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc))
21bc817cffbca01c879f13e9290d94797f6caafc7aDaniel Dunbar
22562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonResourceDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/$(CLANG_VERSION)
23562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonPROJ_resources := $(DESTDIR)$(PROJ_prefix)/lib/clang/$(CLANG_VERSION)
24562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
25562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonResourceLibDir := $(ResourceDir)/lib
26562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonPROJ_resources_lib := $(PROJ_resources)/lib
27562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
28562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# Expect compiler-rt to be in llvm/projects/compiler-rt
29562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonCOMPILERRT_SRC_ROOT := $(LLVM_SRC_ROOT)/projects/compiler-rt
30562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
31e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# We don't currently support building runtime libraries when we are
32e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# cross-compiling. The issue is that we really want to be set up so that the
33e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# available compiler targets are independent of the current build.
34e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#
35e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# Since we have to build the runtime libraries for the target, it requires we
36e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# have a cross compiler from the build machine to the target. Although in the
37e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# case where for the current build (host == target), we do have such a cross
38e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# compiler, but not defined in a way that is easy for us to reuse. Regardless,
39e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# that also wouldn't help for other possible compiler configurations.
40e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#
41e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# Thus, the simple set up we currently use is to assume that we will be using
42e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# the just built Clang to compile the compiler-rt libraries. As we grow better
43e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# cross compilation support inside Clang and tool support in LLVM, this makes it
44e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# easier for us to achieve the goal of having the compiler targets be easily
45e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# selected at configure time. However, this design does currently preclude the
46e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# building of compiler-rt libraries when the Clang itself is being cross
47e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# compiled.
48e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#
49e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# There are three possible solutions:
50e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#  1. Require building a build-target version of Clang when cross compiling. This
51e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     is simplest, but als greatly increases the build time of cross builds.
52e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#
53e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#  2. Require cross builds have a build-target version of Clang available for
54e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     use. This is a reasonable compromise on #1, as the compiler-rt libraries
55e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     are simple enough that there is not a strong desire to ensure they are
56e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     built with the exact version of Clang being used. Similarly, as Clang
57e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     becomes a better cross compiler it is also increasingly more likely that
58e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     the cross compiler being used will already be a version of Clang.
59e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#
60e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#  3. Come up with an alternate mechanism to define all the toolchain
61e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     information that compiler-rt would need to build libraries for all the
62e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     requested targets. This might be a simple short term solution, but is
63e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar#     likely to be unwieldly and irritating to maintain in the long term.
64e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbarifneq ($(LLVM_CROSS_COMPILING),1)
65562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonifneq ($(CLANG_NO_RUNTIME),1)
66562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonifeq ($(shell test -d $(COMPILERRT_SRC_ROOT) && echo OK),OK)
67562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
68562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# Select the compiler-rt configuration to use, and install directory.
69562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson#
70562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# FIXME: Eventually, we want some kind of configure support for this. We want to
71562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# build/install runtime libraries for as many targets as clang was configured to
72562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# support.
73562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonRuntimeDirs :=
74562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonifeq ($(OS),Darwin)
75562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonRuntimeDirs += darwin
76f471487ff1e673531543576bc170898c2ab19f41Daniel DunbarRuntimeLibrary.darwin.Configs := \
777a0c064770355a4918df69f95de8dea6338a59a2Daniel Dunbar	eprintf.a 10.4.a osx.a ios.a cc_kext.a cc_kext_ios5.a \
7812f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	asan_osx.a asan_osx_dynamic.dylib \
797a0c064770355a4918df69f95de8dea6338a59a2Daniel Dunbar	profile_osx.a profile_ios.a
80562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonendif
81ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbar
82ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbar# On Linux, include a library which has all the runtime functions.
83ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbarifeq ($(OS),Linux)
84ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel DunbarRuntimeDirs += linux
85ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel DunbarRuntimeLibrary.linux.Configs :=
86ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbar
87f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov# TryCompile compiler source flags
88f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov# Returns exit code of running a compiler invocation.
89f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey SamsonovTryCompile = \
90f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov  $(shell \
91f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov    cflags=""; \
92f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov    for flag in $(3); do \
93f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov      cflags="$$cflags $$flag"; \
94f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov    done; \
95f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov    $(1) $$cflags $(2) -o /dev/null > /dev/null 2> /dev/null ; \
96f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov    echo $$?)
97f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov
98ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbar# We currently only try to generate runtime libraries on x86.
99ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbarifeq ($(ARCH),x86)
1007df67e6892d74a6653473089473166a30608f416Daniel DunbarRuntimeLibrary.linux.Configs += \
10112f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	full-i386.a profile-i386.a asan-i386.a
102ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbarendif
103f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov
104ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbarifeq ($(ARCH),x86_64)
1057df67e6892d74a6653473089473166a30608f416Daniel DunbarRuntimeLibrary.linux.Configs += \
10612f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	full-x86_64.a profile-x86_64.a asan-x86_64.a tsan-x86_64.a
107f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov# We need to build 32-bit ASan library on 64-bit platform, and add it to the
108f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov# list of runtime libraries to make "clang -faddress-sanitizer -m32" work.
109f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov# We check that Clang can produce working 32-bit binaries by compiling a simple
110f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonov# executable.
111f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonovtest_source = $(LLVM_SRC_ROOT)/tools/clang/runtime/compiler-rt/clang_linux_test_input.c
112f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonovifeq ($(call TryCompile,$(ToolDir)/clang,$(test_source),-m32),0)
1132985cbc3c08f4da6602679ff6df11b6abe3f11e0Alexey SamsonovRuntimeLibrary.linux.Configs += asan-i386.a
114ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbarendif
115f288d223a44fb2fa0de69b225dcdbc5f7669defdAlexey Samsonovendif
116ff9865220ccd618cab2d8fbc63e58ac6cd7357f0Daniel Dunbar
117db0ab63998eb9aad0ead03d3f76f095f9b1eb036Daniel Dunbarendif
118253521bacfc70dcc8f8205f8b1192816458beb34Daniel Dunbar
119e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar####
120e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# The build rules below are designed to be generic and should only need to be
121e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar# modified based on changes in the compiler-rt layout or build system.
122e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar####
123e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbar
124562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# Rule to build the compiler-rt libraries we need.
125562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson#
126562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# We build all the libraries in a single shot to avoid recursive make as much as
127562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# possible.
128562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonBuildRuntimeLibraries:
129562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \
130562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	  ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \
131562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	  ProjObjRoot=$(PROJ_OBJ_DIR) \
1323518058dace8f4c9c3ed0b6a30b0bdf08a10d559Daniel Dunbar	  CC="$(ToolDir)/clang" \
133562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	  $(RuntimeDirs:%=clang_%)
134562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson.PHONY: BuildRuntimeLibraries
135562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonCleanRuntimeLibraries:
136562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \
137562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	  ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \
138562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	  ProjObjRoot=$(PROJ_OBJ_DIR) \
139562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	  clean
140562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson.PHONY: CleanRuntimeLibraries
141562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
142562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson$(PROJ_resources_lib):
143562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(Verb) $(MKDIR) $@
144562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
145562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# Expand rules for copying/installing each individual library. We can't use
146562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# implicit rules here because we need to match against multiple things.
147562627d782393c0d8045625a53a97f4fbad091bcOwen Andersondefine RuntimeLibraryTemplate
148562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a: BuildRuntimeLibraries
149562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	@true
15012f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.so: BuildRuntimeLibraries
15112f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	@true
15212f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.dylib: BuildRuntimeLibraries
15312f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	@true
154562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson.PRECIOUS: $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a
155562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
156562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# Rule to copy the libraries to their resource directory location.
157562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson$(ResourceLibDir)/$1/libclang_rt.%.a: \
158562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson		$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a \
159562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson		$(ResourceLibDir)/$1/.dir
160562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(Echo) Copying runtime library $1/$$* to build dir
161562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.a $$@
16212f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar$(ResourceLibDir)/$1/libclang_rt.%.so: \
16312f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar		$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.so \
16412f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar		$(ResourceLibDir)/$1/.dir
16512f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	$(Echo) Copying runtime library $1/$$* to build dir
16612f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	$(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.so $$@
16712f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar$(ResourceLibDir)/$1/libclang_rt.%.dylib: \
16812f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar		$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.dylib \
16912f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar		$(ResourceLibDir)/$1/.dir
17012f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	$(Echo) Copying runtime library $1/$$* to build dir
17112f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	$(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.dylib $$@
172b626280eb16a62e32a100f0082e9ea7e496a51d7Alexander Potapenko	$(Echo) Fixing LC_ID_DYLIB of $$@
173b626280eb16a62e32a100f0082e9ea7e496a51d7Alexander Potapenko	$(Verb) install_name_tool $$@ -id $$@
174562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonRuntimeLibrary.$1: \
17512f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar		$(RuntimeLibrary.$1.Configs:%=$(ResourceLibDir)/$1/libclang_rt.%)
176562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson.PHONY: RuntimeLibrary.$1
17746bbbdd0111c386c2341919a62c5742f2519efa6Daniel Dunbar
178562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson$(PROJ_resources_lib)/$1: $(PROJ_resources_lib)
179562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(Verb) $(MKDIR) $$@
180562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
181562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson$(PROJ_resources_lib)/$1/libclang_rt.%.a: \
182562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson		$(ResourceLibDir)/$1/libclang_rt.%.a | $(PROJ_resources_lib)/$1
183562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(Echo) Installing compiler runtime library: $1/$$*
184562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson	$(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1
18512f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar$(PROJ_resources_lib)/$1/libclang_rt.%.so: \
18612f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar		$(ResourceLibDir)/$1/libclang_rt.%.so | $(PROJ_resources_lib)/$1
18712f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	$(Echo) Installing compiler runtime library: $1/$$*
18812f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	$(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1
18912f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar$(PROJ_resources_lib)/$1/libclang_rt.%.dylib: \
19012f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar		$(ResourceLibDir)/$1/libclang_rt.%.dylib | $(PROJ_resources_lib)/$1
19112f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	$(Echo) Installing compiler runtime library: $1/$$*
19212f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar	$(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1
193562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
194562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# Rule to install runtime libraries.
195562627d782393c0d8045625a53a97f4fbad091bcOwen AndersonRuntimeLibraryInstall.$1: \
19612f5fe5f4ee9318a11e299f199f61eea05a2a450Daniel Dunbar		$(RuntimeLibrary.$1.Configs:%=$(PROJ_resources_lib)/$1/libclang_rt.%)
197562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson.PHONY: RuntimeLibraryInstall.$1
198562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonendef
199562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson$(foreach lib,$(RuntimeDirs), $(eval $(call RuntimeLibraryTemplate,$(lib))))
200562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
201562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson# Hook into the standard Makefile rules.
202562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonall-local:: $(RuntimeDirs:%=RuntimeLibrary.%)
203562627d782393c0d8045625a53a97f4fbad091bcOwen Andersoninstall-local:: $(RuntimeDirs:%=RuntimeLibraryInstall.%)
204562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonclean-local:: CleanRuntimeLibraries
205562627d782393c0d8045625a53a97f4fbad091bcOwen Anderson
206562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonendif
207562627d782393c0d8045625a53a97f4fbad091bcOwen Andersonendif
208e33218a3ceb3a36e4d8163cf04df0c0cae530b27Daniel Dunbarendif
209