[llvm-commits] [compiler-rt] r145322 - /compiler-rt/trunk/make/platform/clang_linux.mk

Daniel Dunbar daniel at zuster.org
Mon Nov 28 15:50:14 PST 2011


Author: ddunbar
Date: Mon Nov 28 17:50:13 2011
New Revision: 145322

URL: http://llvm.org/viewvc/llvm-project?rev=145322&view=rev
Log:
build: Sketch a Clang/Linux platform config.
 - Currently just tries to build a full library for i386/x86_64.

 - This is made substantially more complicated by the lack of a generalized way
   to check for/invoke cross compilers. For now, we just try and make it work
   for the matched arch, and rely on the host CC being Clang.

Added:
    compiler-rt/trunk/make/platform/clang_linux.mk

Added: compiler-rt/trunk/make/platform/clang_linux.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_linux.mk?rev=145322&view=auto
==============================================================================
--- compiler-rt/trunk/make/platform/clang_linux.mk (added)
+++ compiler-rt/trunk/make/platform/clang_linux.mk Mon Nov 28 17:50:13 2011
@@ -0,0 +1,52 @@
+Description := Static runtime libraries for clang/Linux.
+
+###
+
+CC := clang
+Arch := unknown
+Configs :=
+
+# We don't currently have any general purpose way to target architectures other
+# than the compiler defaults (because there is no generalized way to invoke
+# cross compilers). For now, we just find the target archicture of the compiler
+# and only define configurations we know that compiler can generate.
+CompilerTargetTriple := $(shell \
+	$(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2)
+ifneq ($(DEBUGMAKE),)
+ifeq ($(CompilerTargetTriple),)
+$(error "unable to infer compiler target triple for $(CC)")
+endif
+endif
+
+CompilerTargetArch := $(firstword $(subst -, ,$(CompilerTargetTriple)))
+
+# Only define configs if we detected a linux target.
+ifneq ($(findstring -linux-,$(CompilerTargetTriple)),)
+
+# Configurations which just include all the runtime functions.
+ifeq ($(CompilerTargetArch),i386)
+Configs += full-i386
+Arch.full-i386 := i386
+endif
+ifeq ($(CompilerTargetArch),x86_64)
+Configs += full-x86_64
+Arch.full-x86_64 := x86_64
+endif
+
+endif
+
+###
+
+CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer
+
+CFLAGS.full-i386 := $(CFLAGS) -m32
+CFLAGS.full-x86_64 := $(CFLAGS) -m64
+
+FUNCTIONS.full-i386 := $(CommonFunctions) $(ArchFunctions.i386)
+FUNCTIONS.full-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64)
+
+# Always use optimized variants.
+OPTIMIZED := 1
+
+# We don't need to use visibility hidden on Linux.
+VISIBILITY_HIDDEN := 0





More information about the llvm-commits mailing list