--- unstableorigs/binutils-2.23.1/debian/control.cross.in	2012-12-10 15:43:53.000000000 +0000
+++ unstablenew/binutils-2.23.1/debian/control.cross.in	2013-01-03 14:46:13.000000000 +0000
@@ -1,11 +1,11 @@
-Package: binutils-__TARGET__
+Package: binutils-__DEB_TARGET_ARCH__
 Architecture: any
 Depends: binutils, ${shlibs:Depends}
 Suggests: binutils-doc (= ${Source-Version})
 Priority: extra
-Description: GNU binary utilities, for __TARGET__ target
+Description: GNU binary utilities, for __DEB_TARGET_ARCH__ target
  This package provides GNU assembler, linker and binary utilities
- for __TARGET__ target, for use in a cross-compilation environment.
+ for __DEB_TARGET_ARCH__ target, for use in a cross-compilation environment.
  .
  You don't need this package unless you plan to cross-compile programs
- for __TARGET__.
+ for __DEB_TARGET_ARCH__.
--- unstableorigs/binutils-2.23.1/debian/rules	2012-12-10 15:43:53.000000000 +0000
+++ unstablenew/binutils-2.23.1/debian/rules	2013-01-03 14:49:17.000000000 +0000
@@ -53,21 +53,29 @@
 DEB_HOST_GNU_TYPE	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE)
 DEB_HOST_MULTIARCH	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH)
 
-# If $(TARGET) is not set, try reading debian/target
-ifeq (,$(TARGET))
+#---------------------------------------------------------------------------
+# set target
+# - Debian arch or GNU triplet via DEB_TARGET_ARCH
+# - Debian arch or GNU triplet via deprecated TARGET
+# - Debian arch or GNU triplet in debian/target
+
+#Support the old TARGET variable whilst it's still used
+DEB_TARGET_ARCH ?= $(TARGET)
+
+ifeq (,$(DEB_TARGET_ARCH))
   ifneq (,$(wildcard debian/target))
-    TARGET := $(shell cat debian/target 2>/dev/null)
+    DEB_TARGET_ARCH := $(shell cat debian/target 2>/dev/null)
   endif
 endif
 
-ifneq (,$(TARGET))
-  # Support TARGET both as Debian architecture specification (e.g. arm),
+ifneq (,$(DEB_TARGET_ARCH))
+  # Support DEB_TARGET_ARCH both as Debian architecture specification (e.g. arm),
   # and as the target name (e.g. arm-linux-gnu).
-  try_convert := $(shell dpkg-architecture -f -a$(TARGET) -qDEB_HOST_GNU_TYPE 2>/dev/null)
+  try_convert := $(shell dpkg-architecture -f -t$(DEB_TARGET_ARCH) -qDEB_HOST_ARCH 2>/dev/null)
   ifneq ($(try_convert),)
-    override TARGET := $(try_convert)
+    override DEB_TARGET_ARCH := $(try_convert)
   endif
-  DPKG_TARGET_VARS := $(shell dpkg-architecture -f -t$(TARGET))
+  DPKG_TARGET_VARS := $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH))
   DEB_TARGET_MULTIARCH = $(call vafilt,$(DPKG_TARGET_VARS),DEB_HOST_MULTIARCH)
   DEB_TARGET_ARCH      = $(call vafilt,$(DPKG_TARGET_VARS),DEB_HOST_ARCH)
 else
@@ -75,6 +83,11 @@
   DEB_TARGET_ARCH      = $(DEB_HOST_ARCH)
 endif
 
+ifeq ($(DEB_TARGET_ARCH),)
+  $(error Invalid architecure.)
+endif
+
+
 ifeq (,$(DEB_HOST_MULTIARCH))
   ifeq ($(DEB_HOST_ARCH),i386)
     DEB_HOST_MULTIARCH = i386-linux-gnu
@@ -317,7 +330,7 @@
 	-rm -rf debian/patched debian/tmp debian/files* debian/substvars
 	-rm -f debian/*.orig debian/*.rej
 	-rm -rf $(d_cross) debian/files debian/substvars 
-	-rm -rf builddir-$(TARGET) {configure,build,install}-cross-stamp
+	-rm -rf builddir-$(DEB_TARGET_ARCH) {configure,build,install}-cross-stamp
 	for i in debian/*.in; do \
 	    case "$$i" in debian/control*.in) continue; esac; \
 	    rm -f $${i%*.in}; \
@@ -327,16 +340,16 @@
 
 ################################################################################
 
-control-stamp: debian/control.in $(if $(TARGET),debian/control.cross.in)
-ifneq (,$(TARGET))
+control-stamp: debian/control.in $(if $(DEB_TARGET_ARCH),debian/control.cross.in)
+ifneq (,$(DEB_TARGET_ARCH))
 	sed "/^$$/ q" < debian/control.in > debian/control
-	sed -e "s/__TARGET__/$$(echo -n $(TARGET) | sed s/_/-/g)/" \
+	sed -e "s/__DEB_TARGET_ARCH__/$$(echo -n $(DEB_TARGET_ARCH) | sed s/_/-/g)/" \
                  < debian/control.cross.in >> debian/control
 else
 	cp debian/control.in debian/control
 endif
 ifneq (,$(CROSS))
-	sed -e "s/__TARGET__/$$(echo -n $(CROSS) | sed s/_/-/g)/" \
+	sed -e "s/__DEB_TARGET_ARCH__/$$(echo -n $(CROSS) | sed s/_/-/g)/" \
 		< debian/strip.cross.in >> debian/strip.cross
 	chmod 755 debian/strip.cross
 endif
@@ -555,7 +568,7 @@
 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
        build_stamps += build-spu-stamp
 endif
-ifneq (,$(TARGET))
+ifneq (,$(DEB_TARGET_ARCH))
   ifneq (,$(findstring static-cross,$(DEB_BUILD_OPTIONS)))
        build_stamps = build-static-cross-stamp
   else
@@ -587,7 +600,7 @@
 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
        install_stamps += install-spu-stamp
 endif
-ifneq (,$(TARGET))
+ifneq (,$(DEB_TARGET_ARCH))
   ifneq (,$(findstring static-cross,$(DEB_BUILD_OPTIONS)))
         install_stamps = install-static-cross-stamp
   else
@@ -855,7 +868,7 @@
 	rm -f debian/files debian/substvars
 
 # Cross builds do not have documentation packages
-ifeq (,$(TARGET))
+ifeq (,$(DEB_TARGET_ARCH))
 
 	$(install_dir) $(d_doc)/DEBIAN
 
@@ -921,9 +934,9 @@
 	$(checkdir)
 
 ifneq ($(BACKPORT),true)
-# Process the following only if $(TARGET) is set
-ifneq (,$(TARGET))
-	test "" != "$(TARGET)"
+# Process the following only if $(DEB_TARGET_ARCH) is set
+ifneq (,$(DEB_TARGET_ARCH))
+	test "" != "$(DEB_TARGET_ARCH)"
 
 	rm -rf $(d_cross)/$(PF)/share/info $(d_cross)/$(PF)/share/man
 
@@ -1154,7 +1167,7 @@
 	dpkg --build $(d_hppa64) ..
 endif
 
-endif # Process the following only if $(TARGET) is set
+endif # Process the following only if $(DEB_TARGET_ARCH) is set
 endif # ifndef BACKPORT
 ################################################################################
 
@@ -1162,10 +1175,10 @@
 # cross targets #
 #################
 
-# Process the following only if $(TARGET) is set
-ifneq (,$(TARGET))
+# Process the following only if $(DEB_TARGET_ARCH) is set
+ifneq (,$(DEB_TARGET_ARCH))
 
-p_cross = $(subst _,-,binutils-$(TARGET))
+p_cross = $(subst _,-,binutils-$(DEB_TARGET_ARCH))
 d_cross = debian/$(p_cross)
 
 #-----------------------------------------------------------------
@@ -1189,48 +1202,48 @@
 
 configure-cross-stamp: patch-stamp control-stamp
 	$(checkdir)
-	test "" != "$(TARGET)"
-	rm -rf configure-cross-stamp builddir-$(TARGET)
-	mkdir builddir-$(TARGET)
-	cd builddir-$(TARGET) \
+	test "" != "$(DEB_TARGET_ARCH)"
+	rm -rf configure-cross-stamp builddir-$(DEB_TARGET_ARCH)
+	mkdir builddir-$(DEB_TARGET_ARCH)
+	cd builddir-$(DEB_TARGET_ARCH) \
 	    && env CC="$(CC)" CXX="$(CXX)" ../configure \
 		$(CONFARGS) \
-		--target=$(TARGET)
+		--target=$(DEB_TARGET_ARCH)
 	touch $@
 
 build-cross-stamp: configure-cross-stamp
 	$(checkdir)
-	test "" != "$(TARGET)"
-	$(MAKE) -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)"
+	test "" != "$(DEB_TARGET_ARCH)"
+	$(MAKE) -C builddir-$(DEB_TARGET_ARCH) $(NJOBS) CFLAGS="$(CFLAGS)"
 	touch $@
 
 install-cross-stamp: build-cross-stamp
 	$(checkdir)
-	test "" != "$(TARGET)"
+	test "" != "$(DEB_TARGET_ARCH)"
 	rm -rf $(d_cross)
-	$(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/$(PF) \
+	$(MAKE) -C builddir-$(DEB_TARGET_ARCH) prefix=$(pwd)/$(d_cross)/$(PF) \
 		mandir=$(pwd)/$(d_cross)/$(PF)/share/man install
 	rm -rf $(d_cross)/$(PF)/lib* $(d_cross)/$(PF)/info $(d_cross)/$(PF)/share/locale
 
-	$(call strip_package, $(p_cross), $(d_cross),$(DEB_HOST_GNU_TYPE)/$(TARGET))
-	chmod ugo-x $(d_cross)/$(PF)/$(DEB_HOST_GNU_TYPE)/$(TARGET)/lib/*.so
+	$(call strip_package, $(p_cross), $(d_cross),$(DEB_HOST_GNU_TYPE)/$(DEB_TARGET_ARCH))
+	chmod ugo-x $(d_cross)/$(PF)/$(DEB_HOST_GNU_TYPE)/$(DEB_TARGET_ARCH)/lib/*.so
 
 	: # Get rid of .la files since libtool obviously has no idea about transient paths
-	rm -f $(d_cross)/$(PF)/$(DEB_HOST_GNU_TYPE)/$(TARGET)/lib/*.la
+	rm -f $(d_cross)/$(PF)/$(DEB_HOST_GNU_TYPE)/$(DEB_TARGET_ARCH)/lib/*.la
 
 	gzip -9 $(d_cross)/$(PF)/share/man/man1/*
 	touch $@
 
 configure-host-cross-stamp: configure-cross-stamp
 	$(checkdir)
-	test "" != "$(TARGET)"
-	$(MAKE) configure-host -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)"
+	test "" != "$(DEB_TARGET_ARCH)"
+	$(MAKE) configure-host -C builddir-$(DEB_TARGET_ARCH) $(NJOBS) CFLAGS="$(CFLAGS)"
 	touch $@
 
 build-static-cross-stamp: configure-host-cross-stamp
 	$(checkdir)
-	test "" != "$(TARGET)"
-	$(MAKE) -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)" LDFLAGS="-all-static"
+	test "" != "$(DEB_TARGET_ARCH)"
+	$(MAKE) -C builddir-$(DEB_TARGET_ARCH) $(NJOBS) CFLAGS="$(CFLAGS)" LDFLAGS="-all-static"
 	touch $@
 
 install-static-cross-stamp: build-static-cross-stamp install-cross-stamp
@@ -1239,7 +1252,7 @@
 	@echo "Please use dpkg-buildpackage instead of calling binary-cross directly; see README.cross"
 	@false
 
-endif # ifneq ($(TARGET),)
+endif # ifneq ($(DEB_TARGET_ARCH),)
 
 ################################################################################
 
diff -ur unstableorigs/binutils-2.23.1/debian/strip.cross.in unstablenew/binutils-2.23.1/debian/strip.cross.in
--- unstableorigs/binutils-2.23.1/debian/strip.cross.in	2012-12-10 15:43:53.000000000 +0000
+++ unstablenew/binutils-2.23.1/debian/strip.cross.in	2013-01-03 14:44:56.000000000 +0000
@@ -1,3 +1,3 @@
 #! /bin/sh
 
-__TARGET__strip --remove-section=.comment --remove-section=.note $*
+__DEB_TARGET_ARCH__strip --remove-section=.comment --remove-section=.note $*
