Makefile revision 2ab03034925829614eb9ed186d0a4fb6f8e2b69a
1##===- clang/runtime/libcxx/Makefile -----------------------*- Makefile -*-===##
2#
3#                     The LLVM Compiler Infrastructure
4#
5# This file is distributed under the University of Illinois Open Source
6# License. See LICENSE.TXT for details.
7#
8##===----------------------------------------------------------------------===##
9#
10# This file defines support for building the "libc++" C++ standard library as
11# part of a Clang compiler build.
12#
13##===----------------------------------------------------------------------===##
14
15CLANG_LEVEL := ../..
16LEVEL := $(CLANG_LEVEL)/../..
17LIBRARYNAME = c++
18
19LINK_LIBS_IN_SHARED = 1
20SHARED_LIBRARY = 1
21
22# Include LLVM common makefile.
23include $(LEVEL)/Makefile.config
24
25# Expect libcxx to be in llvm/projects/libcxx
26LIBCXX_SRC_ROOT := $(LLVM_SRC_ROOT)/projects/libcxx
27
28# Override the source root to point at the libcxx sources.
29PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
30PROJ_SRC_DIR := $(LIBCXX_SRC_ROOT)/src
31CPP.Flags := -nostdinc++ -I$(LIBCXX_SRC_ROOT)/include
32CXX.Flags := -std=c++0x
33
34# Include LLVM makefile rules.
35include $(LLVM_SRC_ROOT)/Makefile.rules
36
37# Force building with the just built Clang.
38#
39# FIXME: Do we really want to do this? It is uber slow.
40# CXX := $(ToolDir)/clang
41
42ifeq ($(HOST_OS),Darwin)
43    LLVMLibsOptions += -Wl,-compatibility_version,1
44
45    # Don't link with default libraries.
46    LLVMLibsOptions += -nodefaultlibs
47
48    # Reexport libc++abi.
49    LLVMLibsOptions += -Wl,-reexport_library,/usr/lib/libc++abi.dylib
50
51    # Set dylib internal version number to submission number.
52    ifdef LLVM_SUBMIT_VERSION
53        LLVMLibsOptions += -Wl,-current_version \
54                           -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION)
55    endif
56
57    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
58    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
59    ifneq ($(DARWIN_VERS),8)
60       LLVMLibsOptions += -Wl,-install_name \
61                          -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
62    endif
63endif
64