Newer
Older
#===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
# This file is included by all of the LLVM makefiles. For details on how to use
# it properly, please see the document MakefileGuide.html in the docs directory.
#===-----------------------------------------------------------------------====
John Criswell
committed
#
# Set the VPATH so that we can find source files.
John Criswell
committed
#
VPATH=$(BUILD_SRC_DIR)
###############################################################################
# TARGETS: Define standard targets that can be invoked
###############################################################################
John Criswell
committed
#--------------------------------------------------------------------
# Define the various target sets
#--------------------------------------------------------------------
RECURSIVE_TARGETS := all clean check install uninstall
LOCAL_TARGETS := all-local clean-local check-local install-local printvars\
TOPLEV_TARGETS := dist dist-check dist-clean tags
USER_TARGETS := $(RECURSIVE_TARGETS) $(LOCAL_TARGETS) $(TOPLEV_TARGETS)
INTERNAL_TARGETS := preconditions \
install-config-dir install-shared-library install-bytecode-library \
install-archive-library install-relinked-library install-tool \
uninstall-config-dir uninstall-shared-library uninstall-bytecode-library \
uninstall-archive-library uninstall-relinked-library uninstall-tool
#--------------------------------------------------------------------
# Mark all of these targets as phony to avoid implicit rule search
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# Make sure all the user-target rules are double colon rules and that
# the preconditions are run first.
#--------------------------------------------------------------------
all :: all-local
check:: check-local
clean:: clean-local
install :: install-local
uninstall :: uninstall-local
check-local :: all-local
install-local :: all-local
###############################################################################
# SUFFIXES: Reset the list of suffixes we know how to build
###############################################################################
.SUFFIXES:
.SUFFIXES: .c .cpp .h .hpp .y .l .lo .o .a $(SHLIBEXT) .bc .td .ps .dot $(SUFFIXES)
###############################################################################
# VARIABLES: Set up various variables based on configuration data
###############################################################################
#--------------------------------------------------------------------
#--------------------------------------------------------------------
Chris Lattner
committed
ifdef ENABLE_PROFILING
CONFIGURATION := Profile
CXXFLAGS += -O3 -DNDEBUG -felide-constructors -finline-functions -pg
CFLAGS += -O3 -DNDEBUG -pg
LDFLAGS += -O3 -DNDEBUG -pg
Chris Lattner
committed
else
ifdef ENABLE_OPTIMIZED
CONFIGURATION := Release
CXXFLAGS += -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
CFLAGS += -O3 -DNDEBUG -fomit-frame-pointer
LDFLAGS += -O3 -DNDEBUG
Chris Lattner
committed
else
CONFIGURATION := Debug
CXXFLAGS += -g -D_DEBUG
CFLAGS += -g -D_DEBUG
LDFLAGS += -g -D_DEBUG
KEEP_SYMBOLS := 1
Chris Lattner
committed
endif
endif
ARFLAGS := cru
#--------------------------------------------------------------------
# Directory locations
#--------------------------------------------------------------------
OBJDIR := $(BUILD_OBJ_DIR)/$(CONFIGURATION)
LIBDIR := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION)
TOOLDIR := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)
LLVMLIBDIR := $(LLVM_OBJ_ROOT)/lib/$(CONFIGURATION)
LLVMTOOLDIR := $(LLVM_OBJ_ROOT)/tools/$(CONFIGURATION)
#--------------------------------------------------------------------
# Full Paths To Compiled Tools and Utilities
#--------------------------------------------------------------------
LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
LLVMAS := $(LLVMTOOLDIR)/llvm-as$(EXEEXT)
BURG := $(LLVMTOOLDIR)/burg$(EXEEXT)
TBLGEN := $(LLVMTOOLDIR)/tblgen$(EXEEXT)
GCCLD := $(LLVMTOOLDIR)/gccld$(EXEEXT)
LLVMGCC := PATH=$(LLVMTOOLDIR):$(PATH) $(LLVMGCCDIR)/bin/gcc
LLVMGXX := PATH=$(LLVMTOOLDIR):$(PATH) $(LLVMGCCDIR)/bin/g++
# Need a better way to compute this.
LLVMGCCLIBDIR := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
#--------------------------------------------------------------------
# Adjust to user's request
#--------------------------------------------------------------------
John Criswell
committed
ifndef SHARED_LIBRARY
LIBTOOL += --tag=disable-shared
else
LDFLAGS += -rpath $(LIBDIR)
endif
Chris Lattner
committed
ifndef VERBOSE
VERB := @
LIBTOOL += --silent
AR += >/dev/null 2>/dev/null
CONFIGUREFLAGS += >$(BUILD_OBJ_DIR)/configure.out 2>&1
else
CONFIGUREFLAGS :=
endif
# By default, strip symbol information from executable
Chris Lattner
committed
ifndef KEEP_SYMBOLS
STRIP = $(PLATFORMSTRIPOPTS)
STRIP_WARN_MSG = "(without symbols)"
endif
ifdef TOOLNAME
LDFLAGS += -rpath $(TOOLDIR) -export-dynamic $(TOOLLINKOPTS)
endif
# Use TOOLLINKOPTSB to pass options to the linker like library search
# path etc.
# Note that this is different from TOOLLINKOPTS, these options
# are passed to the linker *before* the USEDLIBS options are passed.
# e.g. usage TOOLLINKOPTSB = -L/home/xxx/lib
ifdef TOOLLINKOPTSB
LDFLAGS += $(TOOLLINKOPTSB)
endif
#----------------------------------------------------------
# Options To Invoke Tools
#----------------------------------------------------------
CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
CPPFLAGS += -I$(BUILD_OBJ_DIR) \
-I$(BUILD_SRC_DIR) \
-I$(BUILD_SRC_ROOT)/include \
-I$(BUILD_OBJ_ROOT)/include \
-I$(LLVM_OBJ_ROOT)/include \
-I$(LLVM_SRC_ROOT)/include \
-D_GNU_SOURCE -D__STDC_LIMIT_MACROS
Compile.C = $(CC) $(CPPFLAGS) $(CompileCommonOpts) -c $(CFLAGS)
Compile.CXX = $(CXX) $(CPPFLAGS) $(CompileCommonOpts) $(CXXFLAGS) -c
LTCompile.C = $(LIBTOOL) --mode=compile $(Compile.C)
LTCompile.CXX = $(LIBTOOL) --tag=CXX --mode=compile $(Compile.CXX)
BCCompile.CXX = $(LLVMGXX) $(CPPFLAGS) $(CompileCommonOpts) $(CXXFLAGS) -c
BCCompile.C = $(LLVMGCC) $(CPPFLAGS) $(CompileCommonOpts) $(CFLAGS) -c
Link = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(CPPFLAGS) \
Relink = $(LIBTOOL) --tag=CXX --mode=link $(CXX)
BCLinkLib = $(LLVMGCC) -shared -nostdlib
Burg = $(BURG) -I $(BUILD_SRC_DIR)
TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
Archive = $(AR) $(ARFLAGS)
ifdef RANLIB
else
endif
#----------------------------------------------------------
# Get the list of source files
#----------------------------------------------------------
ifndef SOURCES
SOURCES := $(notdir $(wildcard $(BUILD_SRC_DIR)/*.cpp \
$(BUILD_SRC_DIR)/*.cc $(BUILD_SRC_DIR)/*.c $(BUILD_SRC_DIR)/*.y \
$(BUILD_SRC_DIR)/*.l))
Loading
Loading full blame...