diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-04-15 06:57:32 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-04-15 06:57:32 +0000 |
commit | 1f05587937a2b9f4f8c737c1dc59e8047b4b5002 (patch) | |
tree | f470ede7cbdb9e57e093aad3d72eeb2d98222e55 | |
parent | 831efaeb4ba2c0939db6eeb77229d9e47dd03c9c (diff) | |
download | clang-1f05587937a2b9f4f8c737c1dc59e8047b4b5002.tar.gz |
Create a compiler-rt directory and move the Makefile to it. Add a makefile that
builds the subdirs from this directory. This makes the behaviour with make match
what already happens with cmake.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129561 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | runtime/Makefile | 109 | ||||
-rw-r--r-- | runtime/compiler-rt/Makefile | 114 |
2 files changed, 122 insertions, 101 deletions
diff --git a/runtime/Makefile b/runtime/Makefile index 375f312deb..480f496ac9 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -1,114 +1,21 @@ -##===- 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 := libcxx 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)))) - -# Hook into the standard Makefile rules. -all-local:: $(RuntimeDirs:%=RuntimeLibrary.%) -install-local:: $(RuntimeDirs:%=RuntimeLibraryInstall.%) -clean-local:: CleanRuntimeLibraries +include $(CLANG_LEVEL)/Makefile -endif -endif +install:: diff --git a/runtime/compiler-rt/Makefile b/runtime/compiler-rt/Makefile new file mode 100644 index 0000000000..095937cb8f --- /dev/null +++ b/runtime/compiler-rt/Makefile @@ -0,0 +1,114 @@ +##===- runtime/compiler-rt/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 armv6 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 |