blob: 8f16ce2e7b330bc94cee2c336298ce7cfde5c9fc [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 Lattner22033b22006-06-02 22:41:18 +000043# Include the main makefile machinery.
Reid Spencer06a801a2006-04-08 02:14:37 +000044include $(LLVM_SRC_ROOT)/Makefile.rules
45
Reid Spencer45eeed92005-05-24 02:33:20 +000046# Specify options to pass to configure script when we're
47# running the dist-check target
48DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
49
Reid Spencerdf561f42004-11-25 09:08:54 +000050.PHONY: debug-opt-prof
51debug-opt-prof:
52 $(Echo) Building Debug Version
53 $(Verb) $(MAKE)
54 $(Echo)
55 $(Echo) Building Optimized Version
56 $(Echo)
57 $(Verb) $(MAKE) ENABLE_OPTIMIZED=1
58 $(Echo)
59 $(Echo) Building Profiling Version
60 $(Echo)
61 $(Verb) $(MAKE) ENABLE_PROFILING=1
62
Reid Spencer151f8ba2004-10-25 08:27:37 +000063dist-hook::
Reid Spencercc2d1e22004-10-30 09:19:36 +000064 $(Echo) Eliminating files constructed by configure
65 $(Verb) $(RM) -f \
Reid Spencer90c29492004-10-26 07:05:09 +000066 $(TopDistDir)/include/llvm/ADT/hash_map \
67 $(TopDistDir)/include/llvm/ADT/hash_set \
68 $(TopDistDir)/include/llvm/ADT/iterator \
69 $(TopDistDir)/include/llvm/Config/config.h \
70 $(TopDistDir)/include/llvm/Support/DataTypes.h \
71 $(TopDistDir)/include/llvm/Support/ThreadSupport.h
Reid Spencer151f8ba2004-10-25 08:27:37 +000072
Chris Lattner9cf662b2004-02-03 22:56:40 +000073tools-only: all
Reid Spencer8b1f7672005-05-25 21:03:17 +000074libs-only: all
Reid Spencerca739c62005-08-25 04:59:49 +000075
76#------------------------------------------------------------------------
77# Make sure the generated headers are up-to-date. This must be kept in
78# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
79#------------------------------------------------------------------------
80FilesToConfig := \
81 include/llvm/Config/config.h \
82 include/llvm/Support/DataTypes.h \
83 include/llvm/ADT/hash_map \
84 include/llvm/ADT/hash_set \
85 include/llvm/ADT/iterator
86FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
87
88all-local:: $(FilesToConfigPATH)
89$(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
90 $(Echo) Regenerating $*
91 $(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
92.PRECIOUS: $(FilesToConfigPATH)
Reid Spencere22f3c02006-04-07 15:58:18 +000093
Chris Lattner38ab6d82006-04-07 16:21:59 +000094# NOTE: This needs to remain as the last target definition in this file so
95# that it gets executed last.
Reid Spencere22f3c02006-04-07 15:58:18 +000096all::
97 $(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
98ifeq ($(BuildMode),Debug)
99 $(Echo) '*****' Note: Debug build can be 10 times slower than an
100 $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
101 $(Echo) '*****' make an optimized build.
102endif
Chris Lattner38ab6d82006-04-07 16:21:59 +0000103
Reid Spencer5b30ee12006-06-01 07:27:53 +0000104check-llvm2cpp:
105 $(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
Chris Lattner5720be42006-07-26 19:10:34 +0000106
Reid Spencerf7c75a62006-08-16 00:43:50 +0000107srpm: $(LLVM_OBJ_ROOT)/llvm.spec
108 rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
109
110rpm: $(LLVM_OBJ_ROOT)/llvm.spec
111 rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
112
Reid Spencer1e46ae42007-02-05 23:18:58 +0000113show-footprint:
114 $(Verb) du -sk $(LibDir)
115 $(Verb) du -sk $(ToolDir)
116 $(Verb) du -sk $(ExmplDir)
117 $(Verb) du -sk $(ObjDir)
118
Reid Spencerf7c75a62006-08-16 00:43:50 +0000119.PHONY: srpm rpm