summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-05-09 20:24:43 +0000
committerEric Christopher <echristo@apple.com>2011-05-09 20:24:43 +0000
commit2f5efb0238df99509fb8dd53d218065abd8dff8b (patch)
tree3d6f5e6e91ef750af6ee3a05b4ed7dff8d473766
parent187b4b5773107cdc8bb5c1d122ecf9c603fd6ced (diff)
downloadcompiler-rt-2f5efb0238df99509fb8dd53d218065abd8dff8b.tar.gz
Check architectures to make sure that we can build for all of them
before we try to. Patch by Patrick Walton! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@131098 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--make/platform/clang_darwin.mk21
1 files changed, 17 insertions, 4 deletions
diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk
index 777665245..564026ea7 100644
--- a/make/platform/clang_darwin.mk
+++ b/make/platform/clang_darwin.mk
@@ -6,6 +6,19 @@
Description := Static runtime libraries for clang/Darwin.
+# A function that ensures we don't try to build for architectures that we
+# don't have working toolchains for.
+CheckArches = \
+ $(shell \
+ result=""; \
+ for arch in $(1); do \
+ gcc -arch $$arch; \
+ if test $$? == 1; then result="$$result$$arch "; fi; \
+ done; \
+ echo $$result)
+
+###
+
Configs :=
UniversalArchs :=
@@ -13,23 +26,23 @@ UniversalArchs :=
# still be referenced from Darwin system headers. This symbol is only ever
# needed on i386.
Configs += eprintf
-UniversalArchs.eprintf := i386
+UniversalArchs.eprintf := $(call CheckArches,i386)
# Configuration for targetting 10.4. We need a few functions missing from
# libgcc_s.10.4.dylib. We only build x86 slices since clang doesn't really
# support targetting PowerPC.
Configs += 10.4
-UniversalArchs.10.4 := i386 x86_64
+UniversalArchs.10.4 := $(call CheckArches,i386 x86_64)
# Configuration for targetting iOS, for some ARMv6 functions, which must be
# in the same linkage unit, and for a couple of other functions that didn't
# make it into libSystem.
Configs += ios
-UniversalArchs.ios := i386 x86_64 armv6 armv7
+UniversalArchs.ios := $(call CheckArches,i386 x86_64 armv6 armv7)
# Configuration for use with kernel/kexts.
Configs += cc_kext
-UniversalArchs.cc_kext := armv6 armv7 i386 x86_64
+UniversalArchs.cc_kext := $(call CheckArches,armv6 armv7 i386 x86_64)
###