+#
+# Copyright (C) 2006-2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+ifneq ($(__rules_inc),1)
+__rules_inc=1
+
+ifeq ($(DUMP),)
+ -include $(TOPDIR)/.config
+endif
+include $(TOPDIR)/include/debug.mk
+include $(TOPDIR)/include/verbose.mk
+
+TMP_DIR:=$(TOPDIR)/tmp
+
+export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
+
+define qstrip
+$(strip $(subst ",,$(1)))
+endef
+#"))
+
+ARCH:=$(call qstrip,$(shell echo $(CONFIG_ARCH) | sed -e 's/i[3-9]86/i386/'))
+BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
+TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
+BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX))
+GCCV:=$(call qstrip,$(CONFIG_GCC_VERSION))
+SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
+
+OPTIMIZE_FOR_CPU:=$(ARCH)
+
+DL_DIR:=$(if $(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(TOPDIR)/dl)
+BIN_DIR:=$(TOPDIR)/bin
+INCLUDE_DIR:=$(TOPDIR)/include
+SCRIPT_DIR:=$(TOPDIR)/scripts
+BUILD_DIR_BASE:=$(TOPDIR)/build_dir
+BUILD_DIR:=$(BUILD_DIR_BASE)/$(ARCH)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX))
+BUILD_DIR_HOST:=$(BUILD_DIR_BASE)/host
+BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/toolchain-$(ARCH)_gcc$(GCCV)
+STAGING_DIR:=$(TOPDIR)/staging_dir/$(ARCH)
+STAGING_DIR_HOST:=$(TOPDIR)/staging_dir/host
+TOOLCHAIN_DIR:=$(TOPDIR)/staging_dir/toolchain-$(ARCH)_gcc$(GCCV)
+PACKAGE_DIR:=$(BIN_DIR)/packages/$(TARGET)
+STAMP_DIR:=$(BUILD_DIR)/stamp
+STAMP_DIR_HOST=$(BUILD_DIR_HOST)/stamp
+TARGET_DIR:=$(BUILD_DIR)/root-$(BOARD)
+IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
+
+ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
+ -include $(TOOLCHAIN_DIR)/info.mk
+ REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
+ GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
+ TARGET_CROSS?=$(OPTIMIZE_FOR_CPU)-linux-uclibc-