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