diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:39:53 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:39:53 +0000 |
| commit | 01af97d3b23bded2b2b21af19bbc6e4cce49e5b3 (patch) | |
| tree | 64a10f4c4154739d4a8191d7e1b52ce497f4ebd6 /runtime | |
| parent | c3b054d250cdca485c71845089c316e10610ebad (diff) | |
Notes
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | runtime/Makefile | 108 | ||||
| -rw-r--r-- | runtime/compiler-rt/Makefile | 114 | ||||
| -rw-r--r-- | runtime/libcxx/Makefile | 63 |
4 files changed, 122 insertions, 164 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 68ee266ecae9..e53d805cbd64 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -2,7 +2,6 @@ set(known_subdirs "compiler-rt" - "libcxx" ) foreach (dir ${known_subdirs}) diff --git a/runtime/Makefile b/runtime/Makefile index 375f312debd1..784eb66fc540 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -1,114 +1,22 @@ -##===- clang/runtime/Makefile ------------------------------*- Makefile -*-===## -# +##===- runtime/Makefile ------------------------------------*- Makefile -*-===## +# # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -# -# This file defines support for building the Clang runtime libraries (which are -# implemented by compiler-rt) and placing them in the proper locations in the -# Clang resources directory (i.e., where the driver expects them). -# +# ##===----------------------------------------------------------------------===## CLANG_LEVEL := .. -include $(CLANG_LEVEL)/Makefile +include $(CLANG_LEVEL)/../../Makefile.config -CLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \ - $(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc)) +ifndef NO_RUNTIME_LIBS -ResourceDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/$(CLANG_VERSION) -PROJ_resources := $(DESTDIR)$(PROJ_prefix)/lib/clang/$(CLANG_VERSION) - -ResourceLibDir := $(ResourceDir)/lib -PROJ_resources_lib := $(PROJ_resources)/lib - -# Expect compiler-rt to be in llvm/projects/compiler-rt -COMPILERRT_SRC_ROOT := $(LLVM_SRC_ROOT)/projects/compiler-rt - -# Additional flags to pass to Clang. -CLANG_CCFLAGS := -no-integrated-as - -ifneq ($(CLANG_NO_RUNTIME),1) -ifeq ($(shell test -d $(COMPILERRT_SRC_ROOT) && echo OK),OK) - -# Select the compiler-rt configuration to use, and install directory. -# -# FIXME: Eventually, we want some kind of configure support for this. We want to -# build/install runtime libraries for as many targets as clang was configured to -# support. -RuntimeDirs := -ifeq ($(OS),Darwin) -RuntimeDirs += darwin -RuntimeLibrary.darwin.Configs = eprintf 10.4 armv6 cc_kext +PARALLEL_DIRS := compiler-rt -# On Darwin, fake Clang into using the iOS assembler (since compiler-rt wants to -# build ARM bits). -ifeq ($(OS),Darwin) -CLANG_CCFLAGS += -ccc-install-dir \ - /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ endif -endif - -# Rule to build the compiler-rt libraries we need. -# -# We build all the libraries in a single shot to avoid recursive make as much as -# possible. -BuildRuntimeLibraries: - $(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \ - ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \ - ProjObjRoot=$(PROJ_OBJ_DIR) \ - CC="$(ToolDir)/clang $(CLANG_CCFLAGS)" \ - $(RuntimeDirs:%=clang_%) -.PHONY: BuildRuntimeLibraries -CleanRuntimeLibraries: - $(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \ - ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \ - ProjObjRoot=$(PROJ_OBJ_DIR) \ - clean -.PHONY: CleanRuntimeLibraries - -$(PROJ_resources_lib): - $(Verb) $(MKDIR) $@ - -# Expand rules for copying/installing each individual library. We can't use -# implicit rules here because we need to match against multiple things. -define RuntimeLibraryTemplate -$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a: BuildRuntimeLibraries - @true -.PRECIOUS: $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a - -# Rule to copy the libraries to their resource directory location. -$(ResourceLibDir)/$1/libclang_rt.%.a: \ - $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a \ - $(ResourceLibDir)/$1/.dir - $(Echo) Copying runtime library $1/$$* to build dir - $(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.a $$@ -RuntimeLibrary.$1: \ - $(RuntimeLibrary.$1.Configs:%=$(ResourceLibDir)/$1/libclang_rt.%.a) -.PHONY: RuntimeLibrary.$1 -$(PROJ_resources_lib)/$1: $(PROJ_resources_lib) - $(Verb) $(MKDIR) $$@ - -$(PROJ_resources_lib)/$1/libclang_rt.%.a: \ - $(ResourceLibDir)/$1/libclang_rt.%.a | $(PROJ_resources_lib)/$1 - $(Echo) Installing compiler runtime library: $1/$$* - $(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1 - -# Rule to install runtime libraries. -RuntimeLibraryInstall.$1: \ - $(RuntimeLibrary.$1.Configs:%=$(PROJ_resources_lib)/$1/libclang_rt.%.a) -.PHONY: RuntimeLibraryInstall.$1 -endef -$(foreach lib,$(RuntimeDirs), $(eval $(call RuntimeLibraryTemplate,$(lib)))) +include $(CLANG_LEVEL)/Makefile -# Hook into the standard Makefile rules. -all-local:: $(RuntimeDirs:%=RuntimeLibrary.%) -install-local:: $(RuntimeDirs:%=RuntimeLibraryInstall.%) -clean-local:: CleanRuntimeLibraries +install:: -endif -endif diff --git a/runtime/compiler-rt/Makefile b/runtime/compiler-rt/Makefile new file mode 100644 index 000000000000..dcdd4f5ec03f --- /dev/null +++ b/runtime/compiler-rt/Makefile @@ -0,0 +1,114 @@ +##===- clang/runtime/Makefile ------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +# +# This file defines support for building the Clang runtime libraries (which are +# implemented by compiler-rt) and placing them in the proper locations in the +# Clang resources directory (i.e., where the driver expects them). +# +##===----------------------------------------------------------------------===## + +CLANG_LEVEL := ../.. +include $(CLANG_LEVEL)/Makefile + +CLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \ + $(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc)) + +ResourceDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/$(CLANG_VERSION) +PROJ_resources := $(DESTDIR)$(PROJ_prefix)/lib/clang/$(CLANG_VERSION) + +ResourceLibDir := $(ResourceDir)/lib +PROJ_resources_lib := $(PROJ_resources)/lib + +# Expect compiler-rt to be in llvm/projects/compiler-rt +COMPILERRT_SRC_ROOT := $(LLVM_SRC_ROOT)/projects/compiler-rt + +# Additional flags to pass to Clang. +CLANG_CCFLAGS := -no-integrated-as + +ifneq ($(CLANG_NO_RUNTIME),1) +ifeq ($(shell test -d $(COMPILERRT_SRC_ROOT) && echo OK),OK) + +# Select the compiler-rt configuration to use, and install directory. +# +# FIXME: Eventually, we want some kind of configure support for this. We want to +# build/install runtime libraries for as many targets as clang was configured to +# support. +RuntimeDirs := +ifeq ($(OS),Darwin) +RuntimeDirs += darwin +RuntimeLibrary.darwin.Configs = eprintf 10.4 ios cc_kext + +# On Darwin, fake Clang into using the iOS assembler (since compiler-rt wants to +# build ARM bits). +ifeq ($(OS),Darwin) +CLANG_CCFLAGS += -ccc-install-dir \ + /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ +endif +endif + +# Rule to build the compiler-rt libraries we need. +# +# We build all the libraries in a single shot to avoid recursive make as much as +# possible. +BuildRuntimeLibraries: + $(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \ + ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \ + ProjObjRoot=$(PROJ_OBJ_DIR) \ + CC="$(ToolDir)/clang $(CLANG_CCFLAGS)" \ + $(RuntimeDirs:%=clang_%) +.PHONY: BuildRuntimeLibraries +CleanRuntimeLibraries: + $(Verb) $(MAKE) -C $(COMPILERRT_SRC_ROOT) \ + ProjSrcRoot=$(COMPILERRT_SRC_ROOT) \ + ProjObjRoot=$(PROJ_OBJ_DIR) \ + clean +.PHONY: CleanRuntimeLibraries + +$(PROJ_resources_lib): + $(Verb) $(MKDIR) $@ + +# Expand rules for copying/installing each individual library. We can't use +# implicit rules here because we need to match against multiple things. +define RuntimeLibraryTemplate +$(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a: BuildRuntimeLibraries + @true +.PRECIOUS: $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a + +# Rule to copy the libraries to their resource directory location. +$(ResourceLibDir)/$1/libclang_rt.%.a: \ + $(PROJ_OBJ_DIR)/clang_$1/%/libcompiler_rt.a \ + $(ResourceLibDir)/$1/.dir + $(Echo) Copying runtime library $1/$$* to build dir + $(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.a $$@ +RuntimeLibrary.$1: \ + $(RuntimeLibrary.$1.Configs:%=$(ResourceLibDir)/$1/libclang_rt.%.a) +.PHONY: RuntimeLibrary.$1 + +$(PROJ_resources_lib)/$1: $(PROJ_resources_lib) + $(Verb) $(MKDIR) $$@ + +$(PROJ_resources_lib)/$1/libclang_rt.%.a: \ + $(ResourceLibDir)/$1/libclang_rt.%.a | $(PROJ_resources_lib)/$1 + $(Echo) Installing compiler runtime library: $1/$$* + $(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1 + +# Rule to install runtime libraries. +RuntimeLibraryInstall.$1: \ + $(RuntimeLibrary.$1.Configs:%=$(PROJ_resources_lib)/$1/libclang_rt.%.a) +.PHONY: RuntimeLibraryInstall.$1 +endef +$(foreach lib,$(RuntimeDirs), $(eval $(call RuntimeLibraryTemplate,$(lib)))) + +# Hook into the standard Makefile rules. +all-local:: $(RuntimeDirs:%=RuntimeLibrary.%) +install-local:: $(RuntimeDirs:%=RuntimeLibraryInstall.%) +clean-local:: CleanRuntimeLibraries + +endif +endif diff --git a/runtime/libcxx/Makefile b/runtime/libcxx/Makefile deleted file mode 100644 index 10d4e9bb8455..000000000000 --- a/runtime/libcxx/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -##===- clang/runtime/libcxx/Makefile -----------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## -# -# This file defines support for building the "libc++" C++ standard library as -# part of a Clang compiler build. -# -##===----------------------------------------------------------------------===## - -CLANG_LEVEL := ../.. -LEVEL := $(CLANG_LEVEL)/../.. -LIBRARYNAME = c++ - -LINK_LIBS_IN_SHARED = 1 -SHARED_LIBRARY = 1 - -# Include LLVM common makefile. -include $(LEVEL)/Makefile.config - -# Expect libcxx to be in llvm/projects/libcxx -LIBCXX_SRC_ROOT := $(LLVM_SRC_ROOT)/projects/libcxx - -# Override the source root to point at the libcxx sources. -PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile -PROJ_SRC_DIR := $(LIBCXX_SRC_ROOT)/src -CPP.Flags := -nostdinc++ -I$(LIBCXX_SRC_ROOT)/include -CXX.Flags := -std=c++0x - -# Include LLVM makefile rules. -include $(LLVM_SRC_ROOT)/Makefile.rules - -# Force building with the just built Clang. -# -# FIXME: Do we really want to do this? It is uber slow. -# CXX := $(ToolDir)/clang - -ifeq ($(HOST_OS),Darwin) - LLVMLibsOptions += -Wl,-compatibility_version,1 - - # Don't link with default libraries. - LLVMLibsOptions += -nodefaultlibs - - # Reexport libc++abi. - LLVMLibsOptions += -Wl,-reexport_library,/usr/lib/libc++abi.dylib - - # Set dylib internal version number to submission number. - ifdef LLVM_SUBMIT_VERSION - LLVMLibsOptions += -Wl,-current_version \ - -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) - endif - - # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line - DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/') - ifneq ($(DARWIN_VERS),8) - LLVMLibsOptions += -Wl,-install_name \ - -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)" - endif -endif |
