blob: 97a738805d6bce4ce7a16e1abd5873c2737887f4 [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 Spencerac90d5e2006-11-16 23:17:27 +000018# 6. Build tools, docs.
Chris Lattner87b51012006-09-04 04:27:07 +000019#
20DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
Reid Spencerac90d5e2006-11-16 23:17:27 +000021 tools 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
Chris Lattner5720be42006-07-26 19:10:34 +000028ifeq ($(MAKECMDGOALS),libs-only)
Reid Spencerac90d5e2006-11-16 23:17:27 +000029 DIRS := $(filter-out tools docs, $(DIRS))
Chris Lattner22033b22006-06-02 22:41:18 +000030 OPTIONAL_DIRS :=
31endif
32
Chris Lattner5720be42006-07-26 19:10:34 +000033ifeq ($(MAKECMDGOALS),tools-only)
Reid Spencerac90d5e2006-11-16 23:17:27 +000034 DIRS := $(filter-out docs, $(DIRS))
Chris Lattner5720be42006-07-26 19:10:34 +000035 OPTIONAL_DIRS :=
36endif
Chris Lattner22033b22006-06-02 22:41:18 +000037
Chris Lattner5720be42006-07-26 19:10:34 +000038# Don't install utils, examples, or projects they are only used to
39# build LLVM.
40ifeq ($(MAKECMDGOALS),install)
41 DIRS := $(filter-out utils, $(DIRS))
42 OPTIONAL_DIRS :=
43endif
Reid Spencer90c29492004-10-26 07:05:09 +000044
Chris Lattner22033b22006-06-02 22:41:18 +000045# Include the main makefile machinery.
Reid Spencer06a801a2006-04-08 02:14:37 +000046include $(LLVM_SRC_ROOT)/Makefile.rules
47
Reid Spencer45eeed92005-05-24 02:33:20 +000048# Specify options to pass to configure script when we're
49# running the dist-check target
50DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
51
Reid Spencerdf561f42004-11-25 09:08:54 +000052.PHONY: debug-opt-prof
53debug-opt-prof:
54 $(Echo) Building Debug Version
55 $(Verb) $(MAKE)
56 $(Echo)
57 $(Echo) Building Optimized Version
58 $(Echo)
59 $(Verb) $(MAKE) ENABLE_OPTIMIZED=1
60 $(Echo)
61 $(Echo) Building Profiling Version
62 $(Echo)
63 $(Verb) $(MAKE) ENABLE_PROFILING=1
64
Reid Spencer151f8ba2004-10-25 08:27:37 +000065dist-hook::
Reid Spencercc2d1e22004-10-30 09:19:36 +000066 $(Echo) Eliminating files constructed by configure
67 $(Verb) $(RM) -f \
Reid Spencer90c29492004-10-26 07:05:09 +000068 $(TopDistDir)/include/llvm/ADT/hash_map \
69 $(TopDistDir)/include/llvm/ADT/hash_set \
70 $(TopDistDir)/include/llvm/ADT/iterator \
71 $(TopDistDir)/include/llvm/Config/config.h \
72 $(TopDistDir)/include/llvm/Support/DataTypes.h \
73 $(TopDistDir)/include/llvm/Support/ThreadSupport.h
Reid Spencer151f8ba2004-10-25 08:27:37 +000074
Chris Lattner9cf662b2004-02-03 22:56:40 +000075tools-only: all
Reid Spencer8b1f7672005-05-25 21:03:17 +000076libs-only: all
Reid Spencerca739c62005-08-25 04:59:49 +000077
78#------------------------------------------------------------------------
79# Make sure the generated headers are up-to-date. This must be kept in
80# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
81#------------------------------------------------------------------------
82FilesToConfig := \
83 include/llvm/Config/config.h \
84 include/llvm/Support/DataTypes.h \
85 include/llvm/ADT/hash_map \
86 include/llvm/ADT/hash_set \
87 include/llvm/ADT/iterator
88FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
89
90all-local:: $(FilesToConfigPATH)
91$(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
92 $(Echo) Regenerating $*
93 $(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
94.PRECIOUS: $(FilesToConfigPATH)
Reid Spencere22f3c02006-04-07 15:58:18 +000095
Chris Lattner38ab6d82006-04-07 16:21:59 +000096# NOTE: This needs to remain as the last target definition in this file so
97# that it gets executed last.
Reid Spencere22f3c02006-04-07 15:58:18 +000098all::
99 $(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
100ifeq ($(BuildMode),Debug)
101 $(Echo) '*****' Note: Debug build can be 10 times slower than an
102 $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
103 $(Echo) '*****' make an optimized build.
104endif
Chris Lattner38ab6d82006-04-07 16:21:59 +0000105
Reid Spencer5b30ee12006-06-01 07:27:53 +0000106check-llvm2cpp:
107 $(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
Chris Lattner5720be42006-07-26 19:10:34 +0000108
Reid Spencerf7c75a62006-08-16 00:43:50 +0000109srpm: $(LLVM_OBJ_ROOT)/llvm.spec
110 rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
111
112rpm: $(LLVM_OBJ_ROOT)/llvm.spec
113 rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
114
115.PHONY: srpm rpm