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