2004-04-24 00:10:56 +00:00
|
|
|
#===- ./Makefile -------------------------------------------*- Makefile -*--===#
|
2009-01-08 02:11:55 +00:00
|
|
|
#
|
2003-10-20 22:26:57 +00:00
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
2007-12-29 20:11:13 +00:00
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
2009-01-08 02:11:55 +00:00
|
|
|
#
|
2004-04-24 00:10:56 +00:00
|
|
|
#===------------------------------------------------------------------------===#
|
2006-06-02 22:41:18 +00:00
|
|
|
|
2006-07-26 19:10:34 +00:00
|
|
|
LEVEL := .
|
2006-09-04 04:27:07 +00:00
|
|
|
|
|
|
|
# Top-Level LLVM Build Stages:
|
2011-10-01 16:41:13 +00:00
|
|
|
# 1. Build lib/Support and lib/TableGen, which are used by utils (tblgen).
|
2013-01-02 09:27:25 +00:00
|
|
|
# 2. Build utils, which is used by IR.
|
|
|
|
# 3. Build IR, which builds the Intrinsics.inc file used by libs.
|
2011-11-10 19:59:35 +00:00
|
|
|
# 4. Build libs, which are needed by llvm-config.
|
|
|
|
# 5. Build llvm-config, which determines inter-lib dependencies for tools.
|
2014-02-09 16:37:02 +00:00
|
|
|
# 6. Build tools, docs, and cmake modules.
|
2006-09-04 04:27:07 +00:00
|
|
|
#
|
2008-11-10 07:33:13 +00:00
|
|
|
# When cross-compiling, there are some things (tablegen) that need to
|
|
|
|
# be build for the build system first.
|
2009-10-22 17:22:37 +00:00
|
|
|
|
|
|
|
# If "RC_ProjectName" exists in the environment, and its value is
|
|
|
|
# "llvmCore", then this is an "Apple-style" build; search for
|
|
|
|
# "Apple-style" in the comments for more info. Anything else is a
|
|
|
|
# normal build.
|
2009-10-30 19:51:32 +00:00
|
|
|
ifneq ($(findstring llvmCore, $(RC_ProjectName)),llvmCore) # Normal build (not "Apple-style").
|
|
|
|
|
2008-11-10 07:33:13 +00:00
|
|
|
ifeq ($(BUILD_DIRS_ONLY),1)
|
2011-12-01 20:18:09 +00:00
|
|
|
DIRS := lib/Support lib/TableGen utils tools/llvm-config
|
2011-10-08 00:27:38 +00:00
|
|
|
OPTIONAL_DIRS := tools/clang/utils/TableGen
|
2008-11-10 07:33:13 +00:00
|
|
|
else
|
2013-01-02 09:27:25 +00:00
|
|
|
DIRS := lib/Support lib/TableGen utils lib/IR lib tools/llvm-shlib \
|
2014-02-09 16:37:02 +00:00
|
|
|
tools/llvm-config tools docs cmake unittests
|
2009-11-16 22:38:00 +00:00
|
|
|
OPTIONAL_DIRS := projects bindings
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BUILD_EXAMPLES),1)
|
|
|
|
OPTIONAL_DIRS += examples
|
2008-11-10 07:33:13 +00:00
|
|
|
endif
|
2007-07-11 23:44:08 +00:00
|
|
|
|
2009-01-01 02:24:48 +00:00
|
|
|
EXTRA_DIST := test unittests llvm.spec include win32 Xcode
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
include $(LEVEL)/Makefile.config
|
2006-04-06 22:15:51 +00:00
|
|
|
|
2010-02-25 06:34:33 +00:00
|
|
|
ifneq ($(ENABLE_SHARED),1)
|
|
|
|
DIRS := $(filter-out tools/llvm-shlib, $(DIRS))
|
|
|
|
endif
|
|
|
|
|
2010-11-12 19:24:06 +00:00
|
|
|
ifneq ($(ENABLE_DOCS),1)
|
|
|
|
DIRS := $(filter-out docs, $(DIRS))
|
|
|
|
endif
|
|
|
|
|
2006-07-26 19:10:34 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),libs-only)
|
2013-10-02 15:42:23 +00:00
|
|
|
DIRS := $(filter-out tools docs, $(DIRS))
|
2006-07-26 19:10:34 +00:00
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
endif
|
2006-06-02 22:41:18 +00:00
|
|
|
|
2007-12-13 02:17:17 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),install-libs)
|
2013-10-02 15:42:23 +00:00
|
|
|
DIRS := $(filter-out tools docs, $(DIRS))
|
2007-12-13 02:17:17 +00:00
|
|
|
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
|
|
|
endif
|
|
|
|
|
2005-05-25 21:03:17 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),tools-only)
|
2013-10-02 15:42:23 +00:00
|
|
|
DIRS := $(filter-out docs, $(DIRS))
|
2006-07-26 19:10:34 +00:00
|
|
|
OPTIONAL_DIRS :=
|
2004-02-03 23:05:24 +00:00
|
|
|
endif
|
2006-06-02 22:41:18 +00:00
|
|
|
|
2009-01-19 19:48:23 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),install-clang)
|
2010-01-20 00:43:07 +00:00
|
|
|
DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
|
2012-10-24 22:56:32 +00:00
|
|
|
tools/clang/tools/libclang \
|
2012-11-06 19:54:46 +00:00
|
|
|
tools/clang/tools/c-index-test \
|
2011-11-27 00:26:22 +00:00
|
|
|
tools/clang/include/clang-c \
|
2010-07-16 01:29:50 +00:00
|
|
|
tools/clang/runtime tools/clang/docs \
|
2013-10-02 15:42:23 +00:00
|
|
|
tools/lto
|
2009-01-19 19:48:23 +00:00
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
NO_INSTALL = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(MAKECMDGOALS),clang-only)
|
2011-06-10 21:47:14 +00:00
|
|
|
DIRS := $(filter-out tools docs unittests, $(DIRS)) \
|
2010-07-16 01:29:50 +00:00
|
|
|
tools/clang tools/lto
|
2009-01-19 19:48:23 +00:00
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
endif
|
|
|
|
|
2009-01-01 02:24:48 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),unittests)
|
2013-10-02 15:42:23 +00:00
|
|
|
DIRS := $(filter-out tools docs, $(DIRS)) utils unittests
|
2009-01-01 02:24:48 +00:00
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
endif
|
|
|
|
|
2009-05-08 17:32:47 +00:00
|
|
|
# Use NO_INSTALL define of the Makefile of each directory for deciding
|
|
|
|
# if the directory is installed or not
|
2007-02-21 06:23:20 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),install)
|
2007-09-18 12:49:39 +00:00
|
|
|
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
2007-02-21 06:23:20 +00:00
|
|
|
endif
|
|
|
|
|
2010-11-27 06:59:16 +00:00
|
|
|
# Don't build unittests when ONLY_TOOLS is set.
|
|
|
|
ifneq ($(ONLY_TOOLS),)
|
|
|
|
DIRS := $(filter-out unittests, $(DIRS))
|
|
|
|
endif
|
|
|
|
|
2008-11-10 07:33:13 +00:00
|
|
|
# If we're cross-compiling, build the build-hosted tools first
|
|
|
|
ifeq ($(LLVM_CROSS_COMPILING),1)
|
|
|
|
all:: cross-compile-build-tools
|
|
|
|
|
|
|
|
clean::
|
|
|
|
$(Verb) rm -rf BuildTools
|
|
|
|
|
|
|
|
cross-compile-build-tools:
|
|
|
|
$(Verb) if [ ! -f BuildTools/Makefile ]; then \
|
|
|
|
$(MKDIR) BuildTools; \
|
|
|
|
cd BuildTools ; \
|
2009-10-30 19:53:38 +00:00
|
|
|
unset CFLAGS ; \
|
|
|
|
unset CXXFLAGS ; \
|
2014-03-25 21:45:41 +00:00
|
|
|
AR=$(BUILD_AR) ; \
|
|
|
|
AS=$(BUILD_AS) ; \
|
|
|
|
LD=$(BUILD_LD) ; \
|
|
|
|
CC=$(BUILD_CC) ; \
|
|
|
|
CXX=$(BUILD_CXX) ; \
|
2012-08-22 22:01:01 +00:00
|
|
|
unset SDKROOT ; \
|
2012-09-24 22:51:19 +00:00
|
|
|
unset UNIVERSAL_SDK_PATH ; \
|
2014-01-16 19:35:01 +00:00
|
|
|
configure_opts= ; \
|
2014-01-17 00:40:39 +00:00
|
|
|
if test "$(ENABLE_LIBCPP)" -ne 0 ; then \
|
2014-01-16 19:35:01 +00:00
|
|
|
configure_opts="$$configure_opts --enable-libcpp"; \
|
|
|
|
fi; \
|
2009-09-02 23:52:23 +00:00
|
|
|
$(PROJ_SRC_DIR)/configure --build=$(BUILD_TRIPLE) \
|
2011-10-08 00:27:38 +00:00
|
|
|
--host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE) \
|
2014-01-16 19:35:01 +00:00
|
|
|
--disable-polly $$configure_opts; \
|
2008-11-10 07:33:13 +00:00
|
|
|
cd .. ; \
|
|
|
|
fi; \
|
2012-09-24 22:51:19 +00:00
|
|
|
($(MAKE) -C BuildTools \
|
2009-09-02 23:52:23 +00:00
|
|
|
BUILD_DIRS_ONLY=1 \
|
|
|
|
UNIVERSAL= \
|
2012-09-24 22:51:19 +00:00
|
|
|
UNIVERSAL_SDK_PATH= \
|
|
|
|
SDKROOT= \
|
2011-11-12 00:18:02 +00:00
|
|
|
TARGET_NATIVE_ARCH="$(TARGET_NATIVE_ARCH)" \
|
2011-11-11 22:59:45 +00:00
|
|
|
TARGETS_TO_BUILD="$(TARGETS_TO_BUILD)" \
|
2013-12-16 13:09:06 +00:00
|
|
|
TARGET_LIBS="$(LIBS)" \
|
2009-09-02 23:52:23 +00:00
|
|
|
ENABLE_OPTIMIZED=$(ENABLE_OPTIMIZED) \
|
|
|
|
ENABLE_PROFILING=$(ENABLE_PROFILING) \
|
|
|
|
ENABLE_COVERAGE=$(ENABLE_COVERAGE) \
|
|
|
|
DISABLE_ASSERTIONS=$(DISABLE_ASSERTIONS) \
|
|
|
|
ENABLE_EXPENSIVE_CHECKS=$(ENABLE_EXPENSIVE_CHECKS) \
|
2011-11-11 22:51:42 +00:00
|
|
|
ENABLE_LIBCPP=$(ENABLE_LIBCPP) \
|
2010-04-24 00:46:14 +00:00
|
|
|
CFLAGS= \
|
|
|
|
CXXFLAGS= \
|
2009-09-02 23:52:23 +00:00
|
|
|
) || exit 1;
|
2008-11-10 07:33:13 +00:00
|
|
|
endif
|
|
|
|
|
2006-06-02 22:41:18 +00:00
|
|
|
# Include the main makefile machinery.
|
2006-04-08 02:14:37 +00:00
|
|
|
include $(LLVM_SRC_ROOT)/Makefile.rules
|
|
|
|
|
2005-05-24 02:33:20 +00:00
|
|
|
# Specify options to pass to configure script when we're
|
|
|
|
# running the dist-check target
|
|
|
|
DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
|
|
|
|
|
2004-11-25 09:08:54 +00:00
|
|
|
.PHONY: debug-opt-prof
|
|
|
|
debug-opt-prof:
|
|
|
|
$(Echo) Building Debug Version
|
|
|
|
$(Verb) $(MAKE)
|
|
|
|
$(Echo)
|
|
|
|
$(Echo) Building Optimized Version
|
|
|
|
$(Echo)
|
|
|
|
$(Verb) $(MAKE) ENABLE_OPTIMIZED=1
|
|
|
|
$(Echo)
|
|
|
|
$(Echo) Building Profiling Version
|
|
|
|
$(Echo)
|
|
|
|
$(Verb) $(MAKE) ENABLE_PROFILING=1
|
|
|
|
|
2004-10-25 08:27:37 +00:00
|
|
|
dist-hook::
|
2004-10-30 09:19:36 +00:00
|
|
|
$(Echo) Eliminating files constructed by configure
|
|
|
|
$(Verb) $(RM) -f \
|
2004-10-26 07:05:09 +00:00
|
|
|
$(TopDistDir)/include/llvm/Config/config.h \
|
2010-11-29 18:16:10 +00:00
|
|
|
$(TopDistDir)/include/llvm/Support/DataTypes.h
|
2004-10-25 08:27:37 +00:00
|
|
|
|
2009-01-19 19:48:23 +00:00
|
|
|
clang-only: all
|
2004-02-03 22:56:40 +00:00
|
|
|
tools-only: all
|
2005-05-25 21:03:17 +00:00
|
|
|
libs-only: all
|
2009-01-19 19:48:23 +00:00
|
|
|
install-clang: install
|
2007-12-13 02:17:17 +00:00
|
|
|
install-libs: install
|
2005-08-25 04:59:49 +00:00
|
|
|
|
2011-04-11 22:37:39 +00:00
|
|
|
# If SHOW_DIAGNOSTICS is enabled, clear the diagnostics file first.
|
|
|
|
ifeq ($(SHOW_DIAGNOSTICS),1)
|
|
|
|
clean-diagnostics:
|
|
|
|
$(Verb) rm -f $(LLVM_OBJ_ROOT)/$(BuildMode)/diags
|
|
|
|
.PHONY: clean-diagnostics
|
|
|
|
|
|
|
|
all-local:: clean-diagnostics
|
|
|
|
endif
|
|
|
|
|
2005-08-25 04:59:49 +00:00
|
|
|
#------------------------------------------------------------------------
|
2012-01-17 02:56:49 +00:00
|
|
|
# Make sure the generated files are up-to-date. This must be kept in
|
|
|
|
# sync with the AC_CONFIG_HEADER and AC_CONFIG_FILE invocations in
|
|
|
|
# autoconf/configure.ac.
|
|
|
|
# Note that Makefile.config is covered by its own separate rule
|
|
|
|
# in Makefile.rules where it can be reused by sub-projects.
|
2005-08-25 04:59:49 +00:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
FilesToConfig := \
|
2012-01-17 02:56:49 +00:00
|
|
|
bindings/ocaml/llvm/META.llvm \
|
|
|
|
docs/doxygen.cfg \
|
|
|
|
llvm.spec \
|
2005-08-25 04:59:49 +00:00
|
|
|
include/llvm/Config/config.h \
|
2012-01-17 02:56:49 +00:00
|
|
|
include/llvm/Config/llvm-config.h \
|
2009-06-16 20:12:29 +00:00
|
|
|
include/llvm/Config/Targets.def \
|
2009-11-25 04:46:58 +00:00
|
|
|
include/llvm/Config/AsmPrinters.def \
|
|
|
|
include/llvm/Config/AsmParsers.def \
|
|
|
|
include/llvm/Config/Disassemblers.def \
|
2011-09-19 23:22:41 +00:00
|
|
|
include/llvm/Support/DataTypes.h
|
2005-08-25 04:59:49 +00:00
|
|
|
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
|
|
|
|
|
|
|
|
all-local:: $(FilesToConfigPATH)
|
2009-01-08 02:11:55 +00:00
|
|
|
$(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
|
2005-08-25 04:59:49 +00:00
|
|
|
$(Echo) Regenerating $*
|
|
|
|
$(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
|
|
|
|
.PRECIOUS: $(FilesToConfigPATH)
|
2006-04-07 15:58:18 +00:00
|
|
|
|
2006-04-07 16:21:59 +00:00
|
|
|
# NOTE: This needs to remain as the last target definition in this file so
|
|
|
|
# that it gets executed last.
|
2008-11-10 07:33:13 +00:00
|
|
|
ifneq ($(BUILD_DIRS_ONLY),1)
|
2009-01-08 02:11:55 +00:00
|
|
|
all::
|
2010-07-07 07:48:00 +00:00
|
|
|
$(Echo) '*****' Completed $(BuildMode) Build
|
2010-07-07 16:48:16 +00:00
|
|
|
ifneq ($(ENABLE_OPTIMIZED),1)
|
2006-04-07 15:58:18 +00:00
|
|
|
$(Echo) '*****' Note: Debug build can be 10 times slower than an
|
|
|
|
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
|
2008-02-28 11:48:14 +00:00
|
|
|
$(Echo) '*****' make an optimized build. Alternatively you can
|
|
|
|
$(Echo) '*****' configure with --enable-optimized.
|
2011-04-11 22:37:39 +00:00
|
|
|
ifeq ($(SHOW_DIAGNOSTICS),1)
|
|
|
|
$(Verb) if test -s $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; then \
|
2011-11-02 19:48:19 +00:00
|
|
|
$(LLVM_SRC_ROOT)/utils/clang-parse-diagnostics-file -a \
|
2011-04-11 22:37:39 +00:00
|
|
|
$(LLVM_OBJ_ROOT)/$(BuildMode)/diags; \
|
|
|
|
fi
|
|
|
|
endif
|
2006-04-07 15:58:18 +00:00
|
|
|
endif
|
2008-11-10 07:33:13 +00:00
|
|
|
endif
|
2006-04-07 16:21:59 +00:00
|
|
|
|
2006-06-01 07:27:53 +00:00
|
|
|
check-llvm2cpp:
|
2007-04-15 06:22:48 +00:00
|
|
|
$(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
|
2006-07-26 19:10:34 +00:00
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
srpm: $(LLVM_OBJ_ROOT)/llvm.spec
|
2006-08-16 00:43:50 +00:00
|
|
|
rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
|
|
|
|
|
2009-01-08 02:11:55 +00:00
|
|
|
rpm: $(LLVM_OBJ_ROOT)/llvm.spec
|
2006-08-16 00:43:50 +00:00
|
|
|
rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
|
|
|
|
|
2007-02-05 23:18:58 +00:00
|
|
|
show-footprint:
|
|
|
|
$(Verb) du -sk $(LibDir)
|
|
|
|
$(Verb) du -sk $(ToolDir)
|
|
|
|
$(Verb) du -sk $(ExmplDir)
|
|
|
|
$(Verb) du -sk $(ObjDir)
|
|
|
|
|
2007-07-08 03:50:22 +00:00
|
|
|
build-for-llvm-top:
|
|
|
|
$(Verb) if test ! -f ./config.status ; then \
|
|
|
|
./configure --prefix="$(LLVM_TOP)/install" \
|
|
|
|
--with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
|
|
|
|
fi
|
|
|
|
$(Verb) $(MAKE) tools-only
|
|
|
|
|
2008-02-28 13:06:50 +00:00
|
|
|
SVN = svn
|
2008-02-28 14:58:14 +00:00
|
|
|
SVN-UPDATE-OPTIONS =
|
2008-02-28 13:06:50 +00:00
|
|
|
AWK = awk
|
2013-01-28 03:19:57 +00:00
|
|
|
|
|
|
|
# Multiline variable defining a recursive function for finding svn repos rooted at
|
|
|
|
# a given path. svnup() requires one argument: the root to search from.
|
|
|
|
define SUB_SVN_DIRS
|
|
|
|
svnup() {
|
2013-07-03 14:48:37 +00:00
|
|
|
dirs=`svn status --no-ignore $$1 | awk '/^(I|\?) / {print $$2}' | LC_ALL=C xargs svn info 2>/dev/null | awk '/^Path:\ / {print $$2}'`;
|
2013-01-28 03:19:57 +00:00
|
|
|
if [ "$$dirs" = "" ]; then
|
|
|
|
return;
|
|
|
|
fi;
|
|
|
|
for f in $$dirs; do
|
|
|
|
echo $$f;
|
|
|
|
svnup $$f;
|
|
|
|
done
|
|
|
|
}
|
|
|
|
endef
|
|
|
|
export SUB_SVN_DIRS
|
2008-02-28 13:06:50 +00:00
|
|
|
|
|
|
|
update:
|
2008-03-21 22:17:07 +00:00
|
|
|
$(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
|
2013-01-28 03:19:57 +00:00
|
|
|
@eval $$SUB_SVN_DIRS; $(SVN) status --no-ignore $(LLVM_SRC_ROOT) | svnup $(LLVM_SRC_ROOT) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
|
2008-02-28 13:06:50 +00:00
|
|
|
|
2010-03-21 22:23:02 +00:00
|
|
|
happiness: update all check-all
|
2008-02-28 13:06:50 +00:00
|
|
|
|
|
|
|
.PHONY: srpm rpm update happiness
|
2007-07-08 03:50:22 +00:00
|
|
|
|
2008-02-28 11:48:14 +00:00
|
|
|
# declare all targets at this level to be serial:
|
|
|
|
|
|
|
|
.NOTPARALLEL:
|
|
|
|
|
2009-10-22 17:22:37 +00:00
|
|
|
else # Building "Apple-style."
|
|
|
|
# In an Apple-style build, once configuration is done, lines marked
|
|
|
|
# "Apple-style" are removed with sed! Please don't remove these!
|
|
|
|
# Look for the string "Apple-style" in utils/buildit/build_llvm.
|
|
|
|
include $(shell find . -name GNUmakefile) # Building "Apple-style."
|
|
|
|
endif # Building "Apple-style."
|