1 NAME=$(shell awk '/Name:/ { print $$2 }' hwdata.spec)
2 VERSION=$(shell awk '/Version:/ { print $$2 }' hwdata.spec)
3 RELEASE=$(shell rpm -q --define 'dist .el6' --specfile --qf "%{release}" hwdata.spec)
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 sysconfdir=$(DESTDIR)/etc
16 sbindir=$(prefix)/sbin
17 datadir=$(prefix)/share
19 includedir=$(prefix)/include
23 CFLAGS=$(RPM_OPT_FLAGS) -g
25 CVSROOT = $(shell cat CVS/Root 2>/dev/null || :)
27 CVSTAG = $(NAME)-r$(subst .,-,$(VERSION))
29 FILES = MonitorsDB pci.ids upgradelist usb.ids videodrivers oui.txt pnp.ids
31 .PHONY: all install tag force-tag check commit create-archive archive srpm-x clean clog new-pci-ids new-usb-ids
36 mkdir -p -m 755 $(datadir)/$(NAME)
37 for foo in $(FILES) ; do \
38 install -m 644 $$foo $(datadir)/$(NAME) ;\
40 mkdir -p -m 755 $(datadir)/$(NAME)/videoaliases
41 mkdir -p -m 755 $(sysconfdir)/modprobe.d
42 install -m 644 blacklist.conf $(sysconfdir)/modprobe.d
48 @git tag -s -m "Tag as $(TAGNAME)" $(TAGNAME)
49 @echo "Tagged as $(TAGNAME)"
52 @git tag -s -f $(TAGNAME)
53 @echo "Tag forced as $(TAGNAME)"
57 @(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)
60 @[ -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"
61 @./check-pci-ids.py || { echo "FAILURE: ./check-pci-ids.py"; exit 1; } && echo "OK: ./check-pci-ids.py"
62 @if [[ -e /run/docker.sock ]]; then \
64 echo "Listing usb devices:"; \
65 docker run -t --privileged --rm=true \
66 -v `pwd`/usb.ids:/usr/share/hwdata/usb.ids:r \
67 -v "$$tmpdir:/mnt/out" \
68 miminar/hwdata-check /bin/bash -c 'lsusb 2>/mnt/out/err.out'; \
69 if [[ `cat $$tmpdir/err.out | wc -l` -gt 0 ]]; then \
70 echo "ERRORS:"; nl $$tmpdir/err.out; rm -rf $$tmpdir; exit 1; \
74 @echo -n "CHECK date of pci.ids: "; grep "Date:" pci.ids | cut -d ' ' -f 5
75 @echo -n "CHECK date of usb.ids: "; grep "Date:" usb.ids | cut -d ' ' -f 6
76 @: videodrivers is tab-separated
77 @[ `grep -vc ' ' videodrivers` -eq 0 ] || { echo "FAILURE: videodrivers not TAB separated"; exit 1; } && echo "OK: videodrivers"
80 @rm -rf $(TAGNAME) $(TAGNAME).tar* 2>/dev/null
82 @git archive --format=tar --prefix=$(TAGNAME)/ HEAD > $(TAGNAME).tar
84 @cp ChangeLog $(TAGNAME)/
85 @tar --append -f $(TAGNAME).tar $(TAGNAME)
86 @bzip2 -f $(TAGNAME).tar
89 @echo "The final archive is in $(ARCHIVE)"
91 archive: check clean commit tag create-archive
94 @scp $(ARCHIVE) fedorahosted.org:$(NAME)
98 srpm-x: create-archive
99 @echo Creating $(NAME) src.rpm
100 @rpmbuild --nodeps -bs --define "_sourcedir $(SOURCEDIR)" --define "_srcrpmdir $(SOURCEDIR)" $(NAME).spec
101 @echo SRPM is: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
104 @rm -f $(NAME)-*.bz2 $(NAME)-*.src.rpm
107 @sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $< | tee $@
109 download: new-usb-ids new-pci-ids new-oui.txt
112 @curl -O http://www.linux-usb.org/usb.ids
115 @curl -O http://pciids.sourceforge.net/pci.ids
118 @curl -O http://standards-oui.ieee.org/oui.txt