sync whiterussian sdk with kamikaze
authorFelix Fietkau <nbd@openwrt.org>
Fri, 2 Feb 2007 02:57:49 +0000 (02:57 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 2 Feb 2007 02:57:49 +0000 (02:57 +0000)
SVN-Revision: 6250

openwrt/package/sdk/files/include/host.mk
openwrt/package/sdk/files/include/image.mk
openwrt/package/sdk/files/include/netfilter.mk
openwrt/package/sdk/files/include/package.mk
openwrt/package/sdk/files/include/prereq.mk
openwrt/package/sdk/files/include/shell.sh
openwrt/package/sdk/files/include/site/arm-linux-uclibc [new file with mode: 0644]
openwrt/package/sdk/files/include/unpack.mk
openwrt/package/sdk/files/include/verbose.mk
openwrt/package/sdk/files/rules.mk

index 3100ce4165a32150d24e3863fa58a49048b1930d..4a434711c3c8649c259cb3826aacb53fd9547c8d 100644 (file)
@@ -5,11 +5,12 @@
 # See /LICENSE for more information.
 #
 
-include $(TOPDIR)/.host.mk
+include $(TMP_DIR)/.host.mk
 
 export TAR
 
-$(TOPDIR)/.host.mk: $(INCLUDE_DIR)/host.mk
+$(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk
+       @mkdir -p $(TMP_DIR)
        @( \
                HOST_OS=`uname`; \
                case "$$HOST_OS" in \
@@ -22,11 +23,12 @@ $(TOPDIR)/.host.mk: $(INCLUDE_DIR)/host.mk
                echo "HOST_OS:=$$HOST_OS" > $@; \
                echo "HOST_ARCH:=$$HOST_ARCH" >> $@; \
                echo "GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@; \
-               TAR=`which gtar`; \
-               [ -n "$$TAR" -a -x "$$TAR" ] || TAR=`which tar`; \
+               TAR=`which gtar 2>/dev/null`; \
+               [ -n "$$TAR" -a -x "$$TAR" ] || TAR=`which tar 2>/dev/null`; \
                echo "TAR:=$$TAR" >> $@; \
-               ZCAT=`which gzcat`; \
-               [ -n "$$ZCAT" -a -x "$$ZCAT" ] || ZCAT=`which zcat`; \
+               ZCAT=`which gzcat 2>/dev/null`; \
+               [ -n "$$ZCAT" -a -x "$$ZCAT" ] || ZCAT=`which zcat 2>/dev/null`; \
                echo "ZCAT:=$$ZCAT" >> $@; \
+               echo "BASH:=$(shell which bash)" >> $@; \
        )
 
index 59204581d011d87ea766dc4d823b0aa841376a5c..4f638f026094b2a4bec81bd716921fbc739a246f 100644 (file)
@@ -4,6 +4,9 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+
+include $(INCLUDE_DIR)/prereq.mk
+include $(INCLUDE_DIR)/kernel.mk
 KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
 
 ifneq ($(CONFIG_BIG_ENDIAN),y)
@@ -53,7 +56,7 @@ ifeq ($(CONFIG_TARGET_ROOTFS_EXT2FS),y)
   E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_FSPART)*1024)))
   
   define Image/mkfs/ext2
-               $(STAGING_DIR)/bin/genext2fs -q -b $(E2SIZE) -I 1500 -d $(BUILD_DIR)/root/ $(KDIR)/root.ext2
+               $(STAGING_DIR)/bin/genext2fs -U -b $(E2SIZE) -I 1500 -d $(BUILD_DIR)/root/ $(KDIR)/root.ext2
                $(call Image/Build,ext2)
   endef
 endif
@@ -72,10 +75,17 @@ define Image/mkfs/prepare
 endef
 
 define BuildImage
-compile:
+download:
+prepare:
+ifneq ($(IB),1)
+  compile: compile-targets
        $(call Build/Compile)
+else
+  compile:
+endif
 
-install:
+ifneq ($(IB),1)
+  install: compile install-targets
        $(call Image/Prepare)
        $(call Image/mkfs/prepare)
        $(call Image/BuildKernel)
@@ -83,17 +93,25 @@ install:
        $(call Image/mkfs/squashfs)
        $(call Image/mkfs/tgz)
        $(call Image/mkfs/ext2)
+else
+  install: compile install-targets
+       $(call Image/BuildKernel)
+       $(call Image/mkfs/jffs2)
+       $(call Image/mkfs/squashfs)
+       $(call Image/mkfs/tgz)
+       $(call Image/mkfs/ext2)
+endif
        
-clean:
+ifneq ($(IB),1)
+  clean: clean-targets
        $(call Build/Clean)
-endef
+else
+  clean:
+endif
 
 compile-targets:
 install-targets:
 clean-targets:
+endef
+
 
-download:
-prepare:
-compile: compile-targets
-install: compile install-targets
-clean: clean-targets
index ba1512e14abcc86ccdd697f37ecb34d96806a422..94699e572fe187162436a6849d1b9f07603fdb68 100644 (file)
@@ -17,6 +17,8 @@ IPT_CONNTRACK-$(CONFIG_IP_NF_TARGET_CONNMARK) += $(P_V4)ipt_CONNMARK
 IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_CONNTRACK) += $(P_V4)ipt_conntrack
 IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_HELPER) += $(P_V4)ipt_helper
 IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_STATE) += $(P_V4)ipt_state
+IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_CONNMARK) += $(P_XT)xt_connmark
+IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += $(P_XT)xt_CONNMARK
 IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_CONNTRACK) += $(P_XT)xt_conntrack
 IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += $(P_XT)xt_helper
 IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_STATE) += $(P_XT)xt_state
@@ -85,6 +87,13 @@ IPT_NAT-$(CONFIG_IP_NF_TARGET_MIRROR) += $(P_V4)ipt_MIRROR
 IPT_NAT-$(CONFIG_IP_NF_TARGET_REDIRECT) += $(P_V4)ipt_REDIRECT
 IPT_NAT-$(CONFIG_IP_NF_TARGET_NETMAP) += $(P_V4)ipt_NETMAP
 
+IPT_NAT_DEFAULT-m :=
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_FTP) += $(P_V4)ip_conntrack_ftp
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_NAT_FTP) += $(P_V4)ip_nat_ftp
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_IRC) += $(P_V4)ip_conntrack_irc
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_NAT_IRC) += $(P_V4)ip_nat_irc
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_TFTP) += $(P_V4)ip_conntrack_tftp
+
 IPT_NAT_EXTRA-m := 
 IPT_NAT_EXTRA-$(CONFIG_IP_NF_AMANDA) += $(P_V4)ip_conntrack_amanda
 IPT_NAT_EXTRA-$(CONFIG_IP_NF_CT_PROTO_GRE) += $(P_V4)ip_conntrack_proto_gre
@@ -102,7 +111,6 @@ IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_SIP) += $(P_V4)ip_nat_sip
 IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += $(P_V4)ip_nat_snmp_basic
 IPT_NAT_EXTRA-$(CONFIG_IP_NF_SIP) += $(P_V4)ip_conntrack_sip
 IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_SIP) += $(P_V4)ip_nat_sip
-IPT_NAT_EXTRA-$(CONFIG_IP_NF_TFTP) += $(P_V4)ip_conntrack_tftp
 
 IPT_QUEUE-m :=
 IPT_QUEUE-$(CONFIG_IP_NF_QUEUE) += $(P_V4)ip_queue
index e1d23c7544e7cbbe5521beda09ee6ed628fb8733..7f29e5f9c9f46c2156bc1c3c975b344a59fcdad6 100644 (file)
@@ -14,23 +14,14 @@ include $(INCLUDE_DIR)/prereq.mk
 include $(INCLUDE_DIR)/host.mk
 include $(INCLUDE_DIR)/unpack.mk
 
+PKG_CONFIG_PATH:=.
 export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
 
-define shvar
-V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
-endef
-
-define shexport
-$(call shvar,$(1))=$$(call $(1))
-export $(call shvar,$(1))
-endef
-
 define Build/DefaultTargets
   ifeq ($(DUMP),)
     ifeq ($(CONFIG_AUTOREBUILD),y)
-      _INFO:=
-      ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) .),$(PKG_BUILD_DIR))
-        _INFO+=$(subst $(TOPDIR)/,,$(PKG_BUILD_DIR))
+      ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) . $(PKG_FILE_DEPEND)),$(PKG_BUILD_DIR))
+        $$(info Forcing package rebuild)
         $(PKG_BUILD_DIR)/.prepared: package-clean
       endif
     endif
@@ -132,7 +123,17 @@ define BuildPackage
   INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
 
   ifdef Package/$(1)/install
-    compile-targets: $$(IPKG_$(1))
+    ifeq ($(CONFIG_PACKAGE_$(1)),y)
+      install-targets: $$(INFO_$(1))
+    endif
+
+    ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER)$(SDK),)
+      compile-targets: $$(IPKG_$(1))
+    else
+      compile-targets: $(1)-disabled
+      $(1)-disabled:
+       @echo "WARNING: skipping $(1) -- package not selected"
+    endif
   endif
 
   ifeq ($(FORCEREBUILD),y)
@@ -142,58 +143,67 @@ define BuildPackage
   IDEPEND_$(1):=$$(strip $$(DEPENDS))
 
   ifneq ($(DUMP),)
-    DUMPINFO += \
+    dumpinfo: dumpinfo-$(1)
+    dumpinfo-$(1): FORCE
+               @$$(DUMPINFO_$(call shvar,$(1)))
+               
+    DUMPINFO_$(call shvar,$(1)) += \
        echo "Package: $(1)"; 
 
     ifneq ($(MENU),)
-      DUMPINFO += \
+      DUMPINFO_$(call shvar,$(1)) += \
        echo "Menu: $(MENU)";
     endif
 
     ifneq ($(SUBMENU),)
-      DUMPINFO += \
+      DUMPINFO_$(call shvar,$(1)) += \
        echo "Submenu: $(SUBMENU)";
       ifneq ($(SUBMENUDEP),)
-        DUMPINFO += \
+        DUMPINFO_$(call shvar,$(1)) += \
          echo "Submenu-Depends: $(SUBMENUDEP)";
       endif
     endif
 
     ifneq ($(DEFAULT),)
-      DUMPINFO += \
+      DUMPINFO_$(call shvar,$(1)) += \
        echo "Default: $(DEFAULT)";
     endif
 
        $(call shexport,Package/$(1)/description)
 
-    DUMPINFO += \
+    DUMPINFO_$(call shvar,$(1)) += \
        if [ "$$$$PREREQ_CHECK" = 1 ]; then echo "Prereq-Check: 1"; fi; \
        echo "Version: $(VERSION)"; \
        echo "Depends: $$(IDEPEND_$(1))"; \
        echo "Provides: $(PROVIDES)"; \
        echo "Build-Depends: $(PKG_BUILD_DEPENDS)"; \
+       echo "Section: $(SECTION)"; \
        echo "Category: $(CATEGORY)"; \
        echo "Title: $(TITLE)"; \
+       echo "Maintainer: $(MAINTAINER)"; \
        if isset $(call shvar,Package/$(1)/description); then \
                echo -n "Description: "; \
                getvar $(call shvar,Package/$(1)/description); \
        else \
-               echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g'; \
+               echo "Description: $(patsubst \\,\\\\,$(DESCRIPTION))" | perl -ne 's/\\/\n/g, print'; \
        fi;
        
     ifneq ($(URL),)
-      DUMPINFO += \
+      DUMPINFO_$(call shvar,$(1)) += \
                echo; \
                echo "$(URL)";
     endif
        
-       DUMPINFO += \
+       DUMPINFO_$(call shvar,$(1)) += \
                echo "@@";
 
        $(call shexport,Package/$(1)/config)
-       DUMPINFO += \
-               if isset $(call shvar,Package/$(1)/config); then echo "Config: "; getvar $(call shvar,Package/$(1)/config); fi; \
-               echo "@@";
+       DUMPINFO_$(call shvar,$(1)) += \
+               if isset $(call shvar,Package/$(1)/config); then \
+                       echo "Config: "; \
+                       getvar $(call shvar,Package/$(1)/config); \
+                       echo "@@"; \
+               fi;
   
   endif
 
@@ -207,11 +217,11 @@ define BuildPackage
        echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
        echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
        ( \
-               DEPENDS=; \
+               DEPENDS='$(EXTRA_DEPENDS)'; \
                for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
                        DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
                done; \
-               echo "Depends: $(EXTRA_DEPENDS) $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \
+               echo "Depends: $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \
        )
        echo "Source: $(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control
        echo "Section: $(SECTION)" >> $$(IDIR_$(1))/CONTROL/control
@@ -249,16 +259,12 @@ define BuildPackage
   $$(eval $$(call Build/DefaultTargets,$(1)))
 
   ifdef Package/$(1)/install
-    ifneq ($$(CONFIG_PACKAGE_$(1)),)
+    ifneq ($$(CONFIG_PACKAGE_$(1))$(DEVELOPER)$(SDK),)
       ifneq ($(MAKECMDGOALS),prereq)
         ifneq ($(DUMP),1)
           ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg -x ipkg-install '$$(IPKG_$(1))' '$(PKG_BUILD_DIR)'),$$(IPKG_$(1)))
-            _INFO+=$(subst $(TOPDIR)/,,$$(IPKG_$(1)))
             $(PKG_BUILD_DIR)/.built: package-rebuild
-          endif
-
-          ifneq ($$(_INFO),)
-            $$(info Rebuilding $$(_INFO))
+            $$(info Rebuilding $(subst $(TOPDIR)/,,$$(IPKG_$(1))))
           endif
         endif
       endif
@@ -287,9 +293,10 @@ define Build/Configure/Default
                CXXFLAGS="$(TARGET_CFLAGS)" \
                CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
                LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
+               PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
                PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
                $(2) \
-               ./configure \
+               $(PKG_CONFIG_PATH)/configure \
                --target=$(GNU_TARGET_NAME) \
                --host=$(GNU_TARGET_NAME) \
                --build=$(GNU_HOST_NAME) \
@@ -316,11 +323,12 @@ define Build/Configure
 endef
 
 define Build/Compile/Default
+       CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \
+       LDFLAGS="$(EXTRA_LDFLAGS) " \
        $(MAKE) -C $(PKG_BUILD_DIR) \
                $(TARGET_CONFIGURE_OPTS) \
                CROSS="$(TARGET_CROSS)" \
-               EXTRA_CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include " \
-               EXTRA_LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib " \
+               CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \
                ARCH="$(ARCH)" \
                $(1);
 endef
@@ -330,8 +338,7 @@ define Build/Compile
 endef
 
 ifneq ($(DUMP),)
-  dumpinfo: FORCE
-       @$(DUMPINFO)
+  dumpinfo:
 else
   $(PACKAGE_DIR):
        mkdir -p $@
index eda7ca35a6977dfae118b0247bf932fc53ded404..41596dcb8b3359d453690ca1720c013621ca31a1 100644 (file)
@@ -5,34 +5,29 @@
 # See /LICENSE for more information.
 #
 
-$(TMP_DIR):
-       mkdir -p $@
-
 prereq:
        if [ -f $(TMP_DIR)/.prereq-error ]; then \
                echo; \
                cat $(TMP_DIR)/.prereq-error; \
+               rm -f $(TMP_DIR)/.prereq-error; \
                echo; \
-               rm -rf $(TMP_DIR); \
                false; \
        fi
-       rm -rf $(TMP_DIR)
-       mkdir -p $(TMP_DIR)
 
-.SILENT: $(TMP_DIR) prereq
+.SILENT: prereq
 
 define Require
   export PREREQ_CHECK=1
   ifeq ($$(CHECK_$(1)),)
     prereq: prereq-$(1)
 
-    prereq-$(1): $(TMP_DIR) FORCE
+    prereq-$(1): FORCE
                echo -n "Checking '$(1)'... "
                if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \
                        echo 'ok.'; \
                else \
                        echo 'failed.'; \
-                       echo -e "$(strip $(2))" >> $(TMP_DIR)/.prereq-error; \
+                       echo -e "$(strip $(2))" | perl -ne 's/\\\s*/\n/g,print' >> $(TMP_DIR)/.prereq-error; \
                fi
 
     check-$(1): FORCE
index 6ee0cf6030ac5e0a71d7be1c2438c58ee9724caf..1e60692b97fffcc1864146345da6b761cbe6c3f7 100644 (file)
@@ -13,3 +13,18 @@ isset() {
        eval "var=\"\${$1}\""
        [ -n "$var" ]
 }
+
+trapret() {(
+       local retvals="$1"; shift
+       local cmd="$1"; shift
+       for retval in $(echo $retvals); do
+               local trap_$retval=1
+       done
+       "$cmd" "$@" || {
+               local retval="$?"
+               eval "trapped=\${trap_$retval}"
+               [ -n "$trapped" ] || {
+                       return $retval
+               }
+       }
+)}
diff --git a/openwrt/package/sdk/files/include/site/arm-linux-uclibc b/openwrt/package/sdk/files/include/site/arm-linux-uclibc
new file mode 100644 (file)
index 0000000..8bd8b78
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
+ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
+
+ac_cv_sizeof___int64=0
+ac_cv_sizeof_char=1
+ac_cv_sizeof_int=4
+ac_cv_sizeof_int16_t=2
+ac_cv_sizeof_int32_t=4
+ac_cv_sizeof_int64_t=8
+ac_cv_sizeof_long_int=4
+ac_cv_sizeof_long_long=8
+ac_cv_sizeof_long=4
+ac_cv_sizeof_off_t=8
+ac_cv_sizeof_short_int=2
+ac_cv_sizeof_short=2
+ac_cv_sizeof_size_t=4
+ac_cv_sizeof_u_int16_t=2
+ac_cv_sizeof_u_int32_t=4
+ac_cv_sizeof_u_int64_t=8
+ac_cv_sizeof_uint16_t=2
+ac_cv_sizeof_uint32_t=4
+ac_cv_sizeof_uint64_t=8
+ac_cv_sizeof_unsigned_int=4
+ac_cv_sizeof_unsigned_long=4
+ac_cv_sizeof_unsigned_short=2
+ac_cv_sizeof_void_p=4
+
+. $TOPDIR/include/site/linux-uclibc
+
index e56f62415206d313b075b170b2fc5f8b92082052..e533476b5276c1b8dd91ba5aae08e1426426ab43 100644 (file)
@@ -1,13 +1,18 @@
 ifeq ($(strip $(PKG_UNPACK)),)
+  ifneq ($(HOST_OS),Linux)
+       HOST_TAR:=trapret 2 $(TAR)
+  else
+    HOST_TAR:=$(TAR)
+  endif
   ifneq ($(strip $(PKG_CAT)),)
     # use existing PKG_CAT
-    PKG_UNPACK:=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
+    PKG_UNPACK:=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
     ifeq ($(PKG_CAT),unzip)
-      PKG_UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
+      PKG_UNPACK:=unzip -d $(PKG_BUILD_DIR)/.. $(DL_DIR)/$(PKG_SOURCE)
     endif
     # replace zcat with $(ZCAT), because some system have it as gzcat
     ifeq ($(PKG_CAT),zcat)
-      PKG_UNPACK:=$(ZCAT) $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
+      PKG_UNPACK:=$(ZCAT) $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
     endif
   else
     # try to autodetect file type
index 34568a31f821f3c8c3b470240ca82971cfcc4511..b4242f212acc512c4d66533932bf86838f374eab 100644 (file)
@@ -18,7 +18,7 @@ ifeq ("$(origin V)", "command line")
   KBUILD_VERBOSE:=$(V)
 endif
 
-ifneq ($(shell tty -s <&3 || echo x),x)
+ifeq ($(IS_TTY),1)
   _Y:="\\33[33m"# yellow
   _N:="\\33[m"#        normal
 endif
index 98d9720c1f528b85df17053483c151921476ff66..42e997859173c1d3c826d05c169755b0fed69ce9 100644 (file)
@@ -9,7 +9,6 @@
 include $(TOPDIR)/include/verbose.mk
 
 export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
-export BASH=$(shell which bash)
 
 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
@@ -30,7 +29,7 @@ BIN_DIR:=$(TOPDIR)/bin
 PACKAGE_DIR:=$(BIN_DIR)/packages
 IPKG_TARGET_DIR:=$(PACKAGE_DIR)
 BUILD_DIR:=$(TOPDIR)/build_$(ARCH)
-TMP_DIR:=$(BUILD_DIR)/tmp
+TMP_DIR:=$(TOPDIR)/tmp
 STAMP_DIR:=$(BUILD_DIR)/stamp
 TARGET_DIR:=$(BUILD_DIR)/root
 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
@@ -43,7 +42,7 @@ endif
 
 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
 
-TARGET_PATH:=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:$(PATH)
+TARGET_PATH:=$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:$(PATH)
 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)
 
 export PATH:=$(TARGET_PATH)
@@ -70,6 +69,10 @@ ifneq ($(CONFIG_CCACHE),)
   TARGET_CC:= ccache $(TARGET_CC)
 endif
 
+EXTRA_CPPFLAGS := -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
+EXTRA_CFLAGS := $(EXTRA_CPPFLAGS)
+EXTRA_LDFLAGS := -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
+
 TARGET_CONFIGURE_OPTS:= \
   AR=$(TARGET_CROSS)ar \
   AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \
@@ -79,7 +82,8 @@ TARGET_CONFIGURE_OPTS:= \
   GCC="$(TARGET_CC)" \
   CXX=$(TARGET_CROSS)g++ \
   RANLIB=$(TARGET_CROSS)ranlib \
-  STRIP=$(TARGET_CROSS)strip
+  STRIP=$(TARGET_CROSS)strip \
+  OBJCOPY=$(TARGET_CROSS)objcopy
 
 # strip an entire directory
 RSTRIP:= \
@@ -116,6 +120,16 @@ else
   TAR_OPTIONS:=-xf -
 endif
 
+define shvar
+V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
+endef
+
+define shexport
+$(call shvar,$(1))=$$(call $(1))
+export $(call shvar,$(1))
+endef
+
+
 all:
 FORCE: ;
 .PHONY: FORCE