#===-- Makefile.config - Local configuration for LLVM ------*- Makefile -*--===#
#
#                     The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
#
# This file is included by Makefile.common.  It defines paths and other
# values specific to a particular installation of LLVM.
#
#===------------------------------------------------------------------------===#

# Define LLVM specific info and directories based on the autoconf variables
LLVMPackageName   := @PACKAGE_TARNAME@
LLVMVersion       := @PACKAGE_VERSION@
LLVM_VERSION_MAJOR := @LLVM_VERSION_MAJOR@
LLVM_VERSION_MINOR := @LLVM_VERSION_MINOR@
LLVM_VERSION_PATCH := @LLVM_VERSION_PATCH@
LLVM_VERSION_SUFFIX := @LLVM_VERSION_SUFFIX@
LLVM_CONFIGTIME   := @LLVM_CONFIGTIME@

###########################################################################
# Directory Configuration
#	This section of the Makefile determines what is where.  To be
#	specific, there are several locations that need to be defined:
#
#	o LLVM_SRC_ROOT  : The root directory of the LLVM source code.
#	o LLVM_OBJ_ROOT  : The root directory containing the built LLVM code.
#
#	o PROJ_SRC_DIR  : The directory containing the code to build.
#	o PROJ_SRC_ROOT : The root directory of the code to build.
#
#	o PROJ_OBJ_DIR  : The directory in which compiled code will be placed.
#	o PROJ_OBJ_ROOT : The root directory in which compiled code is placed.
#
###########################################################################

PWD := @BINPWD@
# Set the project name to LLVM if its not defined
ifndef PROJECT_NAME
PROJECT_NAME := $(LLVMPackageName)
endif

# The macro below is expanded when 'realpath' is not built-in.
# Built-in 'realpath' is available on GNU Make 3.81.
realpath = $(shell cd $(1); $(PWD))

PROJ_OBJ_DIR  := $(call realpath, .)
PROJ_OBJ_ROOT := $(call realpath, $(PROJ_OBJ_DIR)/$(LEVEL))

CLANG_SRC_ROOT  := @CLANG_SRC_ROOT@

ifeq ($(PROJECT_NAME),$(LLVMPackageName))
LLVM_SRC_ROOT   := $(call realpath, @abs_top_srcdir@)
LLVM_OBJ_ROOT   := $(call realpath, @abs_top_builddir@)
PROJ_SRC_ROOT   := $(LLVM_SRC_ROOT)
PROJ_SRC_DIR    := $(LLVM_SRC_ROOT)$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))

ifneq ($(CLANG_SRC_ROOT),)
  CLANG_SRC_ROOT:= $(call realpath, $(CLANG_SRC_ROOT))
  PROJ_SRC_DIR  := $(patsubst $(LLVM_SRC_ROOT)/tools/clang%,$(CLANG_SRC_ROOT)%,$(PROJ_SRC_DIR))
endif

prefix          := @prefix@
PROJ_prefix     := $(prefix)
program_prefix  := @program_prefix@
PROJ_VERSION    := $(LLVMVersion)
else
ifndef PROJ_SRC_ROOT
$(error Projects must define PROJ_SRC_ROOT)
endif
ifndef PROJ_OBJ_ROOT
$(error Projects must define PROJ_OBJ_ROOT)
endif
ifndef PROJ_INSTALL_ROOT
$(error Projects must define PROJ_INSTALL_ROOT)
endif
ifndef LLVM_SRC_ROOT
$(error Projects must define LLVM_SRC_ROOT)
endif
ifndef LLVM_OBJ_ROOT
$(error Projects must define LLVM_OBJ_ROOT)
endif
PROJ_SRC_DIR := $(call realpath, $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)))
prefix          := $(PROJ_INSTALL_ROOT)
PROJ_prefix     := $(prefix)
ifndef PROJ_VERSION
PROJ_VERSION := 1.0
endif
endif

INTERNAL_PREFIX := @INTERNAL_PREFIX@
ifneq ($(INTERNAL_PREFIX),)
PROJ_internal_prefix := $(INTERNAL_PREFIX)
else
PROJ_internal_prefix := $(prefix)
endif

PROJ_bindir     := $(PROJ_prefix)/bin
PROJ_libdir     := $(PROJ_prefix)/lib
PROJ_datadir    := $(PROJ_prefix)/share
PROJ_docsdir    := $(PROJ_prefix)/docs/llvm
PROJ_etcdir     := $(PROJ_prefix)/etc/llvm
PROJ_includedir := $(PROJ_prefix)/include
PROJ_infodir    := $(PROJ_prefix)/info
PROJ_mandir     := $(PROJ_prefix)/share/man

# Determine if we're on a unix type operating system
LLVM_ON_UNIX:=@LLVM_ON_UNIX@
LLVM_ON_WIN32:=@LLVM_ON_WIN32@

# Host operating system for which LLVM will be run.
OS=@OS@
HOST_OS=@HOST_OS@
# Target operating system for which LLVM will compile for.
TARGET_OS=@TARGET_OS@

# Host hardware architecture
HOST_ARCH=@HOST_ARCH@
# Target hardware architecture
ARCH=@ARCH@
TARGET_NATIVE_ARCH := $(ARCH)
LLVM_NATIVE_ARCH := @LLVM_NATIVE_ARCH@

# Indicates, whether we're cross-compiling LLVM or not
LLVM_CROSS_COMPILING=@LLVM_CROSS_COMPILING@

# Executable file extension for build platform (mainly for
# tablegen call if we're cross-compiling).
BUILD_EXEEXT=@BUILD_EXEEXT@

# Compilers for the build platflorm (mainly for tablegen
# call if we're cross-compiling).
BUILD_CC=@BUILD_CC@
BUILD_CXX=@BUILD_CXX@

# Triple for configuring build tools when cross-compiling
BUILD_TRIPLE=@build@

# Target triple (cpu-vendor-os) which LLVM is compiled for
HOST_TRIPLE=@host@

# Target triple (cpu-vendor-os) for which we should generate code
TARGET_TRIPLE=@target@

# Extra options to compile LLVM with
EXTRA_OPTIONS=@EXTRA_OPTIONS@

# Extra options to link LLVM with
EXTRA_LD_OPTIONS=@EXTRA_LD_OPTIONS@

# Endian-ness of the target
ENDIAN=@ENDIAN@

# Path to the C++ compiler to use.  This is an optional setting, which defaults
# to whatever your gmake defaults to.
CXX = @CXX@

# Path to the CC binary, which use used by testcases for native builds.
CC := @CC@

# C/C++ preprocessor flags.
CPPFLAGS += @CPPFLAGS@

# C compiler flags.
CFLAGS += @CFLAGS@

# C++ compiler flags.
CXXFLAGS += @CXXFLAGS@

# Linker flags.
LDFLAGS += @LDFLAGS@

# Path to the library archiver program.
AR_PATH = @AR@
AR = @AR@

# Path to the nm program
NM_PATH = @NM@

# The pathnames of the programs we require to build
CMP        := @CMP@
CP         := @CP@
DATE       := @DATE@
FIND       := @FIND@
GREP       := @GREP@
INSTALL    := @INSTALL@
MKDIR      := $(LLVM_SRC_ROOT)/autoconf/mkinstalldirs
MV         := @MV@
RANLIB     := @RANLIB@
RM         := @RM@
SED        := @SED@
TAR        := @TAR@
PYTHON     := @PYTHON@

# Paths to miscellaneous programs we hope are present but might not be
BZIP2      := @BZIP2@
CAT        := @CAT@
DOT        := @DOT@
DOXYGEN    := @DOXYGEN@
GROFF      := @GROFF@
GZIPBIN    := @GZIPBIN@
OCAMLC     := @OCAMLC@
OCAMLOPT   := @OCAMLOPT@
OCAMLDEP   := @OCAMLDEP@
OCAMLDOC   := @OCAMLDOC@
GAS        := @GAS@
POD2HTML   := @POD2HTML@
POD2MAN    := @POD2MAN@
PDFROFF    := @PDFROFF@
ZIP        := @ZIP@

HAVE_LIBZ  := @HAVE_LIBZ@
HAVE_DLOPEN := @HAVE_DLOPEN@
HAVE_PTHREAD := @HAVE_PTHREAD@
HAVE_TERMINFO := @HAVE_TERMINFO@

LIBS       := @LIBS@

# Targets that are possible to build
ALL_TARGETS := @ALL_TARGETS@

# Targets that we should build
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@

# Targets supporting JIT
TARGETS_WITH_JIT := @TARGETS_WITH_JIT@

# Path to directory where object files should be stored during a build.
# Set OBJ_ROOT to "." if you do not want to use a separate place for
# object files.
OBJ_ROOT := .

# What to pass as rpath flag to g++
RPATH := @RPATH@

# What to pass as -rdynamic flag to g++
RDYNAMIC := @RDYNAMIC@

# These are options that can either be enabled here, or can be enabled on the
# make command line (ie, make ENABLE_PROFILING=1):

# When ENABLE_LIBCPP is enabled, LLVM uses libc++ by default to build.
#ENABLE_LIBCPP = 0
ENABLE_LIBCPP = @ENABLE_LIBCPP@

# When ENABLE_CXX1Y is enabled, LLVM uses c++1y mode by default to build.
# Otherwise it uses the baseline c++11.
ENABLE_CXX1Y = @ENABLE_CXX1Y@

# When ENABLE_SPLIT_DWARF is enabled, LLVM uses -gfission to build in debug mode.
ENABLE_SPLIT_DWARF = @ENABLE_SPLIT_DWARF@

# When enabled, clang will have plugin support.
CLANG_PLUGIN_SUPPORT = @CLANG_PLUGIN_SUPPORT@

# When ENABLE_CLANG_ARCMT is enabled, clang will have ARCMigrationTool.
ENABLE_CLANG_ARCMT = @ENABLE_CLANG_ARCMT@

# When ENABLE_CLANG_REWRITER is enabled, clang will have Rewriter.
ENABLE_CLANG_REWRITER = @ENABLE_CLANG_REWRITER@

# When ENABLE_CLANG_STATIC_ANALYZER is enabled, clang will have StaticAnalyzer.
ENABLE_CLANG_STATIC_ANALYZER = @ENABLE_CLANG_STATIC_ANALYZER@

# When ENABLE_WERROR is enabled, we'll pass -Werror on the command line
ENABLE_WERROR = @ENABLE_WERROR@

# When ENABLE_TERMINFO is enabled, we use terminfo.
ENABLE_TERMINFO = @ENABLE_TERMINFO@

# When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output is put
# into the "Release" directories. Otherwise, LLVM code is not optimized and
# output is put in the "Debug" directories.
#ENABLE_OPTIMIZED = 1
@ENABLE_OPTIMIZED@

# When ENABLE_PROFILING is enabled, profile instrumentation is done
# and output is put into the "<Flavor>+Profile" directories, where
# <Flavor> is either Debug or Release depending on how other build
# flags are set. Otherwise, output is put in the <Flavor>
# directories.
#ENABLE_PROFILING = 1
@ENABLE_PROFILING@

# When DISABLE_ASSERTIONS is enabled, builds of all of the LLVM code will
# exclude assertion checks, otherwise they are included.
#DISABLE_ASSERTIONS = 1
@DISABLE_ASSERTIONS@

# When ENABLE_EXPENSIVE_CHECKS is enabled, builds of all of the LLVM
# code will include expensive checks, otherwise they are excluded.
#ENABLE_EXPENSIVE_CHECKS = 0
@ENABLE_EXPENSIVE_CHECKS@

# When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
# symbols.
#DEBUG_RUNTIME = 1
@DEBUG_RUNTIME@

# When DEBUG_SYMBOLS is enabled, the compiler libraries will retain debug
# symbols.
#DEBUG_SYMBOLS = 1
@DEBUG_SYMBOLS@

# When KEEP_SYMBOLS is enabled, installed executables will never have their
# symbols stripped.
#KEEP_SYMBOLS = 1
@KEEP_SYMBOLS@

# The compiler flags to use for optimized builds.
OPTIMIZE_OPTION := @OPTIMIZE_OPTION@

# When ENABLE_PROFILING is enabled, the llvm source base is built with profile
# information to allow gprof to be used to get execution frequencies.
#ENABLE_PROFILING = 1

# When ENABLE_DOCS is disabled, docs/ will not be built.
ENABLE_DOCS = @ENABLE_DOCS@

# When ENABLE_DOXYGEN is enabled, the doxygen documentation will be built
ENABLE_DOXYGEN = @ENABLE_DOXYGEN@

# Do we want to enable threads?
ENABLE_THREADS := @LLVM_ENABLE_THREADS@

# Do we want to enable zlib?
ENABLE_ZLIB := @LLVM_ENABLE_ZLIB@

# Do we want to build with position independent code?
ENABLE_PIC := @ENABLE_PIC@

# Do we want to build a shared library and link the tools with it?
ENABLE_SHARED := @ENABLE_SHARED@

# Do we want to link the stdc++ into a shared library? (Cygming)
ENABLE_EMBED_STDCXX := @ENABLE_EMBED_STDCXX@

# Use -fvisibility-inlines-hidden?
ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@

# Do we want to allow timestamping information into builds?
ENABLE_TIMESTAMPS := @ENABLE_TIMESTAMPS@

# This option tells the Makefiles to produce verbose output.
# It essentially prints the commands that make is executing
#VERBOSE = 1

# Enable JIT for this platform
TARGET_HAS_JIT = @TARGET_HAS_JIT@

# Shared library extension for host platform.
SHLIBEXT = @SHLIBEXT@

# Executable file extension for host platform.
EXEEXT = @EXEEXT@

# Things we just assume are "there"
ECHO := echo

# Get the options for causing archives to link all their content instead of
# just missing symbols, and the inverse of that. This is used for certain LLVM
# tools that permit loadable modules. It ensures that the LLVM symbols will be
# available to those loadable modules.
LINKALL := @LINKALL@
NOLINKALL := @NOLINKALL@

# Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
# on the check.
HUGE_VAL_SANITY = @HUGE_VAL_SANITY@

# Bindings that we should build
BINDINGS_TO_BUILD := @BINDINGS_TO_BUILD@
ALL_BINDINGS      := @ALL_BINDINGS@
OCAML_LIBDIR      := @OCAML_LIBDIR@

# When compiling under Mingw/Cygwin, executables such as tblgen
# expect Windows paths, whereas the build system uses Unix paths.
# The function SYSPATH transforms Unix paths into Windows paths.
ifneq (,$(findstring -mno-cygwin, $(CXX)))
  SYSPATH = $(shell echo $(1) | cygpath -m -f -)
else
  SYSPATH = $(1)
endif

# Location of the plugin header file for gold.
BINUTILS_INCDIR := @BINUTILS_INCDIR@

# Optional flags supported by the compiler
# -Wno-missing-field-initializers
NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@
# -Wno-variadic-macros
NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@
# -Wcovered-switch-default
COVERED_SWITCH_DEFAULT = @COVERED_SWITCH_DEFAULT@
# -Wno-uninitialized
NO_UNINITIALIZED = @NO_UNINITIALIZED@
# -Wno-maybe-uninitialized
NO_MAYBE_UNINITIALIZED = @NO_MAYBE_UNINITIALIZED@

# Was polly found in tools/polly?
LLVM_HAS_POLLY = @LLVM_HAS_POLLY@
# Flags supported by the linker.
# bfd ld / gold --version-script=file
HAVE_LINK_VERSION_SCRIPT = @HAVE_LINK_VERSION_SCRIPT@

# Flags to control using libxml2
LIBXML2_LIBS := @LIBXML2_LIBS@
LIBXML2_INC  := @LIBXML2_INC@

# Flags to control building support for Intel JIT Events API
USE_INTEL_JITEVENTS := @USE_INTEL_JITEVENTS@
INTEL_JITEVENTS_INCDIR := @INTEL_JITEVENTS_INCDIR@
INTEL_JITEVENTS_LIBDIR := @INTEL_JITEVENTS_LIBDIR@

# Flags to control building support for OProfile JIT API
USE_OPROFILE := @USE_OPROFILE@

ifeq ($(USE_INTEL_JITEVENTS), 1)
  OPTIONAL_COMPONENTS += IntelJITEvents
endif
ifeq ($(USE_OPROFILE), 1)
  OPTIONAL_COMPONENTS += OProfileJIT
endif
