Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ifeq "$(V)" "0"
  2. STATUS = git status -s
  3. Q=@
  4. else
  5. STATUS = git status
  6. Q=
  7. endif
  8. PKG_CONFIG ?= pkg-config
  9. GZIP ?= yes
  10. NET ?= yes
  11. PCI ?= yes
  12. UDEV ?= no
  13. USB ?= yes
  14. COMPRESS_FILES-yes =
  15. COMPRESS_FILES-$(PCI) += pci.ids.gz
  16. COMPRESS_FILES-$(USB) += usb.ids.gz
  17. DATA_FILES-yes =
  18. DATA_FILES-$(GZIP) += $(COMPRESS_FILES-yes)
  19. DATA_FILES-$(NET) += oui.txt iab.txt
  20. DATA_FILES-$(PCI) += pci.ids
  21. DATA_FILES-$(USB) += usb.ids
  22. ALL_TARGETS-yes =
  23. ALL_TARGETS-$(GZIP) += $(COMPRESS_FILES-yes)
  24. ALL_TARGETS-$(UDEV) += udev-hwdb
  25. INSTALL_TARGETS-yes = install-base
  26. INSTALL_TARGETS-$(UDEV) += install-hwdb
  27. all: $(ALL_TARGETS-yes)
  28. install: $(INSTALL_TARGETS-yes)
  29. fetch:
  30. $(Q)curl -z pci.ids -o pci.ids -R http://pci-ids.ucw.cz/v2.2/pci.ids
  31. $(Q)curl -z usb.ids -o usb.ids -R http://www.linux-usb.org/usb.ids
  32. $(Q)curl -z oui.txt -o oui.txt -R http://www.ieee.org/netstorage/standards/oui.txt
  33. $(Q)curl -z iab.txt -o iab.txt -R http://standards.ieee.org/develop/regauth/iab/iab.txt
  34. $(Q)curl -z sdio.ids -o sdio.ids -R http://cgit.freedesktop.org/systemd/systemd/plain/hwdb/sdio.ids
  35. $(Q)curl -z udev/20-acpi-vendor.hwdb -o udev/20-acpi-vendor.hwdb -R http://cgit.freedesktop.org/systemd/systemd/plain/hwdb/20-acpi-vendor.hwdb
  36. $(Q)curl -z udev/20-bluetooth-vendor-product.hwdb -o udev/20-bluetooth-vendor-product.hwdb -R http://cgit.freedesktop.org/systemd/systemd/plain/hwdb/20-bluetooth-vendor-product.hwdb
  37. $(Q)curl -z udev/20-net-ifname.hwdb -o udev/20-net-ifname.hwdb -R http://cgit.freedesktop.org/systemd/systemd/plain/hwdb/20-net-ifname.hwdb
  38. $(Q)curl -z udev/60-keyboard.hwdb -o udev/60-keyboard.hwdb -R http://cgit.freedesktop.org/systemd/systemd/plain/hwdb/60-keyboard.hwdb
  39. $(Q)curl -z udev/70-mouse.hwdb -o udev/70-mouse.hwdb -R http://cgit.freedesktop.org/systemd/systemd/plain/hwdb/70-mouse.hwdb
  40. $(Q)curl -z udev-hwdb-update.pl -o udev-hwdb-update.pl -R http://cgit.freedesktop.org/systemd/systemd/plain/hwdb/ids-update.pl
  41. $(Q)$(STATUS)
  42. PV ?= $(shell ( awk '$$2 == "Date:" { print $$3; nextfile }' pci.ids usb.ids; git log --format=format:%ci -1 -- oui.txt udev/20-acpi-vendor.hwdb udev/20-bluetooth-vendor-product.hwdb udev/20-net-ifname.hwdb udev/60-keyboard.hwdb udev/70-mouse.hwdb udev-hwdb-update.pl | cut -d ' ' -f1; ) | sort | tail -n 1 | tr -d -)
  43. P = hwids-$(PV)
  44. tag:
  45. git tag $(P)
  46. udev-hwdb:
  47. perl ./udev-hwdb-update.pl && mv *.hwdb udev/
  48. compress: pci.ids.gz usb.ids.gz
  49. %.gz: %
  50. gzip -c $< > $@
  51. MISCDIR=/usr/share/misc
  52. HWDBDIR=$(shell $(PKG_CONFIG) --variable=udevdir udev)/hwdb.d
  53. DOCDIR=/usr/share/doc/hwids
  54. install-base: $(DATA_FILES-yes)
  55. mkdir -p $(DESTDIR)$(DOCDIR)
  56. install -p -m 644 README.md $(DESTDIR)$(DOCDIR)
  57. ifneq ($(strip $(DATA_FILES-yes)),)
  58. mkdir -p $(DESTDIR)$(MISCDIR)
  59. install -p -m 644 $(DATA_FILES-yes) $(DESTDIR)$(MISCDIR)
  60. endif
  61. install-hwdb:
  62. mkdir -p $(DESTDIR)$(HWDBDIR)
  63. install -p -m 644 udev/*.hwdb $(DESTDIR)$(HWDBDIR)
  64. udevadm hwdb --root $(DESTDIR) --update