# 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
+#
+#
#===-----------------------------------------------------------------------====
# Configuration file to set paths specific to local installation of LLVM
#
include $(LEVEL)/Makefile.config
-# 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_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_PURIFY is enabled, the LLVM tools are linked with purify (which
-# must be locally installed) to allow for some automated memory error debugging.
-#
-#ENABLE_PURIFY = 1
-
-# When ENABLE_OPTIMIZED is enabled, Release builds of all of the LLVM code are
-# turned on, and Debug builds are turned off.
-#
-#ENABLE_OPTIMIZED = 1
-
-
# 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).
# /shared directory by default because it is guaranteed to be local to the
# current machine.
#
+
ifeq ($(LLVM_OBJ_DIR),.)
BUILD_ROOT = $(LLVM_OBJ_DIR)
+
+ifdef PROJ_COMPILE
+BUILD_ROOT_TOP = $(PROJLEVEL)
+else
BUILD_ROOT_TOP = $(LEVEL)
+endif
+
else
BUILD_ROOT := $(LLVM_OBJ_DIR)$(patsubst $(HOME)%,%,$(shell pwd))
# the directory to eliminate the ../'s
#
ifdef PROJ_COMPILE
-TOP_DIRECTORY := $(shell cd $(TOPLEVEL); pwd)
+TOP_DIRECTORY := $(shell cd $(PROJLEVEL); pwd)
else
TOP_DIRECTORY := $(shell cd $(LEVEL); pwd)
endif
#--------------------------------------------------------------------
#BinInstDir=/usr/local/bin
-#LibInstDir=/usrl/local/lib/xxx
+#LibInstDir=/usr/local/lib/xxx
#DocInstDir=/usr/doc/xxx
BURG_OPTS = -I
endif
# Shorthand for commonly accessed directories
+# DESTLIBXYZ indicates destination for the libraries built
DESTLIBDEBUG := $(BUILD_ROOT_TOP)/lib/Debug
DESTLIBRELEASE := $(BUILD_ROOT_TOP)/lib/Release
DESTLIBPROFILE := $(BUILD_ROOT_TOP)/lib/Profile
DESTLIBCURRENT := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION)
ifdef PROJ_COMPILE
+#get the llvm libraries from LLVM_LIB_DIR
LLVMLIBDEBUGSOURCE := $(LLVM_LIB_DIR)/lib/Debug
LLVMLIBRELEASESOURCE := $(LLVM_LIB_DIR)/lib/Release
LLVMLIBPROFILESOURCE := $(LLVM_LIB_DIR)/lib/Profile
PROJLIBCURRENTSOURCE := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION)
else
-
+#when we are building llvm, destination is same as source
LLVMLIBDEBUGSOURCE := $(BUILD_ROOT_TOP)/lib/Debug
LLVMLIBRELEASESOURCE := $(BUILD_ROOT_TOP)/lib/Release
LLVMLIBPROFILESOURCE := $(BUILD_ROOT_TOP)/lib/Profile
BURG := $(TOOLCURRENT)/burg
RunBurg := $(BURG) $(BURG_OPTS)
+TBLGEN := $(TOOLCURRENT)/tblgen
# Enable this for profiling support with 'gprof'
# This automatically enables optimized builds.
PROFILE = -pg
endif
-#if PROJDIR is defined then we include PROJ DIR includes and libraries
+#if PROJDIR is defined then we include project include directory
ifndef PROJ_COMPILE
-PROJ_INCLUDE = "."
+PROJ_INCLUDE = .
else
-PROJ_INCLUDE = $(PROJ_DIR)/include
+PROJ_INCLUDE = $(TOP_DIRECTORY)/include
endif
# By default, strip symbol information from executable
endif
ifdef PROJ_COMPILE
+# include both projlib source and llvmlib source
LinkG := $(Link) -g -L$(PROJLIBDEBUGSOURCE) -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
LinkO := $(Link) -O3 -L$(PROJLIBRELEASESOURCE) -L$(LLVMLIBRELEASESOURCE)
LinkP := $(Link) -O3 -L$(PROJLIBPROFILESOURCE) -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
# Create one .o file from a bunch of .o files...
-Relink = ld -r
+Relink = ${LD} -r
# MakeSO - Create a .so file from a .o files...
MakeSO := $(CXX) $(MakeSharedObjectOption)
DependC := $(CC) -MM -I$(LEVEL)/include -I$(PROJ_INCLUDE) $(CPPFLAGS)
# Archive a bunch of .o files into a .a file...
-AR = ar cq
-BISON = bison
+AR = ${AR_PATH} cq
#----------------------------------------------------------
# FIXME. (f.e. char Buffer[10000]; )
#
%.cpp: %.l
- flex -t $< | sed '/^find_rule/d' | \
+ $(FLEX) -t $< | sed '/^find_rule/d' | \
sed 's/void yyunput/inline void yyunput/' | \
sed 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
sed 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@