1 #===- ./Makefile -------------------------------------------*- Makefile -*--===#
3 # The LLVM Compiler Infrastructure
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
8 #===------------------------------------------------------------------------===#
12 # Top-Level LLVM Build Stages:
13 # 1. Build lib/System and lib/Support, which are used by utils (tblgen).
14 # 2. Build utils, which is used by VMCore.
15 # 3. Build VMCore, which builds the Intrinsics.inc file used by libs.
16 # 4. Build libs, which are needed by llvm-config.
17 # 5. Build llvm-config, which determines inter-lib dependencies for tools.
18 # 6. Build tools, runtime, docs.
20 # When cross-compiling, there are some things (tablegen) that need to
21 # be build for the build system first.
22 ifeq ($(BUILD_DIRS_ONLY),1)
23 DIRS := lib/System lib/Support utils
26 DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
28 OPTIONAL_DIRS := examples projects bindings
31 EXTRA_DIST := test unittests llvm.spec include win32 Xcode
33 include $(LEVEL)/Makefile.config
35 # llvm-gcc4 doesn't need runtime libs. llvm-gcc4 is the only supported one.
36 # FIXME: Remove runtime entirely once we have an understanding of where
37 # libprofile etc should go.
38 #ifeq ($(LLVMGCC_MAJVERS),4)
39 DIRS := $(filter-out runtime, $(DIRS))
42 ifeq ($(MAKECMDGOALS),libs-only)
43 DIRS := $(filter-out tools runtime docs, $(DIRS))
47 ifeq ($(MAKECMDGOALS),install-libs)
48 DIRS := $(filter-out tools runtime docs, $(DIRS))
49 OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
52 ifeq ($(MAKECMDGOALS),tools-only)
53 DIRS := $(filter-out runtime docs, $(DIRS))
57 ifeq ($(MAKECMDGOALS),install-clang)
58 DIRS := tools/clang/Driver tools/clang/lib/Headers tools/clang/tools/ccc
63 ifeq ($(MAKECMDGOALS),clang-only)
64 DIRS := $(filter-out tools runtime docs, $(DIRS)) tools/clang
68 ifeq ($(MAKECMDGOALS),unittests)
69 DIRS := $(filter-out tools runtime docs, $(DIRS)) utils unittests
73 # Don't install utils, examples, or projects they are only used to
75 ifeq ($(MAKECMDGOALS),install)
76 DIRS := $(filter-out utils, $(DIRS))
77 OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
80 # If we're cross-compiling, build the build-hosted tools first
81 ifeq ($(LLVM_CROSS_COMPILING),1)
82 all:: cross-compile-build-tools
85 $(Verb) rm -rf BuildTools
87 cross-compile-build-tools:
88 $(Verb) if [ ! -f BuildTools/Makefile ]; then \
89 $(MKDIR) BuildTools; \
91 $(PROJ_SRC_DIR)/configure ; \
94 ($(MAKE) -C BuildTools BUILD_DIRS_ONLY=1 ) || exit 1;
97 # Include the main makefile machinery.
98 include $(LLVM_SRC_ROOT)/Makefile.rules
100 # Specify options to pass to configure script when we're
101 # running the dist-check target
102 DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
104 .PHONY: debug-opt-prof
106 $(Echo) Building Debug Version
109 $(Echo) Building Optimized Version
111 $(Verb) $(MAKE) ENABLE_OPTIMIZED=1
113 $(Echo) Building Profiling Version
115 $(Verb) $(MAKE) ENABLE_PROFILING=1
118 $(Echo) Eliminating files constructed by configure
120 $(TopDistDir)/include/llvm/ADT/hash_map.h \
121 $(TopDistDir)/include/llvm/ADT/hash_set.h \
122 $(TopDistDir)/include/llvm/ADT/iterator.h \
123 $(TopDistDir)/include/llvm/Config/config.h \
124 $(TopDistDir)/include/llvm/Support/DataTypes.h \
125 $(TopDistDir)/include/llvm/Support/ThreadSupport.h
130 install-clang: install
131 install-libs: install
133 #------------------------------------------------------------------------
134 # Make sure the generated headers are up-to-date. This must be kept in
135 # sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
136 #------------------------------------------------------------------------
138 include/llvm/Config/config.h \
139 include/llvm/Support/DataTypes.h \
140 include/llvm/ADT/hash_map.h \
141 include/llvm/ADT/hash_set.h \
142 include/llvm/ADT/iterator.h
143 FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
145 all-local:: $(FilesToConfigPATH)
146 $(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
147 $(Echo) Regenerating $*
148 $(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
149 .PRECIOUS: $(FilesToConfigPATH)
151 # NOTE: This needs to remain as the last target definition in this file so
152 # that it gets executed last.
153 ifneq ($(BUILD_DIRS_ONLY),1)
155 $(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
156 ifeq ($(BuildMode),Debug)
157 $(Echo) '*****' Note: Debug build can be 10 times slower than an
158 $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
159 $(Echo) '*****' make an optimized build. Alternatively you can
160 $(Echo) '*****' configure with --enable-optimized.
165 $(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
168 $(Verb)$(MAKE) -C test check-one TESTONE=$(TESTONE)
170 srpm: $(LLVM_OBJ_ROOT)/llvm.spec
171 rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
173 rpm: $(LLVM_OBJ_ROOT)/llvm.spec
174 rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
177 $(Verb) du -sk $(LibDir)
178 $(Verb) du -sk $(ToolDir)
179 $(Verb) du -sk $(ExmplDir)
180 $(Verb) du -sk $(ObjDir)
183 $(Verb) if test ! -f ./config.status ; then \
184 ./configure --prefix="$(LLVM_TOP)/install" \
185 --with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
187 $(Verb) $(MAKE) tools-only
192 SUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}' \
193 | LANG=C xargs $(SVN) info 2>/dev/null \
194 | $(AWK) '/Path:\ / {print $$2}'
197 $(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
198 @ $(SVN) status $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
200 happiness: update all check unittests
202 .PHONY: srpm rpm update happiness
204 # declare all targets at this level to be serial: