Index: package/libusb/libusb.mk
===================================================================
--- package/libusb/libusb.mk	(revision 22311)
+++ package/libusb/libusb.mk	(working copy)
@@ -3,80 +3,27 @@
 # libusb
 #
 #############################################################
-LIBUSB_VERSION:=0.1.12
-LIBUSB_PATCH_FILE:=libusb_$(LIBUSB_VERSION)-9.diff.gz
-LIBUSB_SOURCE:=libusb_$(LIBUSB_VERSION).orig.tar.gz
-#LIBUSB_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/libusb/
-LIBUSB_SITE:=$(BR2_DEBIAN_MIRROR)/debian/pool/main/libu/libusb
-LIBUSB_DIR:=$(BUILD_DIR)/libusb-$(LIBUSB_VERSION)
-LIBUSB_CAT:=$(ZCAT)
-LIBUSB_BINARY:=usr/lib/libusb.so
+LIBUSB_VERSION = 0.1.12
+LIBUSB_SOURCE = libusb-$(LIBUSB_VERSION).tar.gz
+#LIBUSB_SOURCE_URL = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/libusb/
+LIBUSB_SOURCE_URL = $(BR2_DEBIAN_MIRROR)/debian/pool/main/libu/libusb
+LIBUSB_AUTORECONF = YES
+LIBUSB_INSTALL_STAGING = YES
+LIBUSB_INSTALL_TARGET = YES
+LIBUSB_INSTALL_STAGING_OPT = DESTDIR=$(STAGING_DIR) LDFLAGS=-L$(STAGING_DIR)/usr/lib install 
+LIBUSB_CONF_OPT = --build=$(GNU_HOST_NAME) --enable-shared --enable-static $(DISABLE_NLS)
+LIBUSB_DEPENDENCIES = uclibc 
 
-ifneq ($(LIBUSB_PATCH_FILE),)
-LIBUSB_PATCH=$(DL_DIR)/$(LIBUSB_PATCH_FILE)
-$(LIBUSB_PATCH):
-	$(WGET) -P $(DL_DIR) $(LIBUSB_SITE)/$(LIBUSB_PATCH_FILE)
-endif
-$(DL_DIR)/$(LIBUSB_SOURCE): $(LIBUSB_PATCH)
-	$(WGET) -P $(DL_DIR) $(LIBUSB_SITE)/$(LIBUSB_SOURCE)
-	touch -c $@
+$(eval $(call AUTOTARGETS,package,libusb))
 
-libusb-source: $(DL_DIR)/$(LIBUSB_SOURCE) $(LIBUSB_PATCH)
-
-libusb-unpacked: $(LIBUSB_DIR)/.unpacked
-$(LIBUSB_DIR)/.unpacked: $(AUTOCONF) $(AUTOMAKE) host-libtool $(DL_DIR)/$(LIBUSB_SOURCE)
-	$(LIBUSB_CAT) $(DL_DIR)/$(LIBUSB_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
-ifneq ($(LIBUSB_PATCH_FILE),)
-	(cd $(LIBUSB_DIR) && $(LIBUSB_CAT) $(LIBUSB_PATCH) | patch -p1)
-endif
-	toolchain/patch-kernel.sh $(LIBUSB_DIR) package/libusb/ libusb-$(LIBUSB_VERSION)\*.patch*
-	$(SED) 's,^all:.*,all:,g' $(LIBUSB_DIR)/tests/Makefile.in
-	$(SED) 's,^install:.*,install:,g' $(LIBUSB_DIR)/tests/Makefile.in
-	$(CONFIG_UPDATE) $(LIBUSB_DIR)
-	cd $(LIBUSB_DIR) && $(AUTORECONF)
-	touch $@
-
-$(LIBUSB_DIR)/.configured: $(LIBUSB_DIR)/.unpacked
-	(cd $(LIBUSB_DIR); rm -rf config.cache; \
-		$(TARGET_CONFIGURE_OPTS) \
-		$(TARGET_CONFIGURE_ARGS) \
-		ac_cv_header_regex_h=no \
-		./configure \
-		--target=$(GNU_TARGET_NAME) \
-		--host=$(GNU_TARGET_NAME) \
-		--build=$(GNU_HOST_NAME) \
-		--prefix=$(STAGING_DIR)/usr \
-		--disable-debug \
-		--disable-build-docs \
-	)
-	touch $@
-
-$(STAGING_DIR)/usr/lib/libusb.so: $(LIBUSB_DIR)/.configured
-	$(MAKE) -C $(LIBUSB_DIR)
-	$(MAKE) -C $(LIBUSB_DIR) install
-
-$(TARGET_DIR)/$(LIBUSB_BINARY): $(STAGING_DIR)/usr/lib/libusb.so
+$(LIBUSB_TARGET_INSTALL_TARGET): $(LIBUSB_TARGET_INSTALL_STAGING)
+	$(call MESSAGE,"Installing to target")
 	cp -dpf $(STAGING_DIR)/usr/lib/libusb*.so* $(TARGET_DIR)/usr/lib/
 	$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libusb*.so*
+	$(Q)touch $@
 
-libusb: uclibc $(TARGET_DIR)/$(LIBUSB_BINARY)
+$(LIBUSB_TARGET_UNINSTALL):
+	$(call MESSAGE,"Uninstalling")
+	rm $(TARGET_DIR)/usr/lib/libusb*.so*
+	$(LIBUSB_MAKE_ENV) $(MAKE) $(LIBUSB_UNINSTALL_STAGING_OPT) -C $(@D)/$(LIBUSB_SUBDIR)
 
-libusb-clean:
-	rm -f $(STAGING_DIR)/bin/libusb-config
-	rm -f $(STAGING_DIR)/usr/includes/usb*.h
-	rm -f $(STAGING_DIR)/lib/libusb*
-	rm -rf $(STAGING_DIR)/lib/pkgconfig
-	rm -f $(TARGET_DIR)/usr/lib/libusb*
-	-$(MAKE) -C $(LIBUSB_DIR) clean
-
-libusb-dirclean:
-	rm -rf $(LIBUSB_DIR)
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(strip $(BR2_PACKAGE_LIBUSB)),y)
-TARGETS+=libusb
-endif
