2004-04-24 02:10:56 +02:00
|
|
|
#===- ./Makefile -------------------------------------------*- Makefile -*--===#
|
2009-01-08 03:11:55 +01:00
|
|
|
#
|
2003-10-21 00:26:57 +02:00
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
2007-12-29 21:11:13 +01:00
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
2009-01-08 03:11:55 +01:00
|
|
|
#
|
2004-04-24 02:10:56 +02:00
|
|
|
#===------------------------------------------------------------------------===#
|
2006-06-03 00:41:18 +02:00
|
|
|
|
2006-07-26 21:10:34 +02:00
|
|
|
LEVEL := .
|
2006-09-04 06:27:07 +02:00
|
|
|
|
|
|
|
# Top-Level LLVM Build Stages:
|
|
|
|
# 1. Build lib/System and lib/Support, which are used by utils (tblgen).
|
|
|
|
# 2. Build utils, which is used by VMCore.
|
|
|
|
# 3. Build VMCore, which builds the Intrinsics.inc file used by libs.
|
|
|
|
# 4. Build libs, which are needed by llvm-config.
|
|
|
|
# 5. Build llvm-config, which determines inter-lib dependencies for tools.
|
2006-11-17 04:32:33 +01:00
|
|
|
# 6. Build tools, runtime, docs.
|
2006-09-04 06:27:07 +02:00
|
|
|
#
|
2008-11-10 08:33:13 +01:00
|
|
|
# When cross-compiling, there are some things (tablegen) that need to
|
|
|
|
# be build for the build system first.
|
2009-10-22 19:22:37 +02: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 20:51:32 +01:00
|
|
|
ifneq ($(findstring llvmCore, $(RC_ProjectName)),llvmCore) # Normal build (not "Apple-style").
|
|
|
|
|
2008-11-10 08:33:13 +01:00
|
|
|
ifeq ($(BUILD_DIRS_ONLY),1)
|
|
|
|
DIRS := lib/System lib/Support utils
|
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
else
|
|
|
|
DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
|
2009-09-14 00:39:27 +02:00
|
|
|
tools runtime docs unittests
|
2009-11-16 23:38:00 +01:00
|
|
|
OPTIONAL_DIRS := projects bindings
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BUILD_EXAMPLES),1)
|
|
|
|
OPTIONAL_DIRS += examples
|
2008-11-10 08:33:13 +01:00
|
|
|
endif
|
2007-07-12 01:44:08 +02:00
|
|
|
|
2009-01-01 03:24:48 +01:00
|
|
|
EXTRA_DIST := test unittests llvm.spec include win32 Xcode
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
include $(LEVEL)/Makefile.config
|
2006-04-07 00:15:51 +02:00
|
|
|
|
2007-03-29 20:14:00 +02:00
|
|
|
# llvm-gcc4 doesn't need runtime libs. llvm-gcc4 is the only supported one.
|
|
|
|
# FIXME: Remove runtime entirely once we have an understanding of where
|
|
|
|
# libprofile etc should go.
|
|
|
|
#ifeq ($(LLVMGCC_MAJVERS),4)
|
2009-08-19 23:09:45 +02:00
|
|
|
# DIRS := $(filter-out runtime, $(DIRS))
|
2007-03-29 20:14:00 +02:00
|
|
|
#endif
|
2006-11-17 04:32:33 +01:00
|
|
|
|
2006-07-26 21:10:34 +02:00
|
|
|
ifeq ($(MAKECMDGOALS),libs-only)
|
2006-11-17 04:32:33 +01:00
|
|
|
DIRS := $(filter-out tools runtime docs, $(DIRS))
|
2006-07-26 21:10:34 +02:00
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
endif
|
2006-06-03 00:41:18 +02:00
|
|
|
|
2007-12-13 03:17:17 +01:00
|
|
|
ifeq ($(MAKECMDGOALS),install-libs)
|
|
|
|
DIRS := $(filter-out tools runtime docs, $(DIRS))
|
|
|
|
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
|
|
|
endif
|
|
|
|
|
2005-05-25 23:03:17 +02:00
|
|
|
ifeq ($(MAKECMDGOALS),tools-only)
|
2006-11-17 04:32:33 +01:00
|
|
|
DIRS := $(filter-out runtime docs, $(DIRS))
|
2006-07-26 21:10:34 +02:00
|
|
|
OPTIONAL_DIRS :=
|
2004-02-04 00:05:24 +01:00
|
|
|
endif
|
2006-06-03 00:41:18 +02:00
|
|
|
|
2009-01-19 20:48:23 +01:00
|
|
|
ifeq ($(MAKECMDGOALS),install-clang)
|
2009-03-27 00:43:14 +01:00
|
|
|
DIRS := tools/clang/tools/driver tools/clang/tools/clang-cc \
|
2009-05-01 03:47:55 +02:00
|
|
|
tools/clang/lib/Headers tools/clang/docs
|
2009-01-19 20:48:23 +01:00
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
NO_INSTALL = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(MAKECMDGOALS),clang-only)
|
2009-09-26 22:18:58 +02:00
|
|
|
DIRS := $(filter-out tools runtime docs unittests, $(DIRS)) tools/clang
|
2009-01-19 20:48:23 +01:00
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
endif
|
|
|
|
|
2009-01-01 03:24:48 +01:00
|
|
|
ifeq ($(MAKECMDGOALS),unittests)
|
|
|
|
DIRS := $(filter-out tools runtime docs, $(DIRS)) utils unittests
|
|
|
|
OPTIONAL_DIRS :=
|
|
|
|
endif
|
|
|
|
|
2009-05-08 19:32:47 +02:00
|
|
|
# Use NO_INSTALL define of the Makefile of each directory for deciding
|
|
|
|
# if the directory is installed or not
|
2007-02-21 07:23:20 +01:00
|
|
|
ifeq ($(MAKECMDGOALS),install)
|
2007-09-18 14:49:39 +02:00
|
|
|
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
|
2007-02-21 07:23:20 +01:00
|
|
|
endif
|
|
|
|
|
2008-11-10 08:33:13 +01: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 20:53:38 +01:00
|
|
|
unset CFLAGS ; \
|
|
|
|
unset CXXFLAGS ; \
|
2009-09-03 01:52:23 +02:00
|
|
|
$(PROJ_SRC_DIR)/configure --build=$(BUILD_TRIPLE) \
|
|
|
|
--host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE); \
|
2008-11-10 08:33:13 +01:00
|
|
|
cd .. ; \
|
|
|
|
fi; \
|
2009-09-03 01:52:23 +02:00
|
|
|
($(MAKE) -C BuildTools \
|
|
|
|
BUILD_DIRS_ONLY=1 \
|
|
|
|
UNIVERSAL= \
|
|
|
|
ENABLE_OPTIMIZED=$(ENABLE_OPTIMIZED) \
|
|
|
|
ENABLE_PROFILING=$(ENABLE_PROFILING) \
|
|
|
|
ENABLE_COVERAGE=$(ENABLE_COVERAGE) \
|
|
|
|
DISABLE_ASSERTIONS=$(DISABLE_ASSERTIONS) \
|
|
|
|
ENABLE_EXPENSIVE_CHECKS=$(ENABLE_EXPENSIVE_CHECKS) \
|
|
|
|
) || exit 1;
|
2008-11-10 08:33:13 +01:00
|
|
|
endif
|
|
|
|
|
2006-06-03 00:41:18 +02:00
|
|
|
# Include the main makefile machinery.
|
2006-04-08 04:14:37 +02:00
|
|
|
include $(LLVM_SRC_ROOT)/Makefile.rules
|
|
|
|
|
2005-05-24 04:33:20 +02: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 10:08:54 +01: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 10:27:37 +02:00
|
|
|
dist-hook::
|
2004-10-30 11:19:36 +02:00
|
|
|
$(Echo) Eliminating files constructed by configure
|
|
|
|
$(Verb) $(RM) -f \
|
2004-10-26 09:05:09 +02:00
|
|
|
$(TopDistDir)/include/llvm/Config/config.h \
|
2009-10-26 02:35:46 +01:00
|
|
|
$(TopDistDir)/include/llvm/System/DataTypes.h
|
2004-10-25 10:27:37 +02:00
|
|
|
|
2009-01-19 20:48:23 +01:00
|
|
|
clang-only: all
|
2004-02-03 23:56:40 +01:00
|
|
|
tools-only: all
|
2005-05-25 23:03:17 +02:00
|
|
|
libs-only: all
|
2009-01-19 20:48:23 +01:00
|
|
|
install-clang: install
|
2007-12-13 03:17:17 +01:00
|
|
|
install-libs: install
|
2005-08-25 06:59:49 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# Make sure the generated headers are up-to-date. This must be kept in
|
|
|
|
# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
FilesToConfig := \
|
|
|
|
include/llvm/Config/config.h \
|
2009-06-16 22:12:29 +02:00
|
|
|
include/llvm/Config/Targets.def \
|
2009-11-25 05:46:58 +01:00
|
|
|
include/llvm/Config/AsmPrinters.def \
|
|
|
|
include/llvm/Config/AsmParsers.def \
|
|
|
|
include/llvm/Config/Disassemblers.def \
|
2009-10-26 02:35:46 +01:00
|
|
|
include/llvm/System/DataTypes.h \
|
2009-11-25 05:46:58 +01:00
|
|
|
tools/llvmc/plugins/Base/Base.td
|
2005-08-25 06:59:49 +02:00
|
|
|
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
|
|
|
|
|
|
|
|
all-local:: $(FilesToConfigPATH)
|
2009-01-08 03:11:55 +01:00
|
|
|
$(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
|
2005-08-25 06:59:49 +02:00
|
|
|
$(Echo) Regenerating $*
|
|
|
|
$(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
|
|
|
|
.PRECIOUS: $(FilesToConfigPATH)
|
2006-04-07 17:58:18 +02:00
|
|
|
|
2006-04-07 18:21:59 +02:00
|
|
|
# NOTE: This needs to remain as the last target definition in this file so
|
|
|
|
# that it gets executed last.
|
2008-11-10 08:33:13 +01:00
|
|
|
ifneq ($(BUILD_DIRS_ONLY),1)
|
2009-01-08 03:11:55 +01:00
|
|
|
all::
|
2006-04-07 17:58:18 +02:00
|
|
|
$(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
|
|
|
|
ifeq ($(BuildMode),Debug)
|
|
|
|
$(Echo) '*****' Note: Debug build can be 10 times slower than an
|
|
|
|
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
|
2008-02-28 12:48:14 +01:00
|
|
|
$(Echo) '*****' make an optimized build. Alternatively you can
|
|
|
|
$(Echo) '*****' configure with --enable-optimized.
|
2006-04-07 17:58:18 +02:00
|
|
|
endif
|
2008-11-10 08:33:13 +01:00
|
|
|
endif
|
2006-04-07 18:21:59 +02:00
|
|
|
|
2006-06-01 09:27:53 +02:00
|
|
|
check-llvm2cpp:
|
2007-04-15 08:22:48 +02:00
|
|
|
$(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
|
2006-07-26 21:10:34 +02:00
|
|
|
|
2007-04-15 08:18:50 +02:00
|
|
|
check-one:
|
2007-04-15 08:22:48 +02:00
|
|
|
$(Verb)$(MAKE) -C test check-one TESTONE=$(TESTONE)
|
2007-04-15 08:18:50 +02:00
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
srpm: $(LLVM_OBJ_ROOT)/llvm.spec
|
2006-08-16 02:43:50 +02:00
|
|
|
rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
|
|
|
|
|
2009-01-08 03:11:55 +01:00
|
|
|
rpm: $(LLVM_OBJ_ROOT)/llvm.spec
|
2006-08-16 02:43:50 +02:00
|
|
|
rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
|
|
|
|
|
2007-02-06 00:18:58 +01:00
|
|
|
show-footprint:
|
|
|
|
$(Verb) du -sk $(LibDir)
|
|
|
|
$(Verb) du -sk $(ToolDir)
|
|
|
|
$(Verb) du -sk $(ExmplDir)
|
|
|
|
$(Verb) du -sk $(ObjDir)
|
|
|
|
|
2007-07-08 05:50:22 +02: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 14:06:50 +01:00
|
|
|
SVN = svn
|
2008-02-28 15:58:14 +01:00
|
|
|
SVN-UPDATE-OPTIONS =
|
2008-02-28 14:06:50 +01:00
|
|
|
AWK = awk
|
2008-02-28 19:46:56 +01:00
|
|
|
SUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}' \
|
2009-04-24 19:00:03 +02:00
|
|
|
| LC_ALL=C xargs $(SVN) info 2>/dev/null \
|
2008-02-28 19:46:56 +01:00
|
|
|
| $(AWK) '/Path:\ / {print $$2}'
|
2008-02-28 14:06:50 +01:00
|
|
|
|
|
|
|
update:
|
2008-03-21 23:17:07 +01:00
|
|
|
$(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
|
|
|
|
@ $(SVN) status $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
|
2008-02-28 14:06:50 +01:00
|
|
|
|
2009-01-05 00:12:21 +01:00
|
|
|
happiness: update all check unittests
|
2008-02-28 14:06:50 +01:00
|
|
|
|
|
|
|
.PHONY: srpm rpm update happiness
|
2007-07-08 05:50:22 +02:00
|
|
|
|
2008-02-28 12:48:14 +01:00
|
|
|
# declare all targets at this level to be serial:
|
|
|
|
|
|
|
|
.NOTPARALLEL:
|
|
|
|
|
2009-10-22 19:22:37 +02: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."
|