-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
-TOOLDEBUG := $(BUILD_ROOT_TOP)/tools/Debug
-TOOLRELEASE := $(BUILD_ROOT_TOP)/tools/Release
-
-# 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 := $(LEVEL)/utils/Burg/burg
-RunBurg := $(BURG) $(BURG_OPTS)
-
-
-# Enable this for profiling support with 'gprof'
-ifdef ENABLE_PROFILING
-PROFILE = -pg
-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 := $(PROFILE) -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include
-
-# Compile a file, don't link...
-Compile := $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
-CompileG := $(Compile) -g -D_DEBUG
-CompileO := $(Compile) -O3 -DNDEBUG -finline-functions -felide-constructors -fnonnull-objects -freg-struct-return -fshort-enums
-
-# Link final executable
-
-ifdef ENABLE_PURIFY # To enable purify, build with 'gmake ENABLE_PURIFY=1'
-Link := $(PURIFY) $(CXX) $(PROFILE) -static
-else
-Link := $(CXX) $(PROFILE)
-endif
-LinkG := $(Link) -g -L $(LIBDEBUG) $(STRIP)
-LinkO := $(Link) -O3 -L $(LIBRELEASE)
-
-# 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) $(PROFILE)
-MakeSOO := $(MakeSO) -O3
-
-# Create dependancy file from CPP file, send to stdout.
-Depend := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS)
-
-# Archive a bunch of .o files into a .a file...
-AR = ar cq
-
-#----------------------------------------------------------
-
-# 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 = ...
-#
-Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
-
-Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(basename $(Source)))))
-ObjectsO := $(addprefix $(BUILD_ROOT)/Release/,$(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