blob: b6ee8b024d22dc2e5b2681922f8b5f56888fb410 [file] [log] [blame]
Misha Brukman6d5ab862004-04-24 00:10:56 +00001#===- ./Makefile -------------------------------------------*- Makefile -*--===#
John Criswelle488e932003-10-20 22:26:57 +00002#
3# The LLVM Compiler Infrastructure
4#
5# This file was developed by the LLVM research group and is distributed under
6# the University of Illinois Open Source License. See LICENSE.TXT for details.
7#
Misha Brukman6d5ab862004-04-24 00:10:56 +00008#===------------------------------------------------------------------------===#
Chris Lattner22033b22006-06-02 22:41:18 +00009
Chris Lattner5720be42006-07-26 19:10:34 +000010LEVEL := .
Chris Lattner87b51012006-09-04 04:27:07 +000011
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.
Reid Spencer8b2e1412006-11-17 03:32:33 +000018# 6. Build tools, runtime, docs.
Chris Lattner87b51012006-09-04 04:27:07 +000019#
20DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
Reid Spencer8b2e1412006-11-17 03:32:33 +000021 tools runtime docs
Chris Lattner87b51012006-09-04 04:27:07 +000022
Chris Lattner5720be42006-07-26 19:10:34 +000023OPTIONAL_DIRS := examples projects
24EXTRA_DIST := test llvm.spec include win32 Xcode
Chris Lattner00950542001-06-06 20:29:01 +000025
Reid Spencer06a801a2006-04-08 02:14:37 +000026include $(LEVEL)/Makefile.config
Reid Spencer93bc3cd2006-04-06 22:15:51 +000027
Reid Spencer8b2e1412006-11-17 03:32:33 +000028# llvm-gcc4 doesn't need runtime libs.
29ifeq ($(LLVMGCC_MAJVERS),4)
30 DIRS := $(filter-out runtime, $(DIRS))
31endif
32
Chris Lattner5720be42006-07-26 19:10:34 +000033ifeq ($(MAKECMDGOALS),libs-only)
Reid Spencer8b2e1412006-11-17 03:32:33 +000034 DIRS := $(filter-out tools runtime docs, $(DIRS))
Chris Lattner22033b22006-06-02 22:41:18 +000035 OPTIONAL_DIRS :=
36endif
37
Chris Lattner5720be42006-07-26 19:10:34 +000038ifeq ($(MAKECMDGOALS),tools-only)
Reid Spencer8b2e1412006-11-17 03:32:33 +000039 DIRS := $(filter-out runtime docs, $(DIRS))
Chris Lattner5720be42006-07-26 19:10:34 +000040 OPTIONAL_DIRS :=
41endif
Chris Lattner22033b22006-06-02 22:41:18 +000042
Chris Lattner122c0552007-02-21 06:23:20 +000043# Don't install utils, examples, or projects they are only used to
44# build LLVM.
45ifeq ($(MAKECMDGOALS),install)
46 DIRS := $(filter-out utils, $(DIRS))
47 OPTIONAL_DIRS :=
48endif
49
Chris Lattner22033b22006-06-02 22:41:18 +000050# Include the main makefile machinery.
Reid Spencer06a801a2006-04-08 02:14:37 +000051include $(LLVM_SRC_ROOT)/Makefile.rules
52
Reid Spencer45eeed92005-05-24 02:33:20 +000053# Specify options to pass to configure script when we're
54# running the dist-check target
55DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
56
Reid Spencerdf561f42004-11-25 09:08:54 +000057.PHONY: debug-opt-prof
58debug-opt-prof:
59 $(Echo) Building Debug Version
60 $(Verb) $(MAKE)
61 $(Echo)
62 $(Echo) Building Optimized Version
63 $(Echo)
64 $(Verb) $(MAKE) ENABLE_OPTIMIZED=1
65 $(Echo)
66 $(Echo) Building Profiling Version
67 $(Echo)
68 $(Verb) $(MAKE) ENABLE_PROFILING=1
69
Reid Spencer151f8ba2004-10-25 08:27:37 +000070dist-hook::
Reid Spencercc2d1e22004-10-30 09:19:36 +000071 $(Echo) Eliminating files constructed by configure
72 $(Verb) $(RM) -f \
Reid Spencer90c29492004-10-26 07:05:09 +000073 $(TopDistDir)/include/llvm/ADT/hash_map \
74 $(TopDistDir)/include/llvm/ADT/hash_set \
75 $(TopDistDir)/include/llvm/ADT/iterator \
76 $(TopDistDir)/include/llvm/Config/config.h \
77 $(TopDistDir)/include/llvm/Support/DataTypes.h \
78 $(TopDistDir)/include/llvm/Support/ThreadSupport.h
Reid Spencer151f8ba2004-10-25 08:27:37 +000079
Chris Lattner9cf662b2004-02-03 22:56:40 +000080tools-only: all
Reid Spencer8b1f7672005-05-25 21:03:17 +000081libs-only: all
Reid Spencerca739c62005-08-25 04:59:49 +000082
83#------------------------------------------------------------------------
84# Make sure the generated headers are up-to-date. This must be kept in
85# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
86#------------------------------------------------------------------------
87FilesToConfig := \
88 include/llvm/Config/config.h \
89 include/llvm/Support/DataTypes.h \
90 include/llvm/ADT/hash_map \
91 include/llvm/ADT/hash_set \
92 include/llvm/ADT/iterator
93FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
94
95all-local:: $(FilesToConfigPATH)
96$(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
97 $(Echo) Regenerating $*
98 $(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
99.PRECIOUS: $(FilesToConfigPATH)
Reid Spencere22f3c02006-04-07 15:58:18 +0000100
Chris Lattner38ab6d82006-04-07 16:21:59 +0000101# NOTE: This needs to remain as the last target definition in this file so
102# that it gets executed last.
Reid Spencere22f3c02006-04-07 15:58:18 +0000103all::
104 $(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
105ifeq ($(BuildMode),Debug)
106 $(Echo) '*****' Note: Debug build can be 10 times slower than an
107 $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
108 $(Echo) '*****' make an optimized build.
109endif
Chris Lattner38ab6d82006-04-07 16:21:59 +0000110
Reid Spencer5b30ee12006-06-01 07:27:53 +0000111check-llvm2cpp:
112 $(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
Chris Lattner5720be42006-07-26 19:10:34 +0000113
Reid Spencerf7c75a62006-08-16 00:43:50 +0000114srpm: $(LLVM_OBJ_ROOT)/llvm.spec
115 rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
116
117rpm: $(LLVM_OBJ_ROOT)/llvm.spec
118 rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
119
Reid Spencer1e46ae42007-02-05 23:18:58 +0000120show-footprint:
121 $(Verb) du -sk $(LibDir)
122 $(Verb) du -sk $(ToolDir)
123 $(Verb) du -sk $(ExmplDir)
124 $(Verb) du -sk $(ObjDir)
125
Reid Spencerf7c75a62006-08-16 00:43:50 +0000126.PHONY: srpm rpm