731024763b3a9f8e4f26ac7468c5d821d85484d8
[oota-llvm.git] / tools / Makefile
1 ##===- tools/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 LEVEL := ..
11
12 # Build clang if present.
13 OPTIONAL_PARALLEL_DIRS := clang
14
15 # Build LLDB if present. Note LLDB must be built last as it depends on the
16 # wider LLVM infrastructure (including Clang). 
17 OPTIONAL_DIRS := lldb
18
19 # NOTE: The tools are organized into five groups of four consisting of one
20 # large and three small executables. This is done to minimize memory load
21 # in parallel builds.  Please retain this ordering.
22 DIRS := llvm-config 
23 PARALLEL_DIRS := opt llvm-as llvm-dis \
24                  llc llvm-ranlib llvm-ar llvm-nm \
25                  llvm-ld llvm-prof llvm-link \
26                  lli llvm-extract llvm-mc \
27                  bugpoint llvm-bcanalyzer llvm-stub \
28                  llvmc llvm-diff macho-dump llvm-objdump
29
30 # Let users override the set of tools to build from the command line.
31 ifdef ONLY_TOOLS
32   OPTIONAL_PARALLEL_DIRS :=
33   OPTIONAL_DIRS := $(findstring lldb,$(ONLY_TOOLS))
34   PARALLEL_DIRS := $(filter-out lldb,$(ONLY_TOOLS))
35 endif
36
37 include $(LEVEL)/Makefile.config
38
39
40 # These libraries build as dynamic libraries (.dylib /.so), they can only be
41 # built if ENABLE_PIC is set.
42 ifndef ONLY_TOOLS
43 ifeq ($(ENABLE_PIC),1)
44   # gold only builds if binutils is around.  It requires "lto" to build before
45   # it so it is added to DIRS.
46   ifdef BINUTILS_INCDIR
47     DIRS += lto gold
48   else
49     PARALLEL_DIRS += lto
50   endif
51
52   PARALLEL_DIRS += bugpoint-passes
53
54   # The edis library is only supported if ARM and/or X86 are enabled, and if
55   # LLVM is being built PIC on platforms that support dylibs.
56   ifneq ($(DISABLE_EDIS),1)
57     ifneq ($(filter $(TARGETS_TO_BUILD), X86 ARM),)
58       PARALLEL_DIRS += edis
59     endif
60   endif
61 endif
62
63 ifdef LLVM_HAS_POLLY
64   PARALLEL_DIRS += polly
65 endif
66 endif
67
68 # On Win32, loadable modules can be built with ENABLE_SHARED.
69 ifneq ($(ENABLE_SHARED),1)
70   ifneq (,$(filter $(HOST_OS), Cygwin MingW))
71     PARALLEL_DIRS := $(filter-out bugpoint-passes, \
72                         $(PARALLEL_DIRS))
73   endif
74 endif
75
76 include $(LEVEL)/Makefile.common