X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/c4a54700bcca9c5b05f7277a3025b6a5ee0e4658..d2bbc8b1845fa2c034a7393110336f099c77582f:/openwrt/package/libusb/Makefile diff --git a/openwrt/package/libusb/Makefile b/openwrt/package/libusb/Makefile index c25296527..e6cf4ba2b 100644 --- a/openwrt/package/libusb/Makefile +++ b/openwrt/package/libusb/Makefile @@ -12,21 +12,14 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_CAT:=zcat PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install -PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk -PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg/$(PKG_NAME) -PKG_INFO:=$(IPKG_STATE_DIR)/info/$(PKG_NAME).list +include $(TOPDIR)/package/rules.mk -$(DL_DIR)/$(PKG_SOURCE): - $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL) +$(eval $(call PKG_template,LIBUSB,libusb,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) -$(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE) - $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - - $(PATCH) $(PKG_BUILD_DIR) ./patches - touch $(PKG_BUILD_DIR)/.prepared - -$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared - (cd $(PKG_BUILD_DIR); rm -rf config.cache config.status; \ +$(PKG_BUILD_DIR)/.configured: + (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS="$(TARGET_CFLAGS)" \ CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ @@ -55,35 +48,39 @@ $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared --enable-shared \ --enable-static \ ); - touch $(PKG_BUILD_DIR)/.configured + touch $@ -$(PKG_BUILD_DIR)/.libs/libusb.so: $(PKG_BUILD_DIR)/.configured +$(PKG_BUILD_DIR)/.built: + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) $(MAKE) -C $(PKG_BUILD_DIR) -j1 \ CC=$(TARGET_CC) LD=$(TARGET_CROSS)ld ARCH=$(ARCH) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install + touch $@ -$(STAGING_DIR)/usr/lib/libusb.so: $(PKG_BUILD_DIR)/.libs/libusb.so - mkdir -p $(STAGING_DIR)/usr/lib - mkdir -p $(STAGING_DIR)/usr/include - cp -a $(PKG_BUILD_DIR)/.libs/*.so* $(STAGING_DIR)/usr/lib/ - cp -a $(PKG_BUILD_DIR)/usb.h $(STAGING_DIR)/usr/include/ +$(IPKG_LIBUSB): + install -m0755 -d $(IDIR_LIBUSB)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb*.so.* $(IDIR_LIBUSB)/usr/lib/ + $(RSTRIP) $(IDIR_LIBUSB) + $(IPKG_BUILD) $(IDIR_LIBUSB) $(PACKAGE_DIR) -$(PKG_IPK): $(STAGING_DIR)/usr/lib/libusb.so - $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) - mkdir -p $(PKG_IPK_DIR)/usr/lib - cp -a $(PKG_BUILD_DIR)/.libs/libusb*.so* $(PKG_IPK_DIR)/usr/lib/ - $(STRIP) $(PKG_IPK_DIR)/usr/lib/* - mkdir -p $(PACKAGE_DIR) - $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR) +$(STAGING_DIR)/usr/lib/libusb.so: $(PKG_BUILD_DIR)/.built + mkdir -p $(STAGING_DIR)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/libusb-config $(STAGING_DIR)/usr/bin/ + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/usb.h $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb*.{a,so*} $(STAGING_DIR)/usr/lib/ + touch $@ -$(PKG_INFO): $(PKG_IPK) - $(IPKG) install $(PKG_IPK) +install-dev: $(STAGING_DIR)/usr/lib/libusb.so -source: $(DL_DIR)/$(PKG_SOURCE) -prepare: $(PKG_BUILD_DIR)/.prepared -compile: $(PKG_IPK) $(STAGING_DIR)/usr/lib/libusb.so -install: $(PKG_INFO) +uninstall-dev: + rm -rf \ + $(STAGING_DIR)/usr/bin/libusb-config \ + $(STAGING_DIR)/usr/include/usb.h \ + $(STAGING_DIR)/usr/lib/libusb*.{a,so*} \ -clean: - rm -f $(STAGING_DIR)/usr/lib/libusb* - rm -f $(STAGING_DIR)/usr/include/usb.h - rm -rf $(PKG_BUILD_DIR) $(PKG_IPK) +compile-targets: install-dev +clean-targets: uninstall-dev