166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#===- ./Makefile -------------------------------------------*- Makefile -*--===#
266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#                     The LLVM Compiler Infrastructure
466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# This file is distributed under the University of Illinois Open Source
666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# License. See LICENSE.TXT for details.
766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#===------------------------------------------------------------------------===#
966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
1066b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanLEVEL := .
1166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
1266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Top-Level LLVM Build Stages:
1366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#   1. Build lib/Support and lib/TableGen, which are used by utils (tblgen).
1466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#   2. Build utils, which is used by VMCore.
1566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#   3. Build VMCore, which builds the Intrinsics.inc file used by libs.
1666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#   4. Build libs, which are needed by llvm-config.
1766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#   5. Build llvm-config, which determines inter-lib dependencies for tools.
1866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#   6. Build tools, runtime, docs.
1966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
2066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# When cross-compiling, there are some things (tablegen) that need to
2166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# be build for the build system first.
2266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
2366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# If "RC_ProjectName" exists in the environment, and its value is
2466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# "llvmCore", then this is an "Apple-style" build; search for
2566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# "Apple-style" in the comments for more info.  Anything else is a
2666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# normal build.
2766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifneq ($(findstring llvmCore, $(RC_ProjectName)),llvmCore)  # Normal build (not "Apple-style").
2866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
2966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(BUILD_DIRS_ONLY),1)
3066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := lib/Support lib/TableGen utils
3166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS := tools/clang/utils/TableGen
3266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanelse
3366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := lib/Support lib/TableGen utils lib/VMCore lib tools/llvm-shlib \
3466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          tools/llvm-config tools runtime docs unittests
3566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS := projects bindings
3666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
3766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
3866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(BUILD_EXAMPLES),1)
3966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS += examples
4066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
4166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
4266b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEXTRA_DIST := test unittests llvm.spec include win32 Xcode
4366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
4466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninclude $(LEVEL)/Makefile.config
4566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
4666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifneq ($(ENABLE_SHARED),1)
4766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := $(filter-out tools/llvm-shlib, $(DIRS))
4866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
4966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
5066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifneq ($(ENABLE_DOCS),1)
5166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := $(filter-out docs, $(DIRS))
5266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
5366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
5466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(MAKECMDGOALS),libs-only)
5566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := $(filter-out tools runtime docs, $(DIRS))
5666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS :=
5766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
5866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
5966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(MAKECMDGOALS),install-libs)
6066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := $(filter-out tools runtime docs, $(DIRS))
6166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
6266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
6366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
6466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(MAKECMDGOALS),tools-only)
6566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := $(filter-out runtime docs, $(DIRS))
6666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS :=
6766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
6866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
6966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(MAKECMDGOALS),install-clang)
7066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
7166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          tools/clang/runtime tools/clang/docs \
7266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          tools/lto runtime
7366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS :=
7466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  NO_INSTALL = 1
7566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
7666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
7766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(MAKECMDGOALS),install-clang-c)
7866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
7966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          tools/clang/tools/libclang tools/clang/tools/c-index-test \
8066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  tools/clang/include/clang-c
8166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS :=
8266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  NO_INSTALL = 1
8366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
8466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
8566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(MAKECMDGOALS),clang-only)
8666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := $(filter-out tools docs unittests, $(DIRS)) \
8766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          tools/clang tools/lto
8866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS :=
8966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
9066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
9166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(MAKECMDGOALS),unittests)
9266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := $(filter-out tools runtime docs, $(DIRS)) utils unittests
9366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS :=
9466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
9566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
9666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Use NO_INSTALL define of the Makefile of each directory for deciding
9766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# if the directory is installed or not
9866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(MAKECMDGOALS),install)
9966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
10066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
10166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
10266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Don't build unittests when ONLY_TOOLS is set.
10366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifneq ($(ONLY_TOOLS),)
10466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DIRS := $(filter-out unittests, $(DIRS))
10566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
10666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
10766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# If we're cross-compiling, build the build-hosted tools first
10866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(LLVM_CROSS_COMPILING),1)
10966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanall:: cross-compile-build-tools
11066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
11166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanclean::
11266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) rm -rf BuildTools
11366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
11466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancross-compile-build-tools:
11566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) if [ ! -f BuildTools/Makefile ]; then \
11666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          $(MKDIR) BuildTools; \
11766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cd BuildTools ; \
11866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  unset CFLAGS ; \
11966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  unset CXXFLAGS ; \
12066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $(PROJ_SRC_DIR)/configure --build=$(BUILD_TRIPLE) \
12166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		--host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE) \
12266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        --disable-polly ; \
12366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cd .. ; \
12466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi; \
12566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	(unset SDKROOT; \
12666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 $(MAKE) -C BuildTools \
12766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  BUILD_DIRS_ONLY=1 \
12866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  UNIVERSAL= \
12966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ENABLE_OPTIMIZED=$(ENABLE_OPTIMIZED) \
13066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ENABLE_PROFILING=$(ENABLE_PROFILING) \
13166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ENABLE_COVERAGE=$(ENABLE_COVERAGE) \
13266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  DISABLE_ASSERTIONS=$(DISABLE_ASSERTIONS) \
13366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ENABLE_EXPENSIVE_CHECKS=$(ENABLE_EXPENSIVE_CHECKS) \
13466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  CFLAGS= \
13566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  CXXFLAGS= \
13666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	) || exit 1;
13766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
13866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
13966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Include the main makefile machinery.
14066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninclude $(LLVM_SRC_ROOT)/Makefile.rules
14166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
14266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Specify options to pass to configure script when we're
14366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# running the dist-check target
14466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanDIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
14566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
14666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman.PHONY: debug-opt-prof
14766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandebug-opt-prof:
14866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) Building Debug Version
14966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) $(MAKE)
15066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo)
15166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) Building Optimized Version
15266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo)
15366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) $(MAKE) ENABLE_OPTIMIZED=1
15466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo)
15566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) Building Profiling Version
15666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo)
15766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) $(MAKE) ENABLE_PROFILING=1
15866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
15966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandist-hook::
16066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) Eliminating files constructed by configure
16166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) $(RM) -f \
16266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $(TopDistDir)/include/llvm/Config/config.h  \
16366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $(TopDistDir)/include/llvm/Support/DataTypes.h
16466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
16566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanclang-only: all
16666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumantools-only: all
16766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlibs-only: all
16866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninstall-clang: install
16966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninstall-clang-c: install
17066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninstall-libs: install
17166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
17266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# If SHOW_DIAGNOSTICS is enabled, clear the diagnostics file first.
17366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(SHOW_DIAGNOSTICS),1)
17466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanclean-diagnostics:
17566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) rm -f $(LLVM_OBJ_ROOT)/$(BuildMode)/diags
17666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman.PHONY: clean-diagnostics
17766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
17866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanall-local:: clean-diagnostics
17966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
18066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
18166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#------------------------------------------------------------------------
18266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Make sure the generated headers are up-to-date. This must be kept in
18366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
18466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#------------------------------------------------------------------------
18566b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanFilesToConfig := \
18666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  include/llvm/Config/config.h \
18766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  include/llvm/Config/Targets.def \
18866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  include/llvm/Config/AsmPrinters.def \
18966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  include/llvm/Config/AsmParsers.def \
19066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  include/llvm/Config/Disassemblers.def \
19166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  include/llvm/Support/DataTypes.h
19266b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanFilesToConfigPATH  := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
19366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
19466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanall-local:: $(FilesToConfigPATH)
19566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman$(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
19666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) Regenerating $*
19766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
19866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman.PRECIOUS: $(FilesToConfigPATH)
19966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
20066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# NOTE: This needs to remain as the last target definition in this file so
20166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# that it gets executed last.
20266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifneq ($(BUILD_DIRS_ONLY),1)
20366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanall::
20466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) '*****' Completed $(BuildMode) Build
20566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifneq ($(ENABLE_OPTIMIZED),1)
20666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) '*****' Note: Debug build can be 10 times slower than an
20766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
20866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) '*****' make an optimized build. Alternatively you can
20966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Echo) '*****' configure with --enable-optimized.
21066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanifeq ($(SHOW_DIAGNOSTICS),1)
21166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) if test -s $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; then \
21266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $(LLVM_SRC_ROOT)/utils/show-diagnostics \
21366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; \
21466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
21566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
21666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
21766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif
21866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
21966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancheck-llvm2cpp:
22066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
22166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
22266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumansrpm: $(LLVM_OBJ_ROOT)/llvm.spec
22366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
22466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
22566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrpm: $(LLVM_OBJ_ROOT)/llvm.spec
22666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
22766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
22866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanshow-footprint:
22966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) du -sk $(LibDir)
23066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) du -sk $(ToolDir)
23166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) du -sk $(ExmplDir)
23266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) du -sk $(ObjDir)
23366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
23466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanbuild-for-llvm-top:
23566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) if test ! -f ./config.status ; then \
23666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ./configure --prefix="$(LLVM_TOP)/install" \
23766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    --with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
23866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
23966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(Verb) $(MAKE) tools-only
24066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
24166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanSVN = svn
24266b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanSVN-UPDATE-OPTIONS =
24366b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanAWK = awk
24466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanSUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}'   \
24566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		| LC_ALL=C xargs $(SVN) info 2>/dev/null \
24666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		| $(AWK) '/Path:\ / {print $$2}'
24766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
24866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanupdate:
24966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
25066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	@ $(SVN) status $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
25166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
25266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanhappiness: update all check-all
25366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
25466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman.PHONY: srpm rpm update happiness
25566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
25666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# declare all targets at this level to be serial:
25766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
25866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman.NOTPARALLEL:
25966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
26066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanelse # Building "Apple-style."
26166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# In an Apple-style build, once configuration is done, lines marked
26266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# "Apple-style" are removed with sed!  Please don't remove these!
26366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Look for the string "Apple-style" in utils/buildit/build_llvm.
26466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninclude $(shell find . -name GNUmakefile) # Building "Apple-style."
26566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanendif # Building "Apple-style."
266