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