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 := v$(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 sdio.ids
22 20-pci-vendor-model.hwdb \
23 20-sdio-classes.hwdb \
24 20-sdio-vendor-model.hwdb \
26 20-usb-vendor-model.hwdb
29 20-bluetooth-vendor-product.hwdb \
35 HWDBFILES := $(HWDBGENERATED) $(HWDBUPSTREAM)
37 .PHONY: all install tag force-tag check commit create-archive archive srpm-x \
52 Makefile.inc: configure
54 @echo "$@ generated. Run the make again."
58 mkdir -p -m 755 $(DESTDIR)$(datadir)/$(NAME)
59 for foo in $(FILES) ; do \
60 install -m 644 $$foo $(DESTDIR)$(datadir)/$(NAME) ;\
62 mkdir -p -m 755 $(DESTDIR)$(libdir)/udev/hwdb.d/
64 for foo in $(HWDBFILES) ; do \
65 num=`echo $$foo | sed 's,^\(.*/\|\)\([0-9]\+\)-[^/]\+,\2,'`; \
66 destname=`printf "%02d" $$((num + $(HWDBNUMINCR)))`-`basename $$foo | sed "s/^[0-9]\+-//"`; \
67 install -m 644 $$foo $(DESTDIR)$(libdir)/udev/hwdb.d/$$destname; \
69 mkdir -p -m 755 $(DESTDIR)$(libdir)/modprobe.d
70 install -m 644 -T blacklist.conf $(DESTDIR)$(libdir)/modprobe.d/dist-blacklist.conf
76 @git tag -s -m "Tag as $(TAGNAME)" $(TAGNAME)
77 @echo "Tagged as $(TAGNAME)"
80 @git tag -s -f -m "Tag as $(TAGNAME)" $(TAGNAME)
81 @echo "Tag forced as $(TAGNAME)"
85 @(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)
88 @[ -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"
89 @./check-pci-ids.py || { echo "FAILURE: ./check-pci-ids.py"; exit 1; } && echo "OK: ./check-pci-ids.py"
91 @for file in $(IDFILES); do \
92 text=`LANG=C file $$file`; \
93 expected="$$file: UTF-8 Unicode text"; \
94 if [[ "$$text" != "$$expected" ]]; then \
95 printf "Expected: %s\n Got instead: %s\n" "$$expected" "$$text" >&2; \
100 @echo -n "CHECK date of pci.ids: "; grep "Date:" pci.ids | cut -d ' ' -f 5
101 @echo -n "CHECK date of usb.ids: "; grep "Date:" usb.ids | cut -d ' ' -f 6
104 @rm -rf $(TAGNAME) $(TAGNAME).tar* 2>/dev/null
106 @git archive --format=tar --prefix=$(TAGNAME)/ HEAD > $(TAGNAME).tar
108 @cp ChangeLog $(TAGNAME)/
109 @tar --append -f $(TAGNAME).tar $(TAGNAME)
110 @bzip2 -f $(TAGNAME).tar
113 @echo "The final archive is in $(TAGNAME).tar.bz2"
115 archive: check clean commit tag
118 @scp $(TAGNAME).tar.bz2 fedorahosted.org:$(NAME)
122 srpm-x: create-archive
123 @echo Creating $(NAME) src.rpm
124 @rpmbuild --nodeps -bs --define "_sourcedir $(SOURCEDIR)" --define "_srcrpmdir $(SOURCEDIR)" $(NAME).spec
125 @echo SRPM is: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
128 @rm -f $(NAME)-*.gz $(NAME)-*.src.rpm pnp.ids.xlsx \
129 *.downloaded *.utf8 *.orig
132 @sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $< | tee $@
134 download: $(FILES) new-hwdb-files
137 @curl -o $@ http://www.linux-usb.org/usb.ids
140 @curl -o $@ https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids
143 @curl -o $@ -O http://standards-oui.ieee.org/oui.txt
146 @curl -o $@ -O http://standards-oui.ieee.org/iab/iab.txt
150 http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/ISA_PNPID_List.xlsx
153 @curl -o $@ https://raw.githubusercontent.com/systemd/systemd/master/hwdb.d/sdio.ids
155 usb.ids: usb.ids.utf8
158 pci.ids: pci.ids.utf8
161 oui.txt: oui.txt.utf8
164 iab.txt: iab.txt.utf8
167 sdio.ids: sdio.ids.utf8
170 pnp.ids.orig: pnp.ids.xlsx
171 @unoconv --stdout -f csv $? | \
174 -e 's/^\s*"\s*\(.*\)\s*"/\1/' \
175 -e 's/\s\{2,\}/ /g' \
176 -e 's/\s*(used as 2nd pnpid)\s*//' \
177 -e 's:^\(.*\)\s*,\s*\([a-zA-Z@]\{3\}\)\s*,\s*\([0-9]\+/[0-9]\+/[0-9]\+\):\2\t\1:p' | \
178 sed 's/\s*$$//' | sort -u >$@
180 pnp.ids: pnp.ids.orig pnp.ids.patch
181 patch -o $@ <pnp.ids.patch
184 @text=`LANG=C file $?`
185 @encoding=`echo "$$text" | sed -n 's/.*\(iso-8859\S\*\|cp1[12]\d\+\).*/\1/Ip'`
186 @if [[ -n "$$encoding" ]]; then \
187 iconv -f "$$encoding" -t UTF-8 $?; \
190 fi | sed 's/\s\+$$//' >$@
193 @for file in $(HWDBUPSTREAM); do \
195 curl -O https://raw.githubusercontent.com/systemd/systemd/master/hwdb.d/$$file; \