-TOP_DIRECTORY := $(shell cd $(LEVEL); pwd)
-BUILD_ROOT_TOP := $(LLVM_OBJ_DIR)$(patsubst $(HOME)%,%,$(TOP_DIRECTORY))
-endif
-
-#--------------------------------------------------------------------
-# Variables derived from configuration options...
-#--------------------------------------------------------------------
-
-#BinInstDir=/usr/local/bin
-#LibInstDir=/usrl/local/lib/xxx
-#DocInstDir=/usr/doc/xxx
-
-BURG_OPTS = -I
-
-PURIFY := $(PURIFY) -cache-dir="$(BUILD_ROOT_TOP)/../purifycache" -chain-length="30" -messages=all
-
-# Shorthand for commonly accessed directories
-LIBDEBUG := $(BUILD_ROOT_TOP)/lib/Debug
-LIBRELEASE := $(BUILD_ROOT_TOP)/lib/Release
-LIBPROFILE := $(BUILD_ROOT_TOP)/lib/Profile
-TOOLDEBUG := $(BUILD_ROOT_TOP)/tools/Debug
-TOOLRELEASE := $(BUILD_ROOT_TOP)/tools/Release
-TOOLPROFILE := $(BUILD_ROOT_TOP)/tools/Profile
-
-# Verbosity levels
-ifdef VERBOSE
-VERB :=
-else
-VERB := @
-endif
-
-#---------------------------------------------------------
-# Compilation options...
-#---------------------------------------------------------
-
-# Special tools used while building the LLVM tree. Burg is built as part of the
-# utils directory.
-#
-BURG := $(TOOLDEBUG)/burg
-RunBurg := $(BURG) $(BURG_OPTS)
-
-
-# Enable this for profiling support with 'gprof'
-# This automatically enables optimized builds.
-ifdef ENABLE_PROFILING
- PROFILE = -pg
- ENABLE_OPTIMIZED = 1
-else
- PROFILE =
-endif
-
-# By default, strip symbol information from executable
-ifdef KEEP_SYMBOLS
-STRIP =
-else
-STRIP = -s
-endif
-
-# Allow gnu extensions...
-CPPFLAGS += -D_GNU_SOURCE
-
-# -Wno-unused-parameter
-CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include
-
-# Compile a cpp file, don't link...
-Compile := $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
-CompileG := $(Compile) -g -D_DEBUG
-CompileO := $(Compile) -O3 -DNDEBUG -finline-functions -felide-constructors -fshort-enums ## DISABLE -freg-struct-return because of gcc3.2 bug
-CompileP := $(CompileO) $(PROFILE)
-
-# Compile a c file, don't link...
-CompileC := $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts)
-CompileCG := $(CompileC) -g -D_DEBUG
-CompileCO := $(CompileC) -O3 -DNDEBUG -finline-functions -felide-constructors -fshort-enums ## DISABLE -freg-struct-return because of gcc3.2 bug
-CompileCP := $(CompileCO) $(PROFILE)
-
-
-# Link final executable
-
-ifdef ENABLE_PURIFY # To enable purify, build with 'gmake ENABLE_PURIFY=1'
-Link := $(PURIFY) $(CXX) -static
-else
-Link := $(CXX)
-endif
-LinkG := $(Link) -g -L $(LIBDEBUG) $(STRIP)
-LinkO := $(Link) -O3 -L $(LIBRELEASE)
-LinkP := $(Link) -O3 -L $(LIBPROFILE) $(PROFILE)
-
-# Create one .o file from a bunch of .o files...
-Relink = ld -r
-
-# MakeSO - Create a .so file from a .o files...
-MakeSO := $(CXX) $(MakeSharedObjectOption)
-MakeSOO := $(MakeSO) -O3
-MakeSOP := $(MakeSOO) $(PROFILE)
-
-# Create dependancy file from CPP file, send to stdout.
-Depend := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS)
-DependC := $(CC) -MM -I$(LEVEL)/include $(CPPFLAGS)
-
-# Archive a bunch of .o files into a .a file...
-AR = ar cq
-BISON = bison
-
-#----------------------------------------------------------
-
-# Source includes all of the cpp files, and objects are derived from the
-# source files...
-# The local Makefile can list other Source files via ExtraSource = ...
-#
-ifndef Source
-Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
-endif
-
-Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(basename $(Source)))))
-ObjectsO := $(addprefix $(BUILD_ROOT)/Release/,$(Objs))
-ObjectsP := $(addprefix $(BUILD_ROOT)/Profile/,$(Objs))
-ObjectsG := $(addprefix $(BUILD_ROOT)/Debug/,$(Objs))
-
-
-#---------------------------------------------------------
-# Handle the DIRS and PARALLEL_DIRS options
-#---------------------------------------------------------
-
-ifdef DIRS
-all install clean ::
- $(VERB) for dir in ${DIRS}; do \
- (cd $$dir; $(MAKE) $@) || exit 1; \
- done
-endif
-
-# Handle PARALLEL_DIRS
-ifdef PARALLEL_DIRS
-all :: $(addsuffix /.makeall , $(PARALLEL_DIRS))
-install :: $(addsuffix /.makeinstall, $(PARALLEL_DIRS))
-clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS))
-
-%/.makeall %/.makeinstall %/.makeclean:
- $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
-
-endif
-
-#---------------------------------------------------------
-# Handle the LIBRARYNAME option - used when building libs...
-#---------------------------------------------------------