2 VERSION=$(shell awk '/Version:/ { print $$2 }' hwdata.spec)
3 RELEASE=$(shell rpm -q --define 'dist %{nil}' --specfile --qf "%{release}\n" hwdata.spec | head -n 1)
4 ifeq ($(shell git rev-parse --abbrev-ref HEAD | sed -n 's/^\([^0-9-]\+\).*/\L\1/p'), rhel)
5 # add revision to tag name for rhel branches
6 TAGNAME := $(NAME)-$(VERSION)-$(RELEASE)
8 TAGNAME := $(NAME)-$(VERSION)
10 SOURCEDIR := $(shell pwd)
11 ARCHIVE := $(TAGNAME).tar.bz2
14 CVSROOT = $(shell cat CVS/Root 2>/dev/null || :)
16 CVSTAG = $(NAME)-r$(subst .,-,$(VERSION))
18 FILES := pci.ids usb.ids oui.txt iab.txt pnp.ids
19 HWDBGENERATED := 20-OUI.hwdb 20-pci-classes.hwdb 20-pci-vendor-model.hwdb \
20 20-usb-classes.hwdb 20-usb-vendor-model.hwdb
21 HWDBUPSTREAM := 20-bluetooth-vendor-product.hwdb 60-keyboard.hwdb # 20-acpi-vendor.hwdb
22 HWDBFILES := $(HWDBGENERATED) $(HWDBUPSTREAM)
24 .PHONY: all install tag force-tag check commit create-archive archive srpm-x \
25 clean clog new-pci-ids new-usb-ids new-oui new-iab new-pnp-ids new-hwdb-files pnp.ids
31 Makefile.inc: configure
33 @echo "$@ generated. Run the make again."
37 mkdir -p -m 755 $(DESTDIR)$(datadir)/$(NAME)
38 for foo in $(FILES) ; do \
39 install -m 644 $$foo $(DESTDIR)$(datadir)/$(NAME) ;\
41 mkdir -p -m 755 $(DESTDIR)$(libdir)/udev/hwdb.d/
43 for foo in $(HWDBFILES) ; do \
44 num=`echo $$foo | sed 's,^\(.*/\|\)\([0-9]\+\)-[^/]\+,\2,'`; \
45 destname=`printf "%02d" $$((num + $(HWDBNUMINCR)))`-`basename $$foo | sed "s/^[0-9]\+-//"`; \
46 install -m 644 $$foo $(DESTDIR)$(libdir)/udev/hwdb.d/$$destname; \
48 mkdir -p -m 755 $(DESTDIR)$(libdir)/modprobe.d
49 install -m 644 -T blacklist.conf $(DESTDIR)$(libdir)/modprobe.d/dist-blacklist.conf
55 @git tag -s -m "Tag as $(TAGNAME)" $(TAGNAME)
56 @echo "Tagged as $(TAGNAME)"
59 @git tag -s -f $(TAGNAME)
60 @echo "Tag forced as $(TAGNAME)"
64 @(GIT_DIR=.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog || rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
67 @[ -x /sbin/lspci ] && /sbin/lspci -i pci.ids > /dev/null || { echo "FAILURE: /sbin/lspci -i pci.ids"; exit 1; } && echo "OK: /sbin/lspci -i pci.ids"
68 @./check-pci-ids.py || { echo "FAILURE: ./check-pci-ids.py"; exit 1; } && echo "OK: ./check-pci-ids.py"
69 @if [[ -e /run/docker.sock ]]; then \
71 echo "Listing usb devices:"; \
72 docker run -t --privileged --rm=true \
73 -v `pwd`/usb.ids:/usr/share/hwdata/usb.ids:ro \
74 -v "$$tmpdir:/mnt/out" \
75 miminar/hwdata-check /bin/bash -c 'lsusb 2>/mnt/out/err.out'; \
76 if [[ `cat $$tmpdir/err.out | wc -l` -gt 0 ]]; then \
77 echo "ERRORS:"; nl $$tmpdir/err.out; rm -rf $$tmpdir; exit 1; \
81 @echo -n "CHECK date of pci.ids: "; grep "Date:" pci.ids | cut -d ' ' -f 5
82 @echo -n "CHECK date of usb.ids: "; grep "Date:" usb.ids | cut -d ' ' -f 6
85 @rm -rf $(TAGNAME) $(TAGNAME).tar* 2>/dev/null
87 @git archive --format=tar --prefix=$(TAGNAME)/ HEAD > $(TAGNAME).tar
89 @cp ChangeLog $(TAGNAME)/
90 @tar --append -f $(TAGNAME).tar $(TAGNAME)
91 @bzip2 -f $(TAGNAME).tar
94 @echo "The final archive is in $(TAGNAME).tar.bz2"
96 archive: check clean commit tag create-archive
99 @scp $(TAGNAME).tar.bz2 fedorahosted.org:$(NAME)
103 srpm-x: create-archive
104 @echo Creating $(NAME) src.rpm
105 @rpmbuild --nodeps -bs --define "_sourcedir $(SOURCEDIR)" --define "_srcrpmdir $(SOURCEDIR)" $(NAME).spec
106 @echo SRPM is: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
109 @rm -f $(NAME)-*.gz $(NAME)-*.src.rpm new-pnp.xlsx pnp.ids.txt
112 @sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $< | tee $@
114 download: new-usb-ids new-pci-ids new-oui new-iab new-pnp-ids new-hwdb-files
118 @curl -O http://www.linux-usb.org/usb.ids
122 @curl -O http://pciids.sourceforge.net/pci.ids
126 @curl -O http://standards-oui.ieee.org/oui.txt
130 @curl -O http://standards.ieee.org/develop/regauth/iab/iab.txt
134 pnp.ids: pnp.ids.txt pnp.ids.patch
135 patch -o $@ <pnp.ids.patch
137 pnp.ids.txt: new-pnp.xlsx
138 @unoconv --stdout -f csv $? | \
141 -e 's/^\s*"\s*\(.*\)\s*"/\1/' \
142 -e 's/\s\{2,\}/ /g' \
143 -e 's/\s*(used as 2nd pnpid)\s*//' \
144 -e 's:^\(.*\)\s*,\s*\([a-zA-Z@]\{3\}\)\s*,\s*\([0-9]\+/[0-9]\+/[0-9]\+\):\2\t\1:p' | \
145 sed 's/\s*$$//' | sort -u >$@
150 http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/ISA_PNPID_List.xlsx
153 @for file in $(HWDBUPSTREAM); do \
155 curl -O http://cgit.freedesktop.org/systemd/systemd/plain/hwdb/$$; \