-#STRIP:=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
-STRIP:=$(STAGING_DIR)/bin/sstrip
-PATCH=$(SCRIPT_DIR)/patch-kernel.sh
-SED:=$(STAGING_DIR)/bin/sed -i -e
-LINUX_VERSION=2.4.29
-LINUX_DIR:=$(BUILD_DIR)/linux
-LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
-LINUX_KERNEL:=$(BUILD_DIR)/buildroot-kernel
-LINUX_IMAGE:=$(BUILD_DIR)/buildroot-kernel-image
-MODULES_SUBDIR := lib/modules/$(LINUX_VERSION)
-MODULES_DIR := $(BUILD_DIR)/modules/$(MODULES_SUBDIR)
-
-
-HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
- -e 's/sparc.*/sparc/' \
- -e 's/arm.*/arm/g' \
- -e 's/m68k.*/m68k/' \
- -e 's/ppc/powerpc/g' \
- -e 's/v850.*/v850/g' \
- -e 's/sh[234]/sh/' \
- -e 's/mips-.*/mips/' \
- -e 's/mipsel-.*/mipsel/' \
- -e 's/cris.*/cris/' \
- -e 's/i[3-9]86/i386/' \
- )
-GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
-TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
- AR=$(TARGET_CROSS)ar \
- AS=$(TARGET_CROSS)as \
- LD=$(TARGET_CROSS)ld \
- NM=$(TARGET_CROSS)nm \
- CC=$(TARGET_CROSS)gcc \
- GCC=$(TARGET_CROSS)gcc \
- CXX=$(TARGET_CROSS)g++ \
- RANLIB=$(TARGET_CROSS)ranlib
-
-ifeq ($(ENABLE_LOCALE),true)
-DISABLE_NLS:=
+STRIP:=$(STAGING_DIR_HOST)/bin/sstrip
+PATCH:=$(SCRIPT_DIR)/patch-kernel.sh
+SED:=$(STAGING_DIR_HOST)/bin/sed -i -e
+CP:=cp -fpR
+
+INSTALL_BIN:=install -m0755
+INSTALL_DIR:=install -d -m0755
+INSTALL_DATA:=install -m0644
+INSTALL_CONF:=install -m0600
+
+ifneq ($(CONFIG_CCACHE),)
+ # FIXME: move this variable to a better location
+ export CCACHE_DIR=$(STAGING_DIR)/ccache
+ TARGET_CC:= ccache $(TARGET_CC)
+endif
+
+TARGET_CONFIGURE_OPTS:= \
+ AR=$(TARGET_CROSS)ar \
+ AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \
+ LD=$(TARGET_CROSS)ld \
+ NM=$(TARGET_CROSS)nm \
+ CC="$(TARGET_CC)" \
+ GCC="$(TARGET_CC)" \
+ CXX=$(TARGET_CROSS)g++ \
+ RANLIB=$(TARGET_CROSS)ranlib \
+ STRIP=$(TARGET_CROSS)strip \
+ OBJCOPY=$(TARGET_CROSS)objcopy \
+ OBJDUMP=$(TARGET_CROSS)objdump \
+ SIZE=$(TARGET_CROSS)size
+
+# strip an entire directory
+RSTRIP:= \
+ NM="$(TARGET_CROSS)nm" \
+ STRIP="$(STRIP)" \
+ STRIP_KMOD="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" \
+ $(SCRIPT_DIR)/rstrip.sh
+
+ifeq ($(CONFIG_ENABLE_LOCALE),true)
+ DISABLE_NLS:=