-include $(TOPDIR)/.config
-MAKE1=make
-MAKE=make -j$(BR2_JLEVEL)
-
-# Strip off the annoying quoting
-ARCH:=$(strip $(subst ",, $(BR2_ARCH)))
-#"
-WGET:=$(strip $(subst ",, $(BR2_WGET)))
-#"
-
-GCC_VERSION:=$(strip $(subst ",, $(BR2_GCC_VERSION)))
-#"
-GCC_USE_SJLJ_EXCEPTIONS:=$(strip $(subst ",, $(BR2_GCC_USE_SJLJ_EXCEPTIONS)))
-#"
-TARGET_OPTIMIZATION:=$(strip $(subst ",, $(BR2_TARGET_OPTIMIZATION)))
-#""
-
-
-ifeq ($(BR2_SOFT_FLOAT),y)
-# gcc 3.4.x soft float configuration is different than previous versions.
-ifeq ($(findstring 3.4.,$(GCC_VERSION)),3.4.)
-SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
-else
-SOFT_FLOAT_CONFIG_OPTION:=--without-float
-endif
-TARGET_SOFT_FLOAT:=-msoft-float
-ARCH_FPU_SUFFIX:=_nofpu
-else
-SOFT_FLOAT_CONFIG_OPTION:=
-TARGET_SOFT_FLOAT:=
-ARCH_FPU_SUFFIX:=
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+-include $(TOPDIR)/.config
+include $(TOPDIR)/include/verbose.mk
+
+export SHELL=/bin/bash
+
+ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
+TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
+WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
+#"))"))")) # fix vim's broken syntax highlighting
+
+OPTIMIZE_FOR_CPU:=$(ARCH)
+
+# DIRECTORIES #
+
+DL_DIR:=$(TOPDIR)/dl
+INCLUDE_DIR:=$(TOPDIR)/include
+SCRIPT_DIR:=$(TOPDIR)/scripts
+TOOL_BUILD_DIR:=$(TOPDIR)/tool_build
+TOOLCHAIN_BUILD_DIR:=$(TOPDIR)/toolchain_build_$(ARCH)
+STAGING_DIR:=$(TOPDIR)/staging_dir_$(ARCH)
+BIN_DIR:=$(TOPDIR)/bin
+PACKAGE_DIR:=$(BIN_DIR)/packages
+IPKG_TARGET_DIR:=$(PACKAGE_DIR)
+BUILD_DIR:=$(TOPDIR)/build_$(ARCH)
+TMP_DIR:=$(BUILD_DIR)/tmp
+STAMP_DIR:=$(BUILD_DIR)/stamp
+TARGET_DIR:=$(BUILD_DIR)/root
+IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
+
+ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
+ REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
+ GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
+ TARGET_CROSS:=$(OPTIMIZE_FOR_CPU)-linux-uclibc-