diff -r 2165316f8c38 Makefile.config.in
--- a/Makefile.config.in	Sun Nov 23 19:22:48 2008 +0000
+++ b/Makefile.config.in	Mon Nov 24 05:21:26 2008 +0100
@@ -17,6 +17,9 @@
 LLVMVersion       := @PACKAGE_VERSION@
 LLVM_CONFIGTIME   := @LLVM_CONFIGTIME@
 
+# Targets that we should build (set early so e.g. `includes' can use it)
+TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
+
 ###########################################################################
 # Directory Configuration
 #	This section of the Makefile determines what is where.  To be
@@ -76,6 +79,9 @@
 
 LLVMMAKE := $(LLVM_SRC_ROOT)/make
 
+PROJ_SRC_DIRS := $(PROJ_SRC_DIR) $(INCLUDE_DIRS:%=$(PROJ_SRC_DIR)/%)
+PROJ_OBJ_DIRS := $(PROJ_OBJ_DIR) $(INCLUDE_DIRS:%=$(PROJ_OBJ_DIR)/%)
+
 PROJ_bindir     := $(DESTDIR)$(PROJ_prefix)/bin
 PROJ_libdir     := $(DESTDIR)$(PROJ_prefix)/lib
 PROJ_datadir    := $(DESTDIR)$(PROJ_prefix)/share
@@ -113,9 +119,6 @@
 # Extra options to compile LLVM with
 EXTRA_OPTIONS=@EXTRA_OPTIONS@
 
-# Endian-ness of the target
-ENDIAN=@ENDIAN@
-
 # Path to the C++ compiler to use.  This is an optional setting, which defaults
 # to whatever your gmake defaults to.
 CXX = @CXX@
@@ -172,9 +175,6 @@
 
 LIBS       := @LIBS@
 
-# Targets that we should build
-TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
-
 # Path to location for LLVM C/C++ front-end. You can modify this if you
 # want to override the value set by configure.
 LLVMGCCDIR := @LLVMGCCDIR@
@@ -231,6 +231,12 @@
 # information to allow gprof to be used to get execution frequencies.
 #ENABLE_PROFILING = 1
 
+# When enabled, build shared/dynamic libraries by default
+ENABLE_SHARED := @ENABLE_SHARED@
+
+# When enabled, build static libraries/archives by default
+ENABLE_STATIC := @ENABLE_STATIC@
+
 # When ENABLE_DOXYGEN is enabled, the doxygen documentation will be built
 ENABLE_DOXYGEN = @ENABLE_DOXYGEN@
 
@@ -243,6 +249,10 @@
 # Use -fvisibility-inlines-hidden?
 ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
 
+# Use link-time optimisation (that is, -O4)
+#LTO=1
+@LTO@
+
 # This option tells the Makefiles to produce verbose output.
 # It essentially prints the commands that make is executing
 #VERBOSE = 1
@@ -256,6 +266,9 @@
 # Executable file extension for host platform.
 EXEEXT = @EXEEXT@
 
+# The subdirectory in the library directory that contains the actual libraries
+LIBTOOL_OBJDIR = @LIBTOOL_OBJDIR@
+
 # Things we just assume are "there"
 ECHO := echo
 
@@ -283,3 +296,6 @@
 else
   SYSPATH = $(1)
 endif
+
+# Darwin target-specific variables, e.g. MACOSX_DEPLOYMENT_TARGET
+@DARWIN_TARGET@
diff -r 2165316f8c38 Makefile.rules
--- a/Makefile.rules	Sun Nov 23 19:22:48 2008 +0000
+++ b/Makefile.rules	Mon Nov 24 05:21:26 2008 +0100
@@ -35,7 +35,7 @@
 #--------------------------------------------------------------------
 # Set the VPATH so that we can find source files.
 #--------------------------------------------------------------------
-VPATH=$(PROJ_SRC_DIR)
+VPATH := $(PROJ_SRC_DIR) $(VPATH)
 
 #--------------------------------------------------------------------
 # Reset the list of suffixes we know how to build.
@@ -161,7 +161,6 @@
 
 Makefile: $(PROJ_SRC_DIR)/Makefile $(ExtraMakefiles)
 	$(Echo) "Updating Makefile"
-	$(Verb) $(MKDIR) $(@D)
 	$(Verb) $(CP) -f $< $@
 
 # Copy the Makefile.* files unless we're in the root directory which avoids
@@ -171,8 +170,8 @@
 	@case '$?' in \
           *Makefile.rules) ;; \
           *.in) ;; \
-          *) $(EchoCmd) "Updating $(@F)" ; \
-	     $(MKDIR) $(@D) ; \
+          *) $(EchoCmd) "Updating $(notdir $@)" ; \
+	     $(MKDIR) $(PROJ_OBJ_DIRS) ; \
 	     $(CP) -f $< $@ ;; \
 	esac
 
@@ -208,7 +207,12 @@
 # OPTIMIZE_OPTION - The optimization level option we want to build LLVM with
 # this can be overridden on the make command line.
 ifneq ($(OS),MingW)
-  OPTIMIZE_OPTION := -O3
+  ifeq ($(LTO),1)
+    OPTIMIZE_OPTION := -O4
+  else
+	LTO :=
+    OPTIMIZE_OPTION := -O3
+  endif
 else
   OPTIMIZE_OPTION := -O2
 endif
@@ -312,8 +316,7 @@
   BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
 endif
 
-ObjRootDir  := $(PROJ_OBJ_DIR)/$(BuildMode)
-ObjDir      := $(ObjRootDir)
+ObjDir      := $(PROJ_OBJ_DIR)/$(BuildMode)
 LibDir      := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
 ToolDir     := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
 ExmplDir    := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
@@ -325,7 +328,11 @@
 #--------------------------------------------------------------------
 # Full Paths To Compiled Tools and Utilities
 #--------------------------------------------------------------------
-EchoCmd  = $(ECHO) llvm[$(MAKELEVEL)]:
+ifdef PROJECT_NAME
+EchoCmd  := $(ECHO) $(PROJECT_NAME)[$(MAKELEVEL)]:
+else
+EchoCmd  := $(ECHO) $(basename $(MAKE))[$(MAKELEVEL)]:
+endif
 Echo     = @$(EchoCmd)
 ifndef LIBTOOL
 LIBTOOL  := $(LLVM_OBJ_ROOT)/mklib
@@ -378,6 +385,16 @@
 # Adjust to user's request
 #--------------------------------------------------------------------
 
+$(foreach v, ENABLE_STATIC ENABLE_SHARED BUILD_LIBRARY BUILD_ARCHIVE \
+   SHARED_LIBRARY LOADABLE_MODULE BYTECODE_LIBRARY LINK_LIBS_IN_SHARED, \
+   $(eval $v := $(filter 1, $($v))))
+
+ifdef LIBRARYNAME
+  ifeq ($(LOADABLE_MODULE)$(BUILD_ARCHIVE)$(BUILD_ARCHIVE)$(SHARED_LIBRARY),)
+    BUILD_LIBRARY := 1
+  endif
+endif
+
 # Adjust LD.Flags and Libtool.Flags depending on the kind of library that is
 # to be built. Note that if LOADABLE_MODULE is specified then the resulting
 # shared library can be opened with dlopen. Also, LOADABLE_MODULE implies 
@@ -386,16 +403,28 @@
   SHARED_LIBRARY := 1
   DONT_BUILD_RELINKED := 1
   LINK_LIBS_IN_SHARED := 1
-  LD.Flags += -module
+endif
+
+ifeq ($(BUILD_LIBRARY),1)
+  SHARED_LIBRARY := $(ENABLE_SHARED)
+  BUILD_ARCHIVE := $(ENABLE_STATIC)
 endif
 
 ifdef SHARED_LIBRARY
-  LD.Flags += -rpath $(LibDir)
+  LD.Flags += -rpath $(PROJ_libdir)
+  LINK_LIBS_IN_SHARED := 1
+
+  ifndef ENABLE_STATIC
+    DONT_BUILD_RELINKED := 1
+  endif
 else
   LibTool.Flags += --tag=disable-shared
 endif
 
 ifdef TOOL_VERBOSE
+  VERBOSE := 2
+endif
+ifeq ($(VERBOSE), 2)
   C.Flags += -v
   CXX.Flags += -v
   LD.Flags += -v
@@ -404,6 +433,7 @@
 
 # Adjust settings for verbose mode
 ifndef VERBOSE
+  .SILENT:
   Verb := @
   LibTool.Flags += --silent
   AR.Flags += >/dev/null 2>/dev/null
@@ -422,9 +452,9 @@
 # Adjust linker flags for building an executable
 ifdef TOOLNAME
 ifdef EXAMPLE_TOOL
-  LD.Flags += -rpath $(ExmplDir) -export-dynamic
+  LD.Flags += -rpath $(ExmplDir) -no-undefined
 else
-  LD.Flags += -rpath $(ToolDir) -export-dynamic
+  LD.Flags += -rpath $(ToolDir) -no-undefined
 endif
 endif
 
@@ -470,14 +500,20 @@
 CPP.BaseFlags += -include llvm/System/Solaris.h
 endif
 
+# utility function for getting all parent path elements of a directory
+GET_PARENT_DIRS = $(strip $2 $(if $(filter $(1)/%, $2), \
+	$(call GET_PARENT_DIRS, $1, $(patsubst %/, %, $(dir $2)))))
+
 LD.Flags      += -L$(LibDir) -L$(LLVMLibDir) 
 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-# All -I flags should go here, so that they don't confuse llvm-config.
-CPP.Flags     += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
-	         $(patsubst %,-I%/include,\
-	         $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
-	         $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
-	         $(CPP.BaseFlags)
+# All included directories go here, so that they don't confuse llvm-config.
+CPP.Includes += $(patsubst %, %/include, $(PROJ_SRC_ROOT) $(LLVM_SRC_ROOT)) \
+	$(call GET_PARENT_DIRS,$(PROJ_SRC_DIR),$(<D))
+# Add the directories as -I flags, in both source and object directories
+CPP.Flags += $(patsubst %, -I%, $(sort \
+	$(foreach v, PROJ LLVM, $(CPP.Includes:$($v_SRC_ROOT)%=$($v_OBJ_ROOT)%)) \
+	$(CPP.Includes))) $(CPP.BaseFlags)
+
 
  ifeq ($(BUILD_COMPONENT), 1)
   Compile.C     = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c
@@ -509,6 +545,13 @@
 LTRelink      = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Relink)
 LTInstall     = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
 		$(Install.Flags)
+LTFinish      = $(LIBTOOL) $(LibTool.Flags) --mode=finish
+ifdef ENABLE_SHARED
+LTExecute    := $(LIBTOOL) $(LibTool.Flags) --mode=execute \
+		-dlopen $(LibDir)/libLLVMSystem.la
+else
+LTExecute    :=
+endif
 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755 
 ScriptInstall = $(INSTALL) -m 0755 
 DataInstall   = $(INSTALL) -m 0644
@@ -516,9 +559,12 @@
 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
 # paths. In this case, the SYSPATH function (defined in
 # Makefile.config) transforms Unix paths into Windows paths.
-TableGen      = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
-                -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
-                -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
+define TableGen
+$(MKDIR) $(@D)
+$(LTExecute) $(TBLGEN) \
+	$(foreach d, $(PROJ_SRC_ROOT)/include $(PROJ_SRC_DIR) $(<D), \
+	-I $(call SYSPATH, $d))
+endef
 
 Archive       = $(AR) $(AR.Flags)
 LArchive      = $(LLVMToolDir)/llvm-ar rcsf
@@ -534,9 +580,8 @@
 #----------------------------------------------------------
 
 ifndef SOURCES
-  Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
-             $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c $(PROJ_SRC_DIR)/*.y \
-             $(PROJ_SRC_DIR)/*.l))
+  Sources := $(patsubst $(PROJ_SRC_DIR)/%,%, $(foreach s, cpp cc c y l, \
+    $(wildcard $(addsuffix /*.$s, $(PROJ_SRC_DIRS)))))
 else
   Sources := $(SOURCES)
 endif 
@@ -545,7 +590,12 @@
 Sources += $(filter %.cpp %.c %.cc %.y %.l,$(BUILT_SOURCES))
 endif
 
-BaseNameSources := $(sort $(basename $(Sources)))
+BaseNameSources := \
+	$(sort $(basename $(patsubst $(PROJ_SRC_DIR)/%, %, $(Sources))))
+
+# HACK: put X86 first; it's huge!
+BaseNameSources := \
+	$(filter X86%, $(BaseNameSources)) $(filter-out X86%, $(BaseNameSources))
 
 ObjectsO  := $(BaseNameSources:%=$(ObjDir)/%.o)
 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
@@ -565,6 +615,9 @@
 $(PROJ_includedir): $(PROJ_includedir)/.dir
 $(PROJ_etcdir): $(PROJ_etcdir)/.dir
 
+# Make sure that all object directories are present
+$(ObjDir)/.dir: $(INCLUDE_DIRS:%=$(ObjDir)/%/.dir)
+
 # To create other directories, as needed, and timestamp their creation
 %/.dir:
 	$(Verb) $(MKDIR) $* > /dev/null
@@ -709,17 +762,27 @@
 # by the LLVM project).
 #---------------------------------------------------------
 
+# TODO: what to do when both are enabled?
+ifndef ENABLE_SHARED
+USEDLIBS := $(USEDLIBS:%.la=%.a)
+LLVMLIBS := $(LLVMLIBS:%.la=%.a)
+endif
+
 ifdef USEDLIBS
-ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
+ProjUsedLibs    := \
+	$(patsubst %.a.o, lib%.a, $(patsubst %.la.o, lib%.la, $(USEDLIBS:%=%.o)))
+ProjLibsOptions := \
+	$(patsubst %.a.o, -l%, $(patsubst %.la.o, -l%, $(USEDLIBS:%=%.o)))
 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o,  $(ProjLibsOptions))
-ProjUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
 ProjLibsPaths   := $(addprefix $(LibDir)/,$(ProjUsedLibs))
 endif
 
 ifdef LLVMLIBS
-LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
+LLVMUsedLibs    := \
+	$(patsubst %.a.o, lib%.a, $(patsubst %.la.o, lib%.la, $(LLVMLIBS:%=%.o)))
+LLVMLibsOptions := \
+	$(patsubst %.a.o, -l%, $(patsubst %.la.o, -l%, $(LLVMLIBS:%=%.o)))
 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
-LLVMUsedLibs    := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
 LLVMLibsPaths   := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
 endif
 
@@ -734,9 +797,16 @@
 
 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
 
-ProjLibsOptions += $(shell $(LLVM_CONFIG) --libs     $(LINK_COMPONENTS))
+ProjLibsOptions += $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS))
+
+ifdef ENABLE_SHARED
+ProjLibsPaths   += $(patsubst %$(SHLIBEXT), %.la, $(LLVM_CONFIG) \
+                   $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS)))
+else
 ProjLibsPaths   += $(LLVM_CONFIG) \
-                  $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
+                   $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
+endif
+
 endif
 endif
 
@@ -766,7 +836,7 @@
 endif
 
 $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD)
-	$(Echo) Building $(BuildMode) Bytecode Module $(notdir $@)
+	$(Echo) Building $(BuildMode) Bitcode Module $(notdir $@)
 	$(Verb) $(LinkModule) -o $@ $(ObjectsBC)
 
 all-local:: $(Module)
@@ -794,11 +864,11 @@
 install-local:: $(DestModule)
 
 $(DestModule): $(ModuleDestDir) $(Module) 
-	$(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
+	$(Echo) Installing $(BuildMode) Bitcode Module $(DestModule)
 	$(Verb) $(DataInstall) $(Module) $(DestModule)
 
 uninstall-local::
-	$(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
+	$(Echo) Uninstalling $(BuildMode) Bitcode Module $(DestModule)
 	-$(Verb) $(RM) -f $(DestModule)
 endif
 
@@ -829,23 +899,27 @@
 
 all-local:: $(LibName.LA)
 
-ifdef LINK_LIBS_IN_SHARED
-ifdef LOADABLE_MODULE
+ifeq ($(LINK_LIBS_IN_SHARED),1)
+ifdef PROJ_VERSION
+LD.Flags += -version-info $(subst .,:,$(PROJ_VERSION:%svn=%))
+endif
+
+ifeq ($(LOADABLE_MODULE),1)
 SharedLibKindMessage := "Loadable Module"
+LD.Flags += -module
 else
 SharedLibKindMessage := "Shared Library"
+LD.Flags += -shared -no-undefined
 endif
+
 $(LibName.LA): $(ObjectsLO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir
 	$(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
-	  $(LIBRARYNAME)$(SHLIBEXT)
-	$(Verb) $(LTLink) -o $@ $(ObjectsLO) $(ProjLibsOptions) \
-	  $(LLVMLibsOptions)
-	$(Verb) $(LTInstall) $@ $(LibDir)
+		$(basename $(notdir $@))$(SHLIBEXT)
+	$(Verb) $(LTLink) -o $@ $(ObjectsLO) $(ProjLibsOptions) $(LLVMLibsOptions)
 else
 $(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
-	$(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
+	$(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
 	$(Verb) $(LTLink) -o $@ $(ObjectsLO)
-	$(Verb) $(LTInstall) $@ $(LibDir)
 endif
 
 clean-local::
@@ -866,7 +940,7 @@
 $(DestSharedLib): $(PROJ_libdir) $(LibName.LA)
 	$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
 	$(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
-	$(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
+	$(Verb) $(LTFinish) $(PROJ_libdir)
 
 uninstall-local:: 
 	$(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
@@ -893,15 +967,14 @@
 
 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
                 $(LLVMToolDir)/llvm-ar
-	$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
-	  "(internalize)"
+	$(Echo) Building $(BuildMode) Bitcode Archive $(notdir $@) "(internalize)"
 	$(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
 	$(Verb) $(RM) -f $@
 	$(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
 else
 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \
                 $(LLVMToolDir)/llvm-ar
-	$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
+	$(Echo) Building $(BuildMode) Bitcode Archive $(notdir $@)
 	$(Verb) $(RM) -f $@
 	$(Verb) $(LArchive) $@ $(ObjectsBC)
 
@@ -931,11 +1004,11 @@
 install-local:: $(DestBytecodeLib)
 
 $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA) 
-	$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
+	$(Echo) Installing $(BuildMode) Bitcode Archive $(DestBytecodeLib)
 	$(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib)
 
 uninstall-local::
-	$(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
+	$(Echo) Uninstalling $(BuildMode) Bitcode Archive $(DestBytecodeLib)
 	-$(Verb) $(RM) -f $(DestBytecodeLib)
 endif
 endif
@@ -948,19 +1021,21 @@
 #   neither of BUILD_ARCHIVE or DONT_BUILD_RELINKED, give
 #   them one.
 #---------------------------------------------------------
+ifdef ENABLE_STATIC
 ifndef BUILD_ARCHIVE
 ifndef DONT_BUILD_RELINKED
 BUILD_RELINKED = 1
 endif
 endif
+endif
 
 ifdef BUILD_RELINKED
 
 all-local:: $(LibName.O)
 
-$(LibName.O): $(ObjectsO) $(LibDir)/.dir
+$(LibName.O): $(if $(SHARED_LIBRARY), $(ObjectsLO), $(ObjectsO)) $(LibDir)/.dir
 	$(Echo) Linking $(BuildMode) Object Library $(notdir $@)
-	$(Verb) $(LTRelink) -o $@ $(ObjectsO)
+	$(Verb) $(LTRelink) -o $@ $(if $(SHARED_LIBRARY), $(ObjectsLO), $(ObjectsO))
 
 clean-local::
 ifneq ($(strip $(LibName.O)),)
@@ -1065,7 +1140,7 @@
 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
 	$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
 	$(Verb) $(LTLink) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
-	$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
+	$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) -no-undefined
 	$(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
           $(StripWarnMsg) 
 
@@ -1142,31 +1217,31 @@
 #---------------------------------------------------------
 
 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
-	$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
-	$(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" \
+	$(Echo) "Compiling $*.cpp for $(BuildMode) build (bitcode)"
+	$(Verb) if $(BCCompile.CXX) -MD -MT $(@F) -MP -MF "$(ObjDir)/$*.BCCXXd" \
                               $< -o $@ -S -emit-llvm ; \
 	then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
 	else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
-	$(call UPGRADE_MSG,$@) 
-	$(call UPGRADE_LL,$@)
+	$(call UPGRADE_MSG,$(notdir $@)) 
+	$(call UPGRADE_LL,$(notdir $@))
 
 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
-	$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
-	$(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" \
+	$(Echo) "Compiling $*.cc for $(BuildMode) build (bitcode)"
+	$(Verb) if $(BCCompile.CXX) -MD -MT $(@F) -MP -MF "$(ObjDir)/$*.BCCXXd" \
                               $< -o $@ -S -emit-llvm ; \
 	then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \
 	else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi
-	$(call UPGRADE_MSG,$@) 
-	$(call UPGRADE_LL,$@)
+	$(call UPGRADE_MSG,$(notdir $@)) 
+	$(call UPGRADE_LL,$(notdir $@))
 
 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
-	$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
-	$(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" \
+	$(Echo) "Compiling $*.c for $(BuildMode) build (bitcode)"
+	$(Verb) if $(BCCompile.C) -MD -MT $(@F) -MP -MF "$(ObjDir)/$*.BCCd" \
                             $< -o $@ -S -emit-llvm ; \
 	then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \
 	else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi
-	$(call UPGRADE_MSG,$@) 
-	$(call UPGRADE_LL,$@)
+	$(call UPGRADE_MSG,$(notdir $@)) 
+	$(call UPGRADE_LL,$(notdir $@))
 
 # Provide alternate rule sets if dependencies are disabled
 else
@@ -1184,19 +1259,19 @@
 	$(MAYBE_PIC_Compile.C) $< -o $@ 
 
 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
-	$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
+	$(Echo) "Compiling $*.cpp for $(BuildMode) build (bitcode)"
 	$(BCCompile.CXX) $< -o $@ -S -emit-llvm
-	$(call UPGRADE_MSG,$@) 
-	$(call UPGRADE_LL,$@)
+	$(call UPGRADE_MSG,$(notdir $@)) 
+	$(call UPGRADE_LL,$(notdir $@))
 
 $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
-	$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
+	$(Echo) "Compiling $*.cc for $(BuildMode) build (bitcode)"
 	$(BCCompile.CXX) $< -o $@ -S -emit-llvm
-	$(call UPGRADE_MSG,$@) 
-	$(call UPGRADE_LL,$@)
+	$(call UPGRADE_MSG,$(notdir $@)) 
+	$(call UPGRADE_LL,$(notdir $@))
 
 $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
-	$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
+	$(Echo) "Compiling $*.c for $(BuildMode) build (bitcode)"
 	$(BCCompile.C) $< -o $@ -S -emit-llvm
 	$(call UPGRADE_MSG,@) 
 	$(call UPGRADE_LL,@)
@@ -1234,11 +1309,11 @@
 # make the C and C++ compilers strip debug info out of bytecode libraries.
 ifdef DEBUG_RUNTIME
 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
-	$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
+	$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bitcode)"
 	$(Verb) $(LLVMAS) $< -o - | $(LOPT) -std-compile-opts -o $@ -f
 else
 $(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LLVMAS) $(LOPT)
-	$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)"
+	$(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bitcode)"
 	$(Verb) $(LLVMAS) $< -o - | \
 	   $(LOPT) -std-compile-opts -strip-debug -o $@ -f
 endif
@@ -1256,16 +1331,17 @@
 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
 ###############################################################################
 
-ifdef TARGET
+ifdef TARGETS
 
-TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
+TDFiles := $(strip $(wildcard $(addsuffix /*.td, $(PROJ_SRC_DIRS))) \
            $(LLVM_SRC_ROOT)/lib/Target/Target.td \
            $(LLVM_SRC_ROOT)/lib/Target/TargetCallingConv.td \
            $(LLVM_SRC_ROOT)/lib/Target/TargetSelectionDAG.td \
            $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
            $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
-INCFiles := $(filter %.inc,$(BUILT_SOURCES))
+INCFiles := $(filter %.inc, $(BUILT_SOURCES))
 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
+
 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
 
 # All of these files depend on tblgen and the .td files.
@@ -1278,66 +1354,55 @@
 # dependencies of the .inc files are, unless the contents of the .inc file
 # changes.
 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
+	$(Verb) $(MKDIR) $(@D)
 	$(Verb) $(CMP) -s $@ $< || $(CP) $< $@
 
-$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
 $(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) register names with tblgen"
+	$(Echo) "Building $(notdir $<) register names with tblgen"
 	$(Verb) $(TableGen) -gen-register-enums -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
 $(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) register information header with tblgen"
+	$(Echo) "Building $(notdir $<) register information header with tblgen"
 	$(Verb) $(TableGen) -gen-register-desc-header -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) register info implementation with tblgen"
+	$(Echo) "Building $(notdir $<) register info implementation with tblgen"
 	$(Verb) $(TableGen) -gen-register-desc -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
 $(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) instruction names with tblgen"
+	$(Echo) "Building $(notdir $<) instruction names with tblgen"
 	$(Verb) $(TableGen) -gen-instr-enums -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) instruction information with tblgen"
+	$(Echo) "Building $(notdir $<) instruction information with tblgen"
 	$(Verb) $(TableGen) -gen-instr-desc -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) assembly writer with tblgen"
+	$(Echo) "Building $(notdir $<) assembly writer with tblgen"
 	$(Verb) $(TableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) assembly writer #1 with tblgen"
+	$(Echo) "Building $(notdir $<) assembly writer #1 with tblgen"
 	$(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $< 
 
-$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) code emitter with tblgen"
+	$(Echo) "Building $(notdir $<) code emitter with tblgen"
 	$(Verb) $(TableGen) -gen-emitter -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
 	$(Echo) "Building $(<F) DAG instruction selector implementation with tblgen"
 	$(Verb) $(TableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir
 	$(Echo) "Building $(<F) \"fast\" instruction selector implementation with tblgen"
 	$(Verb) $(TableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
 $(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) subtarget information with tblgen"
+	$(Echo) "Building $(notdir $<) subtarget information with tblgen"
 	$(Verb) $(TableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
 
-$(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir
-	$(Echo) "Building $(<F) calling convention information with tblgen"
+	$(Echo) "Building $(notdir $<) calling convention information with tblgen"
 	$(Verb) $(TableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
 
 clean-local::
@@ -1473,8 +1538,8 @@
 # very conservative approach ensuring that empty variables do not cause 
 # errors or disastrous removal.
 clean-local::
-ifneq ($(strip $(ObjRootDir)),)
-	-$(Verb) $(RM) -rf $(ObjRootDir)
+ifneq ($(strip $(ObjDir)),)
+	-$(Verb) $(RM) -rf $(ObjDir)
 endif
 	-$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
@@ -1799,9 +1864,9 @@
 printvars::
 	$(Echo) "BuildMode    : " '$(BuildMode)'
 	$(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
-	$(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
+	$(Echo) "PROJ_SRC_DIRS: " '$(PROJ_SRC_DIRS)'
 	$(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
-	$(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
+	$(Echo) "PROJ_OBJ_DIRS: " '$(PROJ_OBJ_DIRS)'
 	$(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
 	$(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
 	$(Echo) "PROJ_prefix  : " '$(PROJ_prefix)'
diff -r 2165316f8c38 Xcode/LLVM.xcodeproj/project.pbxproj
--- a/Xcode/LLVM.xcodeproj/project.pbxproj	Sun Nov 23 19:22:48 2008 +0000
+++ b/Xcode/LLVM.xcodeproj/project.pbxproj	Mon Nov 24 05:21:26 2008 +0100
@@ -2968,7 +2968,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -2987,7 +2987,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3006,7 +3006,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3025,7 +3025,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3044,7 +3044,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3063,7 +3063,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3082,7 +3082,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3101,7 +3101,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3120,7 +3120,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3139,7 +3139,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3158,7 +3158,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3177,7 +3177,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3196,7 +3196,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3215,7 +3215,7 @@
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				OPTIMIZATION_CFLAGS = "-O0";
+				GCC_OPTIMIZATION_LEVEL = 0;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				OTHER_REZFLAGS = "";
@@ -3238,7 +3238,6 @@
 				GCC_ENABLE_FIX_AND_CONTINUE = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
-				OPTIMIZATION_CFLAGS = "-O0";
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				PRODUCT_NAME = LLVM;
diff -r 2165316f8c38 autoconf/AutoRegen.sh
--- a/autoconf/AutoRegen.sh	Sun Nov 23 19:22:48 2008 +0000
+++ b/autoconf/AutoRegen.sh	Mon Nov 24 05:21:26 2008 +0100
@@ -1,14 +1,27 @@
 #!/bin/sh
-die () {
-	echo "$@" 1>&2
-	exit 1
+
+always_die () {
+    echo "ERROR: $@" 1>&2
+    exit 1
 }
 
+maybe_die () {
+    echo "WARNING: $@" 1>&2
+}
+
+if test "$#" -ge 1 -a "$1" == -f
+then
+    shift
+else
+    alias maybe_die=always_die
+fi
+
 ### NOTE: ############################################################"
 ### The below two variables specify the auto* versions
 ### periods should be escaped with backslash, for use by grep
-want_autoconf_version='2\.60'
+want_autoconf_version='2\.63'
 want_autoheader_version=$want_autoconf_version
+want_aclocal_version='1\.10\.1'
 ### END NOTE #########################################################"
 
 
@@ -17,17 +30,24 @@
 
 want_autoconf_version_clean=`echo $want_autoconf_version | sed -e 's/\\\\//g'`
 want_autoheader_version_clean=`echo $want_autoheader_version | sed -e 's/\\\\//g'`
+want_aclocal_version_clean=`echo $want_aclocal_version | sed -e 's/\\\\//g'`
 
-test -d autoconf && test -f autoconf/$configfile && cd autoconf
+if test -d "`dirname $0`" -a -f "`dirname $0`"/$configfile
+then
+    cd "`dirname $0`"
+else
+    die "Can't find $configfile"
+fi
+
 test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
+
 autoconf --version | grep $want_autoconf_version > /dev/null
-test $? -eq 0 || die "Your autoconf was not detected as being $want_autoconf_version_clean"
-aclocal --version | grep '^aclocal.*1\.9\.6' > /dev/null
-test $? -eq 0 || die "Your aclocal was not detected as being 1.9.6"
+test $? -eq 0 || maybe_die "Your autoconf was not detected as being $want_autoconf_version_clean"
+aclocal --version | grep '^aclocal.*'$want_aclocal_version > /dev/null
+test $? -eq 0 || maybe_die "Your aclocal was not detected as being $want_aclocal_version_clean"
 autoheader --version | grep '^autoheader.*'$want_autoheader_version > /dev/null
-test $? -eq 0 || die "Your autoheader was not detected as being $want_autoheader_version_clean"
-libtool --version | grep '1\.5\.22' > /dev/null
-test $? -eq 0 || die "Your libtool was not detected as being 1.5.22"
+test $? -eq 0 || maybe_die "Your autoheader was not detected as being $want_autoheader_version_clean"
+
 echo ""
 echo "### NOTE: ############################################################"
 echo "### If you get *any* warnings from autoconf below you MUST fix the"
@@ -37,12 +57,14 @@
 echo "### present. You should get just three 'Regenerating..' lines."
 echo "######################################################################"
 echo ""
-echo "Regenerating aclocal.m4 with aclocal 1.9.6"
+echo "Regenerating aclocal.m4 with `aclocal --version | head -n1`"
+
 cwd=`pwd`
-aclocal --force -I $cwd/m4 || die "aclocal failed"
-echo "Regenerating configure with autoconf $want_autoconf_version_clean"
-autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
+aclocal --force -Werror -I $cwd/m4 || always_die "aclocal failed"
+echo "Regenerating configure with `autoconf --version | head -n1`"
+autoconf --force -Wall -Werror -o ../$outfile $configfile || always_die "autoconf failed"
 cd ..
-echo "Regenerating config.h.in with autoheader $want_autoheader_version_clean"
-autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
+echo "Regenerating config.h.in with `autoheader --version | head -n1`"
+autoheader -Wall -Werror -I autoconf -I autoconf/m4 autoconf/$configfile || always_die "autoheader failed"
+rm -rf autom4te.cache
 exit 0
diff -r 2165316f8c38 autoconf/configure.ac
--- a/autoconf/configure.ac	Sun Nov 23 19:22:48 2008 +0000
+++ b/autoconf/configure.ac	Mon Nov 24 05:21:26 2008 +0100
@@ -40,7 +40,7 @@
 
 dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we
 dnl use some autoconf macros only available in 2.59.
-AC_PREREQ(2.59)
+AC_PREREQ(2.63)
 
 dnl Verify that the source directory is valid. This makes sure that we are
 dnl configuring LLVM and not some other package (it validates --srcdir argument)
@@ -49,6 +49,7 @@
 dnl Place all of the extra autoconf files into the config subdirectory. Tell
 dnl various tools where the m4 autoconf macros are.
 AC_CONFIG_AUX_DIR([autoconf])
+AC_CONFIG_MACRO_DIR([autoconf/m4])
 
 dnl Quit if the source directory has already been configured.
 dnl NOTE: This relies upon undocumented autoconf behavior.
@@ -81,6 +82,7 @@
       llvm-poolalloc) AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) ;;
       poolalloc)    AC_CONFIG_SUBDIRS([projects/poolalloc]) ;;
       llvm-kernel)  AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
+      vmkit)        AC_CONFIG_SUBDIRS([projects/vmkit])     ;;
       *)
         AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
         ;;
@@ -255,6 +257,28 @@
   AC_SUBST(LLVM_CROSS_COMPILING, [0])
 fi
 
+# Darwin deployment targets; for libtool, among other things
+if test "$llvm_cv_os_type" = "Darwin" -a "$llvm_cv_target_arch" != "ARM" ; then
+  AC_MSG_CHECKING([for Mac OS X deployment target])
+
+  case `echo $host | cut -d- -f 3 | tr -dC '1234567890.' | cut -d. -f 1` in
+    7)  macosx_version_min=10.3 ;;
+    8)  macosx_version_min=10.4 ;;
+    9)  macosx_version_min=10.5 ;;
+    10) macosx_version_min=10.6 ;;
+    *)  macosx_version_min=     ;;
+  esac
+
+  if test -z "$macosx_version_min"; then
+    AC_MSG_RESULT([])
+    AC_MSG_WARN([Unrecognised system version!])
+  else
+    AC_MSG_RESULT([$macosx_version_min])
+    AC_SUBST(DARWIN_TARGET, [[MACOSX_DEPLOYMENT_TARGET=$macosx_version_min]])
+    export MACOSX_DEPLOYMENT_TARGET=$macosx_version_min
+  fi
+fi
+
 dnl Check to see if there's a "CVS" (or .svn) directory indicating that this
 dnl build is being done from a checkout. This sets up several defaults for the
 dnl command line switches. When we build with a CVS directory, we get a
@@ -278,7 +302,7 @@
 
 dnl --enable-optimized : check whether they want to do an optimized build:
 AC_ARG_ENABLE(optimized, AS_HELP_STRING(
- [--enable-optimized,Compile with optimizations enabled (default is NO)]),,enableval=$optimize)
+ [--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=$optimize)
 if test ${enableval} = "no" ; then
   AC_SUBST(ENABLE_OPTIMIZED,[[]])
 else
@@ -287,7 +311,7 @@
 
 dnl --enable-assertions : check whether they want to turn on assertions or not:
 AC_ARG_ENABLE(assertions,AS_HELP_STRING(
-  [--enable-assertions,Compile with assertion checks enabled (default is YES)]),, enableval="yes")
+  [--enable-assertions],[Compile with assertion checks enabled (default is YES)]),, enableval="yes")
 if test ${enableval} = "yes" ; then
   AC_SUBST(DISABLE_ASSERTIONS,[[]])
 else
@@ -296,7 +320,7 @@
 
 dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks:
 AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING(
-  [--enable-expensive-checks,Compile with expensive debug checks enabled (default is NO)]),, enableval="no")
+  [--enable-expensive-checks],[Compile with expensive debug checks enabled (default is NO)]),, enableval="no")
 if test ${enableval} = "yes" ; then
   AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]])
   AC_SUBST(EXPENSIVE_CHECKS,[[yes]])
@@ -307,7 +331,7 @@
 
 dnl --enable-debug-runtime : should runtime libraries have debug symbols?
 AC_ARG_ENABLE(debug-runtime,
-   AS_HELP_STRING([--enable-debug-runtime,Build runtime libs with debug symbols (default is NO)]),,enableval=no)
+   AS_HELP_STRING([--enable-debug-runtime],[Build runtime libs with debug symbols (default is NO)]),,enableval=no)
 if test ${enableval} = "no" ; then
   AC_SUBST(DEBUG_RUNTIME,[[]])
 else
@@ -363,65 +387,70 @@
 esac
 AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
 
-dnl Allow building with position independent code
-AC_ARG_ENABLE(pic,
-  AS_HELP_STRING([--enable-pic],
-                 [Build LLVM with Position Independent Code (default is NO)]),,
-                 enableval=default)
-case "$enableval" in
-  yes) AC_SUBST(ENABLE_PIC,[1]) ;;
-  no)  AC_SUBST(ENABLE_PIC,[0]) ;;
-  default) AC_SUBST(ENABLE_PIC,[0]) ;;
-  *) AC_MSG_ERROR([Invalid setting for --enable-pic. Use "yes" or "no"]) ;;
-esac
-AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC,
-                   [Define if position independent code is enabled])
-
 dnl Allow specific targets to be specified for building (or not)
 TARGETS_TO_BUILD=""
 AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
     [Build specific host targets: all,host-only,{target-name} (default=all)]),,
     enableval=all)
+
+AC_MSG_CHECKING([which targets to build])
 case "$enableval" in
-  all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU PIC16 XCore CBackend MSIL CppBackend" ;;
+  all)
+    TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU PIC16 XCore CBackend MSIL CppBackend"
+     ;;
+  common)
+    TARGETS_TO_BUILD="X86 ARM CBackend MSIL CppBackend $llvm_cv_target_arch"
+
+    if test "$llvm_cv_os_type" = "Darwin" ; then
+      TARGETS_TO_BUILD="$TARGETS_TO_BUILD PowerPC"
+    elif test "$llvm_cv_os_type" = "SunOS" ; then
+      TARGETS_TO_BUILD="$TARGETS_TO_BUILD Sparc"
+    fi
+    ;;
   host-only)
     case "$llvm_cv_target_arch" in
-      x86)     TARGETS_TO_BUILD="X86" ;;
-      x86_64)  TARGETS_TO_BUILD="X86" ;;
-      Sparc)   TARGETS_TO_BUILD="Sparc" ;;
-      PowerPC) TARGETS_TO_BUILD="PowerPC" ;;
-      Alpha)   TARGETS_TO_BUILD="Alpha" ;;
-      IA64)    TARGETS_TO_BUILD="IA64" ;;
-      ARM)     TARGETS_TO_BUILD="ARM" ;;
-      Mips)    TARGETS_TO_BUILD="Mips" ;;
-      CellSPU|SPU) TARGETS_TO_BUILD="CellSPU" ;;
-      PIC16)   TARGETS_TO_BUILD="PIC16" ;;
-      XCore)   TARGETS_TO_BUILD="XCore" ;;
-      *)       AC_MSG_ERROR([Can not set target to build]) ;;
+      x86)         t="X86" ;;
+      x86_64)      t="X86" ;;
+      Sparc)       t="Sparc" ;;
+      PowerPC)     t="PowerPC" ;;
+      Alpha)       t="Alpha" ;;
+      IA64)        t="IA64" ;;
+      ARM)         t="ARM" ;;
+      Mips)        t="Mips" ;;
+      CellSPU|SPU) t="CellSPU" ;;
+      PIC16)       t="PIC16" ;;
+      XCore)       t="XCore" ;;
+      *)           AC_MSG_ERROR([Cannot set target to build]) ;;
     esac
+    TARGETS_TO_BUILD="$t"
     ;;
-  *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
+  *)
+    for a_target in `echo $enableval | tr ',:;[A-Z]' '   [a-z]'` ; do
       case "$a_target" in
-        x86)     TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
-        x86_64)  TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
-        sparc)   TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
-        powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
-        alpha)   TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
-        ia64)    TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;;
-        arm)     TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
-        mips)    TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
-        spu)     TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
-        pic16)   TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
-        xcore)   TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
-        cbe)     TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
-        msil)    TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;;
-        cpp)     TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
-        *) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
+        x86|x64|x86[-_]64) t="X86" ;;
+        sparc)             t="Sparc" ;;
+        powerpc*|ppc*)     t="PowerPC" ;;
+        alpha)             t="Alpha" ;;
+        ia64)              t="IA64" ;;
+        arm)               t="ARM" ;;
+        mips)              t="Mips" ;;
+        spu)               t="CellSPU" ;;
+        pic16)             t="PIC16" ;;
+        xcore)             t="XCore" ;;
+        cbe|c)             t="CBackend" ;;
+        msil|clr)          t="MSIL" ;;
+        cpp|c++|cxx)       t="CppBackend" ;;
+        *)                 AC_MSG_ERROR([Unrecognized target $a_target]) ;;
       esac
-  done
-  ;;
+      TARGETS_TO_BUILD="$TARGETS_TO_BUILD $t"
+    done
+    ;;
 esac
+
+TARGETS_TO_BUILD="`printf '%s\n' $TARGETS_TO_BUILD | sort -u | grep -v ^x86 | tr -s '[[:space:]]' ' '`"
+
 AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
+AC_MSG_RESULT([$TARGETS_TO_BUILD])
 
 dnl Prevent the CBackend from using printf("%a") for floating point so older
 dnl C compilers that cannot deal with the 0x0p+0 hex floating point format
@@ -527,7 +556,7 @@
 AC_PROG_FLEX
 AC_PROG_BISON
 
-AC_PROG_NM
+LT_PATH_NM
 AC_SUBST(NM)
 
 dnl Check for the tools that the makefiles require
@@ -622,22 +651,49 @@
 
 dnl Determine if the linker supports the -R option.
 AC_LINK_USE_R
+AC_LIB_RPATH
 
 dnl Check for libtool and the library that has dlopen function (which must come
-dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with
+dnl before the LT_INIT check in order to enable dlopening libraries with
 dnl libtool).
-AC_LIBTOOL_DLOPEN
-AC_LIB_LTDL
-AC_PROG_LIBTOOL
+LT_INIT([dlopen no-pic disable-shared])
+LT_LANG([C++])
+LTDL_INIT
+LT_SYS_DLOPEN_SELF
 
 if test "$lt_cv_dlopen_self" = "yes" ; then
   AC_DEFINE([CAN_DLOPEN_SELF],[1],
               [Define if dlopen(0) will open the symbols of the program])
 fi
 
+# should we build shared/dynamic libraries?
+if test "$enable_shared" = "yes" ; then
+  AC_SUBST(ENABLE_SHARED, [1])
+  AC_SUBST(LIBTOOL_OBJDIR, [$lt_cv_objdir])
+else
+  AC_SUBST(ENABLE_SHARED, [0])
+fi
+
+# should we build static libraries/archives?
+if test "$enable_static" != "no" ; then
+  AC_SUBST(ENABLE_STATIC, [1])
+else
+  AC_SUBST(ENABLE_STATIC, [0])
+fi
+
+if test "pic_mode" != "no" ; then
+  AC_DEFINE_UNQUOTED([ENABLE_PIC], [1],
+                     [Define if position independent code is enabled])
+fi
+
 if test "$WITH_LLVMGCCDIR" = "default" ; then
-  LLVMGCC="llvm-gcc${EXEEXT}"
-  LLVMGXX="llvm-g++${EXEEXT}"
+  if test -d "${srcdir}/projects/llvm-gcc" ; then
+    LLVMGCC="${srcdir}/projects/llvm-gcc/gcc/llvm-gcc${EXEEXT}"
+    LLVMGXX="${srcdir}/projects/llvm-gcc/gcc/llvm-g++${EXEEXT}"
+  else
+    LLVMGCC="llvm-gcc${EXEEXT} llvm-gcc-4.2${EXEEXT}"
+    LLVMGXX="llvm-g++${EXEEXT} llvm-g++-4.2${EXEEXT}"
+  fi
   AC_PATH_PROG(LLVMGCC, $LLVMGCC, [])
   AC_PATH_PROG(LLVMGXX, $LLVMGXX, [])
 else
@@ -788,7 +844,6 @@
 AC_HUGE_VAL_CHECK
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
-AC_TYPE_SIGNAL
 AC_STRUCT_TM
 AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
 AC_CHECK_TYPES([uint64_t],,
@@ -882,9 +937,58 @@
   AC_MSG_RESULT([ok])
 fi
 
+dnl See if the llvm-gcc executable can compile to LLVM assembly
+AC_ARG_ENABLE(lto,
+              AS_HELP_STRING([--enable-lto],
+                             [build using link-time optimization
+                              (default is NO)]),,
+              enableval=no)
+
+AC_MSG_CHECKING([whether to use link-time optimization])
+if test "${enableval}" = "no"
+then
+  AC_MSG_RESULT([no])
+  llvm_lto="no"
+else
+  AC_MSG_RESULT([yes])
+  llvm_lto="yes"
+
+  AC_MSG_CHECKING([whether link-time optimization works])
+  AC_LANG_PUSH(C++)
+  if "$CXX" --version | head -n1 | grep -q LLVM; then
+    save_CXXFLAGS="$CXXFLAGS"
+    CXXFLAGS="$CXXFLAGS -O4 -v"
+    AC_LINK_IFELSE([int main() { return 0; }], [], [llvm_lto=no])
+    CXXFLAGS="$save_CXXFLAGS"
+  else
+    llvm_lto="no"
+  fi
+  AC_LANG_POP(C++)
+
+  if "$CC" --version | head -n1 | grep -q LLVM; then
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -O4 -v"
+    AC_LINK_IFELSE([int main() { return 0; }], [], [llvm_lto=no])
+    CFLAGS="$save_CFLAGS"
+  else
+    llvm_lto="no"
+  fi
+
+  if test "$llvm_lto" = yes; then
+    AC_MSG_RESULT([yes])
+    AC_SUBST(LTO, [[LTO=1]])
+  else
+    AC_MSG_ERROR([Link-time optimized compilation requested, but not found])
+  fi
+fi
+
 dnl Propagate the shared library extension that the libltdl checks did to
 dnl the Makefiles so we can use it there too
-AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
+module=no
+eval llvm_cv_shlibext=$shrext_cmds
+AC_SUBST(SHLIBEXT, $llvm_cv_shlibext)
+AC_DEFINE_UNQUOTED([LLVM_SHARED_LIBRARY_SUFFIX], "$llvm_cv_shlibext",
+                   [Define this to the file extension of dynamic libraries])
 
 # Translate the various configuration directories and other basic
 # information into substitutions that will end up in Makefile.config.in
diff -r 2165316f8c38 bindings/ocaml/executionengine/Makefile
--- a/bindings/ocaml/executionengine/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/bindings/ocaml/executionengine/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -14,7 +14,7 @@
 LEVEL := ../../..
 LIBRARYNAME := llvm_executionengine
 DONT_BUILD_RELINKED := 1
-UsedComponents := executionengine jit interpreter native
+UsedComponents := executionengine
 UsedOcamlInterfaces := llvm llvm_target
 
 include ../Makefile.ocaml
diff -r 2165316f8c38 examples/BrainF/Makefile
--- a/examples/BrainF/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/examples/BrainF/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -10,6 +10,6 @@
 TOOLNAME = BrainF
 EXAMPLE_TOOL = 1
 
-LINK_COMPONENTS := jit bitwriter nativecodegen interpreter
+LINK_COMPONENTS := executionengine bitcode codegen
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 examples/Fibonacci/Makefile
--- a/examples/Fibonacci/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/examples/Fibonacci/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -12,6 +12,6 @@
 EXAMPLE_TOOL = 1
 
 # Link in JIT support
-LINK_COMPONENTS := jit interpreter nativecodegen
+LINK_COMPONENTS := executionengine nativecodegen
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 examples/HowToUseJIT/Makefile
--- a/examples/HowToUseJIT/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/examples/HowToUseJIT/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -10,6 +10,6 @@
 TOOLNAME = HowToUseJIT
 EXAMPLE_TOOL = 1
 
-LINK_COMPONENTS := jit interpreter nativecodegen
+LINK_COMPONENTS := executionengine codegen
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 examples/ModuleMaker/Makefile
--- a/examples/ModuleMaker/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/examples/ModuleMaker/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,6 +9,6 @@
 LEVEL=../..
 TOOLNAME=ModuleMaker
 EXAMPLE_TOOL = 1
-LINK_COMPONENTS := bitwriter
+LINK_COMPONENTS := bitcode
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 examples/ParallelJIT/Makefile
--- a/examples/ParallelJIT/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/examples/ParallelJIT/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -10,7 +10,7 @@
 TOOLNAME = ParallelJIT
 EXAMPLE_TOOL = 1
 
-LINK_COMPONENTS := jit interpreter nativecodegen
+LINK_COMPONENTS := executionengine codegen
 
 include $(LEVEL)/Makefile.common
 
diff -r 2165316f8c38 include/llvm/Config/config.h.in
--- a/include/llvm/Config/config.h.in	Sun Nov 23 19:22:48 2008 +0000
+++ b/include/llvm/Config/config.h.in	Mon Nov 24 05:21:26 2008 +0100
@@ -1,5 +1,8 @@
 /* include/llvm/Config/config.h.in.  Generated from autoconf/configure.ac by autoheader.  */
 
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
 /* Define if dlopen(0) will open the symbols of the program */
 #undef CAN_DLOPEN_SELF
 
@@ -27,9 +30,15 @@
    */
 #undef HAVE_ALLOCA_H
 
+/* Define to 1 if you have the `argz_add' function. */
+#undef HAVE_ARGZ_ADD
+
 /* Define to 1 if you have the `argz_append' function. */
 #undef HAVE_ARGZ_APPEND
 
+/* Define to 1 if you have the `argz_count' function. */
+#undef HAVE_ARGZ_COUNT
+
 /* Define to 1 if you have the `argz_create_sep' function. */
 #undef HAVE_ARGZ_CREATE_SEP
 
@@ -45,15 +54,9 @@
 /* Define to 1 if you have the `argz_stringify' function. */
 #undef HAVE_ARGZ_STRINGIFY
 
-/* Define to 1 if you have the <assert.h> header file. */
-#undef HAVE_ASSERT_H
-
 /* Define to 1 if you have the `backtrace' function. */
 #undef HAVE_BACKTRACE
 
-/* Define to 1 if you have the `bcopy' function. */
-#undef HAVE_BCOPY
-
 /* Does not have bi-directional iterator */
 #undef HAVE_BI_ITERATOR
 
@@ -63,8 +66,9 @@
 /* Define to 1 if you have the `closedir' function. */
 #undef HAVE_CLOSEDIR
 
-/* Define to 1 if you have the <ctype.h> header file. */
-#undef HAVE_CTYPE_H
+/* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if
+   you don't. */
+#undef HAVE_DECL_CYGWIN_CONV_PATH
 
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
@@ -97,9 +101,6 @@
 /* Define if you have the _dyld_func_lookup function. */
 #undef HAVE_DYLD
 
-/* Define to 1 if you have the <errno.h> header file. */
-#undef HAVE_ERRNO_H
-
 /* Define to 1 if the system has the type `error_t'. */
 #undef HAVE_ERROR_T
 
@@ -154,9 +155,6 @@
 /* Define if the gv program is available */
 #undef HAVE_GV
 
-/* Define to 1 if you have the `index' function. */
-#undef HAVE_INDEX
-
 /* Define to 1 if the system has the type `int64_t'. */
 #undef HAVE_INT64_T
 
@@ -181,6 +179,9 @@
 /* Define if you have the libdl library or equivalent. */
 #undef HAVE_LIBDL
 
+/* Define if libdlloader will be built on this platform */
+#undef HAVE_LIBDLLOADER
+
 /* Define to 1 if you have the `elf' library (-lelf). */
 #undef HAVE_LIBELF
 
@@ -212,6 +213,9 @@
 /* Define to 1 if you have the `longjmp' function. */
 #undef HAVE_LONGJMP
 
+/* Define this if a modern libltdl is already installed */
+#undef HAVE_LTDL
+
 /* Define to 1 if you have the <mach/mach.h> header file. */
 #undef HAVE_MACH_MACH_H
 
@@ -230,12 +234,6 @@
 /* Define to 1 if you have the `malloc_zone_statistics' function. */
 #undef HAVE_MALLOC_ZONE_STATISTICS
 
-/* Define to 1 if you have the `memcpy' function. */
-#undef HAVE_MEMCPY
-
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -294,9 +292,6 @@
 /* Define to 1 if you have the `realpath' function. */
 #undef HAVE_REALPATH
 
-/* Define to 1 if you have the `rindex' function. */
-#undef HAVE_RINDEX
-
 /* Define to 1 if you have the `rintf' function. */
 #undef HAVE_RINTF
 
@@ -333,9 +328,6 @@
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
-/* Define to 1 if you have the <stdio.h> header file. */
-#undef HAVE_STDIO_H
-
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
@@ -354,12 +346,6 @@
 /* Does not have std namespace iterator */
 #undef HAVE_STD_ITERATOR
 
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
-/* Define to 1 if you have the `strcmp' function. */
-#undef HAVE_STRCMP
-
 /* Define to 1 if you have the `strdup' function. */
 #undef HAVE_STRDUP
 
@@ -375,8 +361,11 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
-/* Define to 1 if you have the `strrchr' function. */
-#undef HAVE_STRRCHR
+/* Define to 1 if you have the `strlcat' function. */
+#undef HAVE_STRLCAT
+
+/* Define to 1 if you have the `strlcpy' function. */
+#undef HAVE_STRLCPY
 
 /* Define to 1 if you have the `strtof' function. */
 #undef HAVE_STRTOF
@@ -437,6 +426,9 @@
 /* Define to 1 if you have the <windows.h> header file. */
 #undef HAVE_WINDOWS_H
 
+/* This value is set to 1 to indicate that the system argz facility works */
+#undef HAVE_WORKING_ARGZ
+
 /* Define to 1 if you have the `__dso_handle' function. */
 #undef HAVE___DSO_HANDLE
 
@@ -491,22 +483,28 @@
 /* Installation prefix directory */
 #undef LLVM_PREFIX
 
+/* Define this to the file extension of dynamic libraries */
+#undef LLVM_SHARED_LIBRARY_SUFFIX
+
 /* Define if the OS needs help to load dependent libraries for dlopen(). */
 #undef LTDL_DLOPEN_DEPLIBS
 
+/* Define if dlopen(NULL) is able to resolve symbols from the main program. */
+#undef LTDL_DLOPEN_SELF_WORKS
+
+/* Define to the system default library search path. */
+#undef LT_DLSEARCH_PATH
+
+/* Define to the extension used for runtime loadable modules, say, ".so". */
+#undef LT_MODULE_EXT
+
+/* Define to the name of the environment variable that determines the run-time
+   module search path. */
+#undef LT_MODULE_PATH_VAR
+
 /* Define to the sub-directory in which libtool stores uninstalled libraries.
    */
-#undef LTDL_OBJDIR
-
-/* Define to the name of the environment variable that determines the dynamic
-   library search path. */
-#undef LTDL_SHLIBPATH_VAR
-
-/* Define to the extension used for shared libraries, say, ".so". */
-#undef LTDL_SHLIB_EXT
-
-/* Define to the system default library search path. */
-#undef LTDL_SYSSEARCHPATH
+#undef LT_OBJDIR
 
 /* Define if /dev/zero should be used when mapping RWX memory, or undefine if
    its not necessary */
@@ -530,9 +528,6 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* Define as the return type of signal handlers (`int' or `void'). */
-#undef RETSIGTYPE
-
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
    automatically deduced at runtime.
@@ -556,12 +551,24 @@
 /* Define if use udis86 library */
 #undef USE_UDIS86
 
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
+
 /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
    `char[]'. */
 #undef YYTEXT_POINTER
 
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
+/* Define so that glibc/gnulib argp.h does not typedef error_t. */
+#undef __error_t_defined
 
 /* Define to a type to use for `error_t' if it is not otherwise available. */
 #undef error_t
diff -r 2165316f8c38 include/llvm/Transforms/Utils/BasicInliner.h
--- a/include/llvm/Transforms/Utils/BasicInliner.h	Sun Nov 23 19:22:48 2008 +0000
+++ b/include/llvm/Transforms/Utils/BasicInliner.h	Mon Nov 24 05:21:26 2008 +0100
@@ -16,9 +16,12 @@
 #define BASICINLINER_H
 
 #include "llvm/Transforms/Utils/InlineCost.h"
+#include "llvm/Support/CommandLine.h"
 
 namespace llvm {
 
+  extern cl::opt<unsigned> InlineLimit;
+
   class Function;
   class TargetData;
   struct BasicInlinerImpl;
diff -r 2165316f8c38 lib/Analysis/Makefile
--- a/lib/Analysis/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Analysis/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,8 +9,9 @@
 
 LEVEL = ../..
 LIBRARYNAME = LLVMAnalysis
-DIRS = IPA
-BUILD_ARCHIVE = 1
+INCLUDE_DIRS = IPA
+BUILD_LIBRARY = 1
+USEDLIBS = LLVMCore.la
 
 include $(LEVEL)/Makefile.common
 
diff -r 2165316f8c38 lib/Archive/Makefile
--- a/lib/Archive/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Archive/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,9 +9,10 @@
 
 LEVEL = ../..
 LIBRARYNAME = LLVMArchive
+USEDLIBS = LLVMBitcode.la
 
 # We only want an archive so only those modules actually used by a tool are 
 # included.
-BUILD_ARCHIVE := 1
+BUILD_LIBRARY := 1
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 lib/AsmParser/Makefile
--- a/lib/AsmParser/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/AsmParser/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,9 @@
 
 LEVEL = ../..
 LIBRARYNAME := LLVMAsmParser
-BUILD_ARCHIVE = 1
+BUILD_LIBRARY = 1
+
+USEDLIBS := LLVMCore.la
 EXTRA_DIST := llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs
 
 include $(LEVEL)/Makefile.common
@@ -23,4 +25,4 @@
 # Make the object code file for the lexer depend upon the header file generated
 # by the Bison parser.  This prevents the Lexer from being compiled before the
 # header file it needs is built.
-$(ObjDir)/LLLexer.o: $(PROJ_SRC_DIR)/llvmAsmParser.h
+$(ObjDir)/LLLexer.o $(ObjDir)/LLLexer.lo: $(PROJ_SRC_DIR)/llvmAsmParser.h
diff -r 2165316f8c38 lib/Bitcode/Makefile
--- a/lib/Bitcode/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Bitcode/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -8,7 +8,10 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL = ../..
-PARALLEL_DIRS = Reader Writer
+INCLUDE_DIRS = Reader Writer
+LIBRARYNAME = LLVMBitcode
+USEDLIBS = LLVMCore.la
+BUILD_LIBRARY = 1
 
 include $(LEVEL)/Makefile.common
 
diff -r 2165316f8c38 lib/CodeGen/Makefile
--- a/lib/CodeGen/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/CodeGen/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,8 +9,9 @@
 
 LEVEL = ../..
 LIBRARYNAME = LLVMCodeGen
-PARALLEL_DIRS = SelectionDAG AsmPrinter
-BUILD_ARCHIVE = 1
+INCLUDE_DIRS = SelectionDAG AsmPrinter
+BUILD_LIBRARY = 1
+USEDLIBS = LLVMTransforms.la
 
 include $(LEVEL)/Makefile.common
 
diff -r 2165316f8c38 lib/Debugger/Makefile
--- a/lib/Debugger/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Debugger/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -11,6 +11,7 @@
 LIBRARYNAME = LLVMDebugger
 EXTRA_DIST = README.txt
 REQUIRES_EH := 1
-BUILD_ARCHIVE = 1
+BUILD_LIBRARY = 1
+USEDLIBS = LLVMAnalysis.la LLVMBitcode.la
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 lib/ExecutionEngine/Makefile
--- a/lib/ExecutionEngine/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/ExecutionEngine/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -7,7 +7,11 @@
 # 
 ##===----------------------------------------------------------------------===##
 LEVEL = ../..
+
 LIBRARYNAME = LLVMExecutionEngine
-PARALLEL_DIRS = Interpreter JIT
+BUILD_LIBRARY = 1
+USEDLIBS = LLVMTarget.la
+
+INCLUDE_DIRS = Interpreter JIT
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 lib/Linker/Linker.cpp
--- a/lib/Linker/Linker.cpp	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Linker/Linker.cpp	Mon Nov 24 05:21:26 2008 +0100
@@ -139,7 +139,7 @@
 
   // Try the libX.so (or .dylib) form
   FullPath.eraseSuffix();
-  FullPath.appendSuffix(&(LTDL_SHLIB_EXT[1]));
+  FullPath.appendSuffix(&(LLVM_SHARED_LIBRARY_SUFFIX[1]));
   if (FullPath.isDynamicLibrary())  // Native shared library?
     return FullPath;
   if (FullPath.isBitcodeFile())    // .so file containing bitcode?
diff -r 2165316f8c38 lib/Linker/Makefile
--- a/lib/Linker/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Linker/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,8 @@
 
 LEVEL = ../..
 LIBRARYNAME = LLVMLinker
-BUILD_ARCHIVE := 1
+BUILD_LIBRARY := 1
+USEDLIBS = LLVMCore.la LLVMArchive.la
 
 include $(LEVEL)/Makefile.common
 
diff -r 2165316f8c38 lib/Makefile
--- a/lib/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -8,8 +8,8 @@
 ##===----------------------------------------------------------------------===##
 LEVEL = ..
 
-PARALLEL_DIRS = VMCore AsmParser Bitcode Archive Analysis Transforms CodeGen \
-                Target ExecutionEngine Debugger Linker 
+DIRS := VMCore AsmParser Bitcode Archive Analysis Transforms CodeGen Target \
+        ExecutionEngine Debugger Linker
 
 include $(LEVEL)/Makefile.common
 
diff -r 2165316f8c38 lib/Support/Makefile
--- a/lib/Support/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Support/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,8 @@
 
 LEVEL = ../..
 LIBRARYNAME = LLVMSupport
-BUILD_ARCHIVE = 1
+BUILD_LIBRARY = 1
+USEDLIBS = LLVMSystem.la
 
 ## FIXME: This only requires RTTI because tblgen uses it.  Fix that.
 REQUIRES_RTTI = 1
diff -r 2165316f8c38 lib/System/Makefile
--- a/lib/System/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/System/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,7 @@
 
 LEVEL = ../..
 LIBRARYNAME = LLVMSystem
-BUILD_ARCHIVE = 1
+BUILD_LIBRARY = 1
 
 EXTRA_DIST = Unix Win32 README.txt
 
diff -r 2165316f8c38 lib/System/Path.cpp
--- a/lib/System/Path.cpp	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/System/Path.cpp	Mon Nov 24 05:21:26 2008 +0100
@@ -174,7 +174,7 @@
   GetSystemLibraryPaths(LibPaths);
   for (unsigned i = 0; i < LibPaths.size(); ++i) {
     sys::Path FullPath(LibPaths[i]);
-    FullPath.appendComponent("lib" + name + LTDL_SHLIB_EXT);
+    FullPath.appendComponent("lib" + name + LLVM_SHARED_LIBRARY_SUFFIX);
     if (FullPath.isDynamicLibrary())
       return FullPath;
     FullPath.eraseSuffix();
@@ -186,7 +186,7 @@
 }
 
 std::string Path::GetDLLSuffix() {
-  return LTDL_SHLIB_EXT;
+  return LLVM_SHARED_LIBRARY_SUFFIX;
 }
 
 bool
diff -r 2165316f8c38 lib/System/Unix/Alarm.inc
--- a/lib/System/Unix/Alarm.inc	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/System/Unix/Alarm.inc	Mon Nov 24 05:21:26 2008 +0100
@@ -28,12 +28,12 @@
 /// This ensures that they never do.
 static bool NestedSOI = false;
 
-static RETSIGTYPE SigIntHandler(int Sig) {
+static void SigIntHandler(int Sig) {
   AlarmCancelled = true;
   signal(SIGINT, SigIntHandler);
 }
 
-static RETSIGTYPE SigAlarmHandler(int Sig) {
+static void SigAlarmHandler(int Sig) {
   AlarmTriggered = true;
 }
 
diff -r 2165316f8c38 lib/System/Unix/Signals.inc
--- a/lib/System/Unix/Signals.inc	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/System/Unix/Signals.inc	Mon Nov 24 05:21:26 2008 +0100
@@ -74,7 +74,7 @@
 }
 
 // SignalHandler - The signal handler that runs...
-static RETSIGTYPE SignalHandler(int Sig) {
+static void SignalHandler(int Sig) {
   if (FilesToRemove != 0)
     while (!FilesToRemove->empty()) {
       FilesToRemove->back().eraseFromDisk(true);
diff -r 2165316f8c38 lib/Target/Makefile
--- a/lib/Target/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Target/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -8,13 +8,54 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL = ../..
+
+BUILD_LIBRARY = 1
 LIBRARYNAME = LLVMTarget
-BUILD_ARCHIVE = 1
+USEDLIBS = LLVMCodeGen.la
 
-# We include this early so we can access the value of TARGETS_TO_BUILD as the
-# value for PARALLEL_DIRS which must be set before Makefile.rules is included
-include $(LEVEL)/Makefile.config
+COMMON_BUILT_SOURCES =  GenRegisterInfo.h.inc GenRegisterNames.inc \
+                        GenRegisterInfo.inc GenInstrNames.inc \
+                        GenInstrInfo.inc GenAsmWriter.inc \
+                        GenDAGISel.inc
 
-PARALLEL_DIRS := $(TARGETS_TO_BUILD)
+Alpha_BUILT_SOURCES =   AlphaGenCodeEmitter.inc AlphaGenSubtarget.inc
 
-include $(LLVM_SRC_ROOT)/Makefile.rules
+ARM_BUILT_SOURCES =     ARMGenSubtarget.inc ARMGenCodeEmitter.inc
+
+CellSPU_BUILT_SOURCES = SPUGenCodeEmitter.inc SPUGenSubtarget.inc \
+                        SPUGenCallingConv.inc
+
+Mips_BUILT_SOURCES =    MipsGenCallingConv.inc MipsGenSubtarget.inc
+
+PIC16_BUILT_SOURCES =   PIC16GenCallingConv.inc PIC16GenSubtarget.inc
+
+PowerPC_BUILT_SOURCES = PPCGenCodeEmitter.inc PPCGenSubtarget.inc \
+                        PPCGenCallingConv.inc
+
+Sparc_BUILT_SOURCES =   SparcGenSubtarget.inc SparcGenCallingConv.inc
+
+X86_BUILT_SOURCES =     X86GenAsmWriter1.inc X86GenFastISel.inc \
+                        X86GenCallingConv.inc X86GenSubtarget.inc
+
+XCore_BUILT_SOURCES =   XCoreGenCallingConv.inc XCoreGenSubtarget.inc
+
+# Filter out virtual targets, expanded lazily
+TARGETS = $(filter-out CppBackend CBackend MSIL, $(TARGETS_TO_BUILD))
+
+# Include target directories as well as their assembly printers
+INCLUDE_DIRS = \
+    $(foreach t, $(TARGETS_TO_BUILD), $t $(t:%=%/AsmPrinter))
+
+# Function to substitute the abbreviated target names used in filenames
+FIX_TARGET = $(strip \
+    $(if $(filter PowerPC, $1), PPC, $(if $(filter CellSPU, $1), SPU, $1)))
+
+# Built sources, expanded lazily
+BUILT_SOURCES = $(foreach t, $(TARGETS), $(patsubst %,$t/%, \
+    $(COMMON_BUILT_SOURCES:%=$(call FIX_TARGET,$t)%) $($t_BUILT_SOURCES)))
+
+include $(LEVEL)/Makefile.common
+
+$(ObjDir)/CBackend/CBackend.o $(ObjDir)/CBackend/CBackend.lo \
+$(ObjDir)/CppBackend/CPPBackend.o $(ObjDir)/CppBackend/CPPBackend.lo: \
+CompileCommonOpts += -Wno-format
diff -r 2165316f8c38 lib/Transforms/IPO/Inliner.cpp
--- a/lib/Transforms/IPO/Inliner.cpp	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Transforms/IPO/Inliner.cpp	Mon Nov 24 05:21:26 2008 +0100
@@ -20,6 +20,7 @@
 #include "llvm/Support/CallSite.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Transforms/IPO/InlinerPass.h"
+#include "llvm/Transforms/Utils/BasicInliner.h"
 #include "llvm/Transforms/Utils/Cloning.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
@@ -30,10 +31,6 @@
 STATISTIC(NumInlined, "Number of functions inlined");
 STATISTIC(NumDeleted, "Number of functions deleted because all callers found");
 
-static cl::opt<int>
-InlineLimit("inline-threshold", cl::Hidden, cl::init(200),
-        cl::desc("Control the amount of inlining to perform (default = 200)"));
-
 Inliner::Inliner(void *ID) 
   : CallGraphSCCPass(ID), InlineThreshold(InlineLimit) {}
 
diff -r 2165316f8c38 lib/Transforms/Makefile
--- a/lib/Transforms/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Transforms/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -8,7 +8,9 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL = ../..
-PARALLEL_DIRS = Utils Instrumentation Scalar IPO Hello
+INCLUDE_DIRS = Utils Instrumentation Scalar IPO Hello
+LIBRARYNAME = LLVMTransforms
+BUILD_LIBRARY = 1
+USEDLIBS = LLVMAnalysis.la
 
 include $(LEVEL)/Makefile.common
-
diff -r 2165316f8c38 lib/Transforms/Utils/BasicInliner.cpp
--- a/lib/Transforms/Utils/BasicInliner.cpp	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/Transforms/Utils/BasicInliner.cpp	Mon Nov 24 05:21:26 2008 +0100
@@ -26,11 +26,12 @@
 
 using namespace llvm;
 
-static cl::opt<unsigned>     
-BasicInlineThreshold("inline-threshold", cl::Hidden, cl::init(200),
-   cl::desc("Control the amount of basic inlining to perform (default = 200)"));
+namespace llvm {
 
-namespace llvm {
+  cl::opt<unsigned>
+  InlineLimit("inline-threshold", cl::Hidden, cl::init(200),
+              cl::desc("Control the amount of basic inlining to perform "
+                       "(default = 200)"));
 
   /// BasicInlinerImpl - BasicInliner implemantation class. This hides
   /// container info, used by basic inliner, from public interface.
@@ -118,7 +119,7 @@
         } else {
           int Cost = IC.getValue();
           
-          if (Cost >= (int) BasicInlineThreshold) {
+          if (Cost >= (int) InlineLimit) {
             DOUT << "  NOT Inlining: cost = " << Cost
                  << ", call: " <<  *CS.getInstruction();
             continue;
diff -r 2165316f8c38 lib/VMCore/Makefile
--- a/lib/VMCore/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/lib/VMCore/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -8,7 +8,9 @@
 ##===----------------------------------------------------------------------===##
 LEVEL = ../..
 LIBRARYNAME = LLVMCore
-BUILD_ARCHIVE = 1
+INCLUDE_DIRS = Target
+USEDLIBS = LLVMSupport.la
+BUILD_LIBRARY = 1
 
 BUILT_SOURCES = $(PROJ_OBJ_ROOT)/include/llvm/Intrinsics.gen
 
diff -r 2165316f8c38 projects/sample/Makefile.common.in
--- a/projects/sample/Makefile.common.in	Sun Nov 23 19:22:48 2008 +0000
+++ b/projects/sample/Makefile.common.in	Mon Nov 24 05:21:26 2008 +0100
@@ -1,3 +1,12 @@
+#===-- Makefile.common - Common make rules for Sample ------*- Makefile -*--===#
+# 
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+# 
+#===------------------------------------------------------------------------===#
+
 # Set the name of the project here
 PROJECT_NAME := sample
 PROJ_VERSION := 0.9
@@ -13,7 +22,7 @@
 PROJ_SRC_ROOT := $(subst //,/,@abs_top_srcdir@)
 
 # Set the root directory of this project's object files
-PROJ_OBJ_ROOT := $(subst //,/,@abs_top_objdir@)
+PROJ_OBJ_ROOT := $(subst //,/,@abs_top_builddir@)
 
 # Set the root directory of this project's install prefix
 PROJ_INSTALL_ROOT := @prefix@
diff -r 2165316f8c38 projects/sample/lib/sample/Makefile
--- a/projects/sample/lib/sample/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/projects/sample/lib/sample/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,8 +9,7 @@
 # Give the name of a library.  This will build a dynamic version.
 #
 LIBRARYNAME=sample
-DONT_BUILD_RELINKED=1
-BUILD_ARCHIVE=1
+BUILD_LIBRARY=1
 
 #
 # Include Makefile.common so we know what to do.
diff -r 2165316f8c38 projects/sample/tools/sample/Makefile
--- a/projects/sample/tools/sample/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/projects/sample/tools/sample/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -14,7 +14,7 @@
 # List libraries that we'll need
 # We use LIBS because sample is a dynamic library.
 #
-USEDLIBS = sample.a
+USEDLIBS = sample.la
 
 #
 # Include Makefile.common so we know what to do.
diff -r 2165316f8c38 runtime/GC/Makefile
--- a/runtime/GC/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/runtime/GC/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -12,7 +12,7 @@
 EXTRA_DIST := gc_exported_symbols.lst
 include $(LEVEL)/Makefile.common
 
-# Install target for libraries: Copy into $LLVMGCCDIR/bytecode-libs
+# Install target for libraries: Copy into $LLVMGCCDIR/bitcode-libs
 #
 install::
 
diff -r 2165316f8c38 runtime/GC/SemiSpace/Makefile
--- a/runtime/GC/SemiSpace/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/runtime/GC/SemiSpace/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -8,9 +8,9 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL = ../../..
-BYTECODE_LIBRARY = 1
+BITCODE_LIBRARY = 1
 LIBRARYNAME = gcsemispace
-BYTECODE_DESTINATION = $(CFERuntimeLibDir)
+BITCODE_DESTINATION = $(CFERuntimeLibDir)
 EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/../gc_exported_symbols.lst
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 runtime/Makefile
--- a/runtime/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/runtime/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -29,7 +29,7 @@
 
 include $(LEVEL)/Makefile.common
 
-# Install target for libraries: Copy into $LLVMGCCDIR/bytecode-libs
+# Install target for libraries: Copy into $LLVMGCCDIR/bitcode-libs
 #
 install::
 
diff -r 2165316f8c38 runtime/libprofile/Makefile
--- a/runtime/libprofile/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/runtime/libprofile/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -8,12 +8,12 @@
 ##===----------------------------------------------------------------------===##
 
 LEVEL = ../..
-BYTECODE_LIBRARY = 1
+BITCODE_LIBRARY = 1
 SHARED_LIBRARY = 1
 LOADABLE_MODULE = 1
 LIBRARYNAME = profile_rt
 EXTRA_DIST = exported_symbols.lst
 EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/exported_symbols.lst
-BYTECODE_DESTINATION = $(CFERuntimeLibDir)
+BITCODE_DESTINATION = $(CFERuntimeLibDir)
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/Makefile
--- a/tools/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -17,7 +17,7 @@
                  llvm-ld llvm-prof llvm-link \
 		 lli gccas gccld llvm-extract llvm-db \
 		 bugpoint llvm-bcanalyzer llvm-stub llvmc2
-
+OPTIONAL_DIRS := clang
 
 include $(LEVEL)/Makefile.config
 
diff -r 2165316f8c38 tools/bugpoint/Makefile
--- a/tools/bugpoint/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/bugpoint/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -10,8 +10,7 @@
 
 TOOLNAME = bugpoint
 
-LINK_COMPONENTS := asmparser instrumentation scalaropts ipo \
-                   linker bitreader bitwriter
+LINK_COMPONENTS := asmparser transforms linker bitcode
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/bugpoint/ToolRunner.cpp
--- a/tools/bugpoint/ToolRunner.cpp	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/bugpoint/ToolRunner.cpp	Mon Nov 24 05:21:26 2008 +0100
@@ -652,7 +652,7 @@
 int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
                           std::string &OutputFile,
                           const std::vector<std::string> &ArgsForGCC) {
-  sys::Path uniqueFilename(InputFile+LTDL_SHLIB_EXT);
+  sys::Path uniqueFilename(InputFile+LLVM_SHARED_LIBRARY_SUFFIX);
   std::string ErrMsg;
   if (uniqueFilename.makeUnique(true, &ErrMsg)) {
     std::cerr << "Error making unique filename: " << ErrMsg << "\n";
diff -r 2165316f8c38 tools/llc/Makefile
--- a/tools/llc/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llc/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -15,7 +15,7 @@
 # early so we can set up LINK_COMPONENTS before including Makefile.rules
 include $(LEVEL)/Makefile.config
 
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) bitreader
+LINK_COMPONENTS := target bitcode
 
 include $(LLVM_SRC_ROOT)/Makefile.rules
 
diff -r 2165316f8c38 tools/llc/llc.cpp
--- a/tools/llc/llc.cpp	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llc/llc.cpp	Mon Nov 24 05:21:26 2008 +0100
@@ -160,7 +160,7 @@
     Binary = true;
     break;
   case TargetMachine::DynamicLibrary:
-    OutputFilename += LTDL_SHLIB_EXT;
+    OutputFilename += LLVM_SHARED_LIBRARY_SUFFIX;
     Binary = true;
     break;
   }
diff -r 2165316f8c38 tools/lli/Makefile
--- a/tools/lli/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/lli/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,7 @@
 
 LEVEL    := ../..
 TOOLNAME := lli
-LINK_COMPONENTS := jit interpreter nativecodegen bitreader selectiondag
+LINK_COMPONENTS := executionengine codegen bitcode
 
 # Enable JIT support
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/lli/lli.cpp
--- a/tools/lli/lli.cpp	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/lli/lli.cpp	Mon Nov 24 05:21:26 2008 +0100
@@ -25,6 +25,7 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Process.h"
 #include "llvm/System/Signals.h"
 #include <iostream>
@@ -70,6 +71,11 @@
   NoLazyCompilation("disable-lazy-compilation",
                   cl::desc("Disable JIT lazy compilation"),
                   cl::init(false));
+
+  cl::opt<std::string>
+  DumpFileName("dump",
+               cl::desc("Specify a file for dumping the executed module"),
+               cl::value_desc("filename"));
 }
 
 static ExecutionEngine *EE = 0;
@@ -192,4 +198,18 @@
     std::cerr << "ERROR: exit defined with wrong prototype!\n";
     abort();
   }
+
+  if (!DumpFileName.empty()) {
+    std::string error;
+    std::cerr << "Dumping bitcode to " << DumpFileName << std::endl;
+
+    raw_fd_ostream out(DumpFileName.c_str(), true, error);
+
+    if (!error.empty()) {
+      std::cerr << "ERROR: failed to dump executable:" << error << std::endl;
+      abort();
+    }
+
+    WriteBitcodeToFile(MP->getModule(), out);
+  }
 }
diff -r 2165316f8c38 tools/llvm-as/Makefile
--- a/tools/llvm-as/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-as/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,7 @@
 
 LEVEL = ../..
 TOOLNAME = llvm-as
-LINK_COMPONENTS := asmparser bitwriter
+LINK_COMPONENTS := asmparser bitcode
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvm-bcanalyzer/Makefile
--- a/tools/llvm-bcanalyzer/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-bcanalyzer/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-bcanalyzer
-LINK_COMPONENTS := bitreader
+LINK_COMPONENTS := bitcode
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvm-config/Makefile
--- a/tools/llvm-config/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-config/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -34,9 +34,12 @@
 LibDepsTemp  = $(PROJ_OBJ_DIR)/LibDeps.txt.tmp
 GenLibDeps   = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl
 
-$(LibDepsTemp): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o)
+$(LibDepsTemp): $(wildcard $(foreach f,.a .o .la $(SHLIBEXT),$(LibDir)/*$s))
+$(LibDepsTemp): $(GenLibDeps) $(LibDir)
 	$(Echo) "Regenerating LibDeps.txt.tmp"
-	$(Verb) $(PERL) $(GenLibDeps) -flat $(LibDir) "$(NM_PATH)" > $(LibDepsTemp)
+	$(Verb) $(PERL) $(GenLibDeps) \
+	  -shlibext "$(SHLIBEXT)" -flat $(LibDir)$(LIBTOOL_OBJDIR:%=/%) \
+	  "$(NM_PATH)" > $(LibDepsTemp)
 
 $(LibDeps): $(LibDepsTemp)
 	$(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \
diff -r 2165316f8c38 tools/llvm-config/llvm-config.in.in
--- a/tools/llvm-config/llvm-config.in.in	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-config/llvm-config.in.in	Mon Nov 24 05:21:26 2008 +0100
@@ -222,7 +222,7 @@
     my @result;
     foreach my $lib (@libs) {
         # Transform the bare library name appropriately.
-        my ($basename) = ($lib =~ /^lib([^.]*)\.a/);
+        my ($basename) = ($lib =~ /^lib([^.]*)(\.a|\@SHLIBEXT@)/);
         if (defined $basename) {
             push @result, "-l$basename";
         } else {
diff -r 2165316f8c38 tools/llvm-dis/Makefile
--- a/tools/llvm-dis/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-dis/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-dis
-LINK_COMPONENTS := bitreader
+LINK_COMPONENTS := bitcode
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvm-extract/Makefile
--- a/tools/llvm-extract/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-extract/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -10,6 +10,6 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-extract
-LINK_COMPONENTS := ipo bitreader bitwriter
+LINK_COMPONENTS := transforms bitcode
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvm-ld/Makefile
--- a/tools/llvm-ld/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-ld/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -10,7 +10,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-ld
-LINK_COMPONENTS = ipo scalaropts linker archive bitwriter
+LINK_COMPONENTS = transforms linker archive bitcode
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvm-link/Makefile
--- a/tools/llvm-link/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-link/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,6 +9,6 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-link
-LINK_COMPONENTS = linker bitreader bitwriter
+LINK_COMPONENTS = linker bitcode
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvm-nm/Makefile
--- a/tools/llvm-nm/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-nm/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,6 +9,6 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-nm
-LINK_COMPONENTS = archive bitreader
+LINK_COMPONENTS = archive bitcode
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvm-prof/Makefile
--- a/tools/llvm-prof/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvm-prof/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-prof
-LINK_COMPONENTS = bitreader analysis
+LINK_COMPONENTS = bitcode analysis
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvmc2/driver/Makefile
--- a/tools/llvmc2/driver/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvmc2/driver/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -12,8 +12,8 @@
 LINK_COMPONENTS = support system
 REQUIRES_EH := 1
 
-ifneq ($(BUILTIN_PLUGINS),)
-USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS))
-endif
+USEDLIBS = $(if $(BUILTIN_PLUGINS), $(patsubst %,LLVMC%.a,$(BUILTIN_PLUGINS)))
+
+CPPFLAGS += -I $(LLVM_SRC_ROOT)/tools/llvmc2/include
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 tools/llvmc2/plugins/Makefile
--- a/tools/llvmc2/plugins/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/llvmc2/plugins/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -26,6 +26,9 @@
 
 ifndef BUILTIN_LLVMC_PLUGIN
 LOADABLE_MODULE = 1
+else
+BUILD_ARCHIVE = 1
+NO_INSTALL = 1
 endif
 
 ifneq ($(BUILT_SOURCES),)
diff -r 2165316f8c38 tools/lto/LTOCodeGenerator.h
--- a/tools/lto/LTOCodeGenerator.h	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/lto/LTOCodeGenerator.h	Mon Nov 24 05:21:26 2008 +0100
@@ -16,6 +16,7 @@
 #define LTO_CODE_GENERATOR_H
 
 #include "llvm/Linker.h"
+#include "llvm/Type.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/SmallVector.h"
 
@@ -26,7 +27,6 @@
 // C++ class which implements the opaque lto_code_gen_t
 //
 
-class llvm::raw_ostream;
 class LTOCodeGenerator {
 public:
     static const char*        getVersionString();
diff -r 2165316f8c38 tools/lto/Makefile
--- a/tools/lto/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/lto/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -15,16 +15,14 @@
 # early so we can set up LINK_COMPONENTS before including Makefile.rules
 include $(LEVEL)/Makefile.config
 
-LINK_LIBS_IN_SHARED = 1
 ifeq ($(OS),Darwin)
   SHARED_LIBRARY = 1
-  BUILD_ARCHIVE = 0
   DONT_BUILD_RELINKED = 1
 else
-  BUILD_ARCHIVE = 1
+  BUILD_LIBRARY = 1
 endif
 
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader bitwriter
+LINK_COMPONENTS := target transforms linker bitcode
 
 include $(LEVEL)/Makefile.common
 
@@ -39,9 +37,13 @@
     LLVMLibsOptions    := $(LLVMLibsOptions)  \
                          -no-undefined  -avoid-version \
                          -Wl,-exported_symbols_list -Wl,$(PROJ_SRC_DIR)/lto.exports \
-                         -Wl,-dead_strip \
                          -Wl,-seg1addr -Wl,0xE0000000 
 
+# Doesn't work with link-time optimization...
+    ifndef USE_LTO
+        LLVMLibsOptions += -Wl,-dead_strip
+    endif
+
     # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
     ifneq ($(DARWIN_VERS),8)
diff -r 2165316f8c38 tools/opt/Makefile
--- a/tools/opt/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/tools/opt/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -10,6 +10,6 @@
 TOOLNAME = opt
 REQUIRES_EH := 1
 
-LINK_COMPONENTS := bitreader bitwriter instrumentation scalaropts ipo
+LINK_COMPONENTS := bitcode transforms
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 utils/GenLibDeps.pl
--- a/utils/GenLibDeps.pl	Sun Nov 23 19:22:48 2008 +0000
+++ b/utils/GenLibDeps.pl	Mon Nov 24 05:21:26 2008 +0100
@@ -13,11 +13,13 @@
 # Parse arguments... 
 my $FLAT = 0;
 my $WHY = 0;
+my $SHLIBEXT = '.so';
 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
   shift;
   last if /^--$/;  # Stop processing arguments on --
 
   # List command line options here...
+  if (/^-shlibext$/) { $SHLIBEXT = $ARGV[0]; shift; next; }
   if (/^-flat$/)     { $FLAT = 1; next; }
   if (/^-why/)       { $WHY = 1; $FLAT = 1; next; }
   print "Unknown option: $_ : ignoring!\n";
@@ -48,7 +50,7 @@
 opendir DIR,$Directory;
 my @files = readdir DIR;
 closedir DIR;
-my @libs = grep(/libLLVM.*\.(dylib|so|a)$/,sort(@files));
+my @libs = grep(/libLLVM[^.]*(\.a|$SHLIBEXT)$/,sort(@files));
 my @objs = grep(/LLVM.*\.o$/,sort(@files));
 
 # Declare the hashes we will use to keep track of the library and object file
@@ -88,7 +90,7 @@
 sub gen_one_entry {
   my $lib = $_[0];
   my $lib_ns = $lib;
-  $lib_ns =~ s/(.*)\.[oa]/$1/;
+  $lib_ns =~ s/(.*)(\.o|\.a|$SHLIBEXT)/$1/;
   if ($FLAT) {
     print "$lib:";
     if ($WHY) { print "\n"; }
@@ -106,7 +108,7 @@
       push(@{$DepLibs{$libdefs{$_}}}, $_);
     } elsif (defined($objdefs{$_}) && $objdefs{$_} ne $lib) {
       my $libroot = $lib;
-      $libroot =~ s/lib(.*).a/$1/;
+      $libroot =~ s/lib(.*)(.a|$SHLIBEXT)/$1/;
       if ($objdefs{$_} ne "$libroot.o") {
         $DepLibs{$objdefs{$_}} = [] unless exists $DepLibs{$objdefs{$_}};
         push(@{$DepLibs{$objdefs{$_}}}, $_);
@@ -131,7 +133,7 @@
         push(@{$DepLibs{$libdefs{$_}}}, $_);
       } elsif (defined($objdefs{$_}) && $objdefs{$_} ne $lib) {
         my $libroot = $lib;
-        $libroot =~ s/lib(.*).a/$1/;
+        $libroot =~ s/lib(.*)(.a)/$1/;
         if ($objdefs{$_} ne "$libroot.o") {
           $DepLibs{$objdefs{$_}} = [] unless exists $DepLibs{$objdefs{$_}};
           push(@{$DepLibs{$objdefs{$_}}}, $_);
@@ -154,7 +156,7 @@
       print "    <li>$key</li>\n";
     }
     my $suffix = substr($key,length($key)-1,1);
-    $key =~ s/(.*)\.[oa]/$1/;
+    $key =~ s/(.*)(\.o|\.a|$SHLIBEXT)/$1/;
     if ($suffix eq "a") {
       if (!$FLAT) { print DOT "$lib_ns -> $key [ weight=0 ];\n" };
     } else {
diff -r 2165316f8c38 utils/TableGen/Makefile
--- a/utils/TableGen/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/utils/TableGen/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -10,7 +10,7 @@
 LEVEL = ../..
 TOOLNAME = tblgen
 NO_INSTALL = 1;
-USEDLIBS = LLVMSupport.a LLVMSystem.a
+USEDLIBS = LLVMSupport.la LLVMSystem.la
 REQUIRES_EH := 1
 REQUIRES_RTTI := 1
 
diff -r 2165316f8c38 utils/fpcmp/Makefile
--- a/utils/fpcmp/Makefile	Sun Nov 23 19:22:48 2008 +0000
+++ b/utils/fpcmp/Makefile	Mon Nov 24 05:21:26 2008 +0100
@@ -9,7 +9,7 @@
 
 LEVEL = ../..
 TOOLNAME = fpcmp
-USEDLIBS = LLVMSupport.a LLVMSystem.a
+USEDLIBS = LLVMSupport.la LLVMSystem.la
 NO_INSTALL = 1
 
 include $(LEVEL)/Makefile.common
diff -r 2165316f8c38 win32/config.h
--- a/win32/config.h	Sun Nov 23 19:22:48 2008 +0000
+++ b/win32/config.h	Mon Nov 24 05:21:26 2008 +0100
@@ -18,7 +18,7 @@
 #define LTDL_DLOPEN_DEPLIBS 1 
 #define LTDL_OBJDIR "_libs" 
 #define LTDL_SHLIBPATH_VAR "PATH" 
-#define LTDL_SHLIB_EXT ".dll" 
+#define LLVM_SHARED_LIBRARY_SUFFIX ".dll" 
 #define LTDL_SYSSEARCHPATH "" 
 #define LLVM_ON_WIN32 1