[PR2886] Ignore stderr from ocamlc since it prints unresolvable warnings on some...
[oota-llvm.git] / Makefile
1 #===- ./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 # 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.
19 #
20 DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
21         tools runtime docs
22
23 OPTIONAL_DIRS := examples projects bindings
24 EXTRA_DIST := test llvm.spec include win32 Xcode
25
26 include $(LEVEL)/Makefile.config 
27
28 # When cross-compiling, there are some things (tablegen) that need to
29 # be build for the build system.
30 ifeq ($(LLVM_CROSS_COMPILING),1)
31   BUILD_TARGET_DIRS := lib/System lib/Support utils
32 endif
33
34 # llvm-gcc4 doesn't need runtime libs.  llvm-gcc4 is the only supported one.
35 # FIXME: Remove runtime entirely once we have an understanding of where
36 # libprofile etc should go.
37 #ifeq ($(LLVMGCC_MAJVERS),4)
38   DIRS := $(filter-out runtime, $(DIRS))
39 #endif
40
41 ifeq ($(MAKECMDGOALS),libs-only)
42   DIRS := $(filter-out tools runtime docs, $(DIRS))
43   OPTIONAL_DIRS :=
44 endif
45
46 ifeq ($(MAKECMDGOALS),install-libs)
47   DIRS := $(filter-out tools runtime docs, $(DIRS))
48   OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
49 endif
50
51 ifeq ($(MAKECMDGOALS),tools-only)
52   DIRS := $(filter-out runtime docs, $(DIRS))
53   OPTIONAL_DIRS :=
54 endif
55
56 # Don't install utils, examples, or projects they are only used to 
57 # build LLVM.
58 ifeq ($(MAKECMDGOALS),install)
59   DIRS := $(filter-out utils, $(DIRS))
60   OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
61 endif
62
63 # Include the main makefile machinery.
64 include $(LLVM_SRC_ROOT)/Makefile.rules
65
66 # Specify options to pass to configure script when we're
67 # running the dist-check target
68 DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
69
70 .PHONY: debug-opt-prof
71 debug-opt-prof:
72         $(Echo) Building Debug Version
73         $(Verb) $(MAKE)
74         $(Echo)
75         $(Echo) Building Optimized Version
76         $(Echo)
77         $(Verb) $(MAKE) ENABLE_OPTIMIZED=1
78         $(Echo)
79         $(Echo) Building Profiling Version
80         $(Echo)
81         $(Verb) $(MAKE) ENABLE_PROFILING=1
82
83 dist-hook::
84         $(Echo) Eliminating files constructed by configure
85         $(Verb) $(RM) -f \
86           $(TopDistDir)/include/llvm/ADT/hash_map.h  \
87           $(TopDistDir)/include/llvm/ADT/hash_set.h  \
88           $(TopDistDir)/include/llvm/ADT/iterator.h  \
89           $(TopDistDir)/include/llvm/Config/config.h  \
90           $(TopDistDir)/include/llvm/Support/DataTypes.h  \
91           $(TopDistDir)/include/llvm/Support/ThreadSupport.h
92
93 tools-only: all
94 libs-only: all
95 install-libs: install
96
97 #------------------------------------------------------------------------
98 # Make sure the generated headers are up-to-date. This must be kept in
99 # sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
100 #------------------------------------------------------------------------
101 FilesToConfig := \
102   include/llvm/Config/config.h \
103   include/llvm/Support/DataTypes.h \
104   include/llvm/ADT/hash_map.h \
105   include/llvm/ADT/hash_set.h \
106   include/llvm/ADT/iterator.h
107 FilesToConfigPATH  := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
108
109 all-local:: $(FilesToConfigPATH)
110 $(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in 
111         $(Echo) Regenerating $*
112         $(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
113 .PRECIOUS: $(FilesToConfigPATH)
114
115 # NOTE: This needs to remain as the last target definition in this file so
116 # that it gets executed last.
117 all:: 
118         $(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
119 ifeq ($(BuildMode),Debug)
120         $(Echo) '*****' Note: Debug build can be 10 times slower than an
121         $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
122         $(Echo) '*****' make an optimized build. Alternatively you can
123         $(Echo) '*****' configure with --enable-optimized.
124 endif
125
126 check-llvm2cpp:
127         $(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
128
129 check-one:
130         $(Verb)$(MAKE) -C test check-one TESTONE=$(TESTONE)
131
132 srpm: $(LLVM_OBJ_ROOT)/llvm.spec 
133         rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
134
135 rpm: $(LLVM_OBJ_ROOT)/llvm.spec 
136         rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
137
138 show-footprint:
139         $(Verb) du -sk $(LibDir)
140         $(Verb) du -sk $(ToolDir)
141         $(Verb) du -sk $(ExmplDir)
142         $(Verb) du -sk $(ObjDir)
143
144 build-for-llvm-top:
145         $(Verb) if test ! -f ./config.status ; then \
146           ./configure --prefix="$(LLVM_TOP)/install" \
147             --with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
148         fi
149         $(Verb) $(MAKE) tools-only
150
151 SVN = svn
152 SVN-UPDATE-OPTIONS =
153 AWK = awk
154 SUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}'   \
155                 | LANG=C xargs $(SVN) info 2>/dev/null \
156                 | $(AWK) '/Path:\ / {print $$2}'
157
158 update:
159         $(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
160         @ $(SVN) status $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
161
162 happiness: update all check
163
164 .PHONY: srpm rpm update happiness
165
166 # declare all targets at this level to be serial:
167
168 .NOTPARALLEL:
169