More obsessive reformatting. Fixed some validation errors.
[llvm/msp430.git] / Makefile
blob717866e98ed449960bacf14e59239a154420c958
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 #===------------------------------------------------------------------------===#
10 LEVEL := .
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
24 OPTIONAL_DIRS :=
25 else
26 DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
27 tools runtime docs
28 OPTIONAL_DIRS := examples projects bindings
29 endif
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))
40 #endif
42 ifeq ($(MAKECMDGOALS),libs-only)
43 DIRS := $(filter-out tools runtime docs, $(DIRS))
44 OPTIONAL_DIRS :=
45 endif
47 ifeq ($(MAKECMDGOALS),install-libs)
48 DIRS := $(filter-out tools runtime docs, $(DIRS))
49 OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
50 endif
52 ifeq ($(MAKECMDGOALS),tools-only)
53 DIRS := $(filter-out runtime docs, $(DIRS))
54 OPTIONAL_DIRS :=
55 endif
57 ifeq ($(MAKECMDGOALS),install-clang)
58 DIRS := tools/clang/tools/driver tools/clang/tools/clang-cc \
59 tools/clang/lib/Headers
60 OPTIONAL_DIRS :=
61 NO_INSTALL = 1
62 endif
64 ifeq ($(MAKECMDGOALS),clang-only)
65 DIRS := $(filter-out tools runtime docs, $(DIRS)) tools/clang
66 OPTIONAL_DIRS :=
67 endif
69 ifeq ($(MAKECMDGOALS),unittests)
70 DIRS := $(filter-out tools runtime docs, $(DIRS)) utils unittests
71 OPTIONAL_DIRS :=
72 endif
74 # Don't install utils, examples, or projects they are only used to
75 # build LLVM.
76 ifeq ($(MAKECMDGOALS),install)
77 DIRS := $(filter-out utils, $(DIRS))
78 OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
79 endif
81 # If we're cross-compiling, build the build-hosted tools first
82 ifeq ($(LLVM_CROSS_COMPILING),1)
83 all:: cross-compile-build-tools
85 clean::
86 $(Verb) rm -rf BuildTools
88 cross-compile-build-tools:
89 $(Verb) if [ ! -f BuildTools/Makefile ]; then \
90 $(MKDIR) BuildTools; \
91 cd BuildTools ; \
92 $(PROJ_SRC_DIR)/configure ; \
93 cd .. ; \
94 fi; \
95 ($(MAKE) -C BuildTools BUILD_DIRS_ONLY=1 ) || exit 1;
96 endif
98 # Include the main makefile machinery.
99 include $(LLVM_SRC_ROOT)/Makefile.rules
101 # Specify options to pass to configure script when we're
102 # running the dist-check target
103 DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
105 .PHONY: debug-opt-prof
106 debug-opt-prof:
107 $(Echo) Building Debug Version
108 $(Verb) $(MAKE)
109 $(Echo)
110 $(Echo) Building Optimized Version
111 $(Echo)
112 $(Verb) $(MAKE) ENABLE_OPTIMIZED=1
113 $(Echo)
114 $(Echo) Building Profiling Version
115 $(Echo)
116 $(Verb) $(MAKE) ENABLE_PROFILING=1
118 dist-hook::
119 $(Echo) Eliminating files constructed by configure
120 $(Verb) $(RM) -f \
121 $(TopDistDir)/include/llvm/ADT/iterator.h \
122 $(TopDistDir)/include/llvm/Config/config.h \
123 $(TopDistDir)/include/llvm/Support/DataTypes.h \
124 $(TopDistDir)/include/llvm/Support/ThreadSupport.h
126 clang-only: all
127 tools-only: all
128 libs-only: all
129 install-clang: install
130 install-libs: install
132 #------------------------------------------------------------------------
133 # Make sure the generated headers are up-to-date. This must be kept in
134 # sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
135 #------------------------------------------------------------------------
136 FilesToConfig := \
137 include/llvm/Config/config.h \
138 include/llvm/Support/DataTypes.h \
139 include/llvm/ADT/iterator.h
140 FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
142 all-local:: $(FilesToConfigPATH)
143 $(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
144 $(Echo) Regenerating $*
145 $(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
146 .PRECIOUS: $(FilesToConfigPATH)
148 # NOTE: This needs to remain as the last target definition in this file so
149 # that it gets executed last.
150 ifneq ($(BUILD_DIRS_ONLY),1)
151 all::
152 $(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
153 ifeq ($(BuildMode),Debug)
154 $(Echo) '*****' Note: Debug build can be 10 times slower than an
155 $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
156 $(Echo) '*****' make an optimized build. Alternatively you can
157 $(Echo) '*****' configure with --enable-optimized.
158 endif
159 endif
161 check-llvm2cpp:
162 $(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
164 check-one:
165 $(Verb)$(MAKE) -C test check-one TESTONE=$(TESTONE)
167 srpm: $(LLVM_OBJ_ROOT)/llvm.spec
168 rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
170 rpm: $(LLVM_OBJ_ROOT)/llvm.spec
171 rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
173 show-footprint:
174 $(Verb) du -sk $(LibDir)
175 $(Verb) du -sk $(ToolDir)
176 $(Verb) du -sk $(ExmplDir)
177 $(Verb) du -sk $(ObjDir)
179 build-for-llvm-top:
180 $(Verb) if test ! -f ./config.status ; then \
181 ./configure --prefix="$(LLVM_TOP)/install" \
182 --with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
184 $(Verb) $(MAKE) tools-only
186 SVN = svn
187 SVN-UPDATE-OPTIONS =
188 AWK = awk
189 SUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}' \
190 | LANG=C xargs $(SVN) info 2>/dev/null \
191 | $(AWK) '/Path:\ / {print $$2}'
193 update:
194 $(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
195 @ $(SVN) status $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
197 happiness: update all check unittests
199 .PHONY: srpm rpm update happiness
201 # declare all targets at this level to be serial:
203 .NOTPARALLEL: