diff options
125 files changed, 27225 insertions, 481 deletions
diff --git a/Makefile.common b/Makefile.common index 88cdd97c00..e8a0697e60 100644 --- a/Makefile.common +++ b/Makefile.common @@ -30,14 +30,24 @@ # are in, if they are not in the current directory. This should include a # trailing / character. # -# 6. PROJ_COMPILE - If set to 1, then this makefile can also be used to -# compile other projects using llvm. Note if this option is set then the -# following *must* hold -# PROJLEVEL should be set to the top of the source directory for the -# project files -# LEVEL should be set to the top of LLVM source tree -# LLVM_LIB_DIR should be set to the top of the LLVM build tree +# 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree. # +# 7. LLVM_OBJ_ROOT - If specified, points to the top directory where LLVM +# object files are placed. +# +# 8. BUILD_SRC_DIR - The directory which contains the current set of Makefiles +# and usually the source code too (unless SourceDir is set). +# +# 9. BUILD_SRC_ROOT - The root directory of the source code being compiled. +# +# 10. BUILD_OBJ_DIR - The directory where object code should be placed. +# +# 11. BUILD_OBJ_ROOT - The root directory for where object code should be +# placed. +# +# For building, +# LLVM, LLVM_SRC_ROOT = BUILD_SRC_ROOT, and +# LLVM_OBJ_ROOT = BUILD_OBJ_ROOT. #===-----------------------------------------------------------------------==== # @@ -76,14 +86,20 @@ BUILD_SRC_ROOT = $(shell cd $(BUILD_SRC_DIR)/$(LEVEL); pwd) endif # +# Determine the path of the source tree relative from $HOME (the mythical +# home directory). +# +HOME_OBJ_ROOT := $(OBJ_ROOT)/$(patsubst $(HOME)%,%,$(BUILD_SRC_ROOT)) + +# # Set the object build directory. Its location depends upon the source path # and where object files should go. # ifndef BUILD_OBJ_DIR ifeq ($(OBJ_ROOT),.) -BUILD_OBJ_DIR = $(shell pwd) +BUILD_OBJ_DIR = $(BUILD_SRC_DIR) else -BUILD_OBJ_DIR := $(OBJ_ROOT)$(patsubst $(shell dirname $(BUILD_SRC_ROOT))%,%,$(shell cd $(BUILD_SRC_DIR); pwd)) +BUILD_OBJ_DIR := $(HOME_OBJ_ROOT)$(patsubst $(BUILD_SRC_ROOT)%,%,$(BUILD_SRC_DIR)) endif endif @@ -92,9 +108,9 @@ endif # ifndef BUILD_OBJ_ROOT ifeq ($(OBJ_ROOT),.) -BUILD_OBJ_ROOT = $(shell cd $(LEVEL); pwd) +BUILD_OBJ_ROOT = $(BUILD_SRC_ROOT) else -BUILD_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(shell dirname $(BUILD_SRC_ROOT))%,%,$(shell cd $(BUILD_SRC_ROOT); pwd)) +BUILD_OBJ_ROOT := $(HOME_OBJ_ROOT) endif endif @@ -113,16 +129,15 @@ ifndef LLVM_OBJ_ROOT LLVM_OBJ_ROOT = $(BUILD_OBJ_ROOT) endif -# Figure out how to do platform specific stuff on this platform. This is really -# gross and should be autoconfiscated (automake actually), but should hopefully -# work on Linux and solaris (SunOS). -# -UNAME := $(shell uname) -include $(LLVM_SRC_ROOT)/Makefile.$(UNAME) +########################################################################### +# Default Targets: +# The following targets are the standard top level targets for +# building. +########################################################################### ifdef SHARED_LIBRARY # if SHARED_LIBRARY is specified, the default is to build the dynamic lib -dynamic :: +all:: dynamic endif # Default Rule: Make sure it's also a :: rule @@ -134,6 +149,22 @@ install :: # Default rule for test. It ensures everything has a test rule test:: +# Print out the directories used for building +prdirs:: + echo "Home Offset : " $(HOME_OBJ_ROOT); + echo "Build Source Root: " $(BUILD_SRC_ROOT); + echo "Build Source Dir : " $(BUILD_SRC_DIR); + echo "Build Object Root: " $(BUILD_OBJ_ROOT); + echo "Build Object Dir : " $(BUILD_OBJ_DIR); + echo "LLVM Source Root: " $(LLVM_SRC_ROOT); + echo "LLVM Object Root: " $(LLVM_OBJ_ROOT); + +########################################################################### +# Miscellaneous paths and commands: +# This section defines various configuration macros, such as where +# to find burg, tblgen, and libtool. +########################################################################### + #-------------------------------------------------------------------- # Variables derived from configuration options... #-------------------------------------------------------------------- @@ -157,8 +188,21 @@ else endif endif +# +# Enable this for profiling support with 'gprof' +# This automatically enables optimized builds. +# +ifdef ENABLE_PROFILING + PROFILE = -pg +endif + +# +# Suffixes for library compilation rules +# +.SUFFIXES: .so + ########################################################################### -# Library Locations +# Library Locations: # These variables describe various library locations: # # DEST* = Location of where libraries that are built will be placed. @@ -208,36 +252,45 @@ PROJTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION) +# +# Libtool is found in the current directory. +# +ifdef VERBOSE +LIBTOOL=$(LLVM_SRC_ROOT)/libtool < |