1 NAME=$(shell awk '/Name:/ { print $$2 }' hwdata.spec)
2 VERSION=$(shell awk '/Version:/ { print $$2 }' hwdata.spec)
3 RELEASE=$(shell rpm -q --specfile --qf "%{release}" hwdata.spec)
4 SOURCEDIR := $(shell pwd)
7 sysconfdir=$(DESTDIR)/etc
10 datadir=$(prefix)/share
12 includedir=$(prefix)/include
16 CFLAGS=$(RPM_OPT_FLAGS) -g
18 CVSROOT = $(shell cat CVS/Root 2>/dev/null || :)
20 CVSTAG = $(NAME)-r$(subst .,-,$(VERSION))
22 FILES = pci.ids upgradelist usb.ids oui.txt pnp.ids
24 .PHONY: all install tag force-tag check commit create-archive archive srpm-x clean clog new-pci-ids new-usb-ids
29 mkdir -p -m 755 $(datadir)/$(NAME)
30 for foo in $(FILES) ; do \
31 install -m 644 $$foo $(datadir)/$(NAME) ;\
33 mkdir -p -m 755 $(datadir)/$(NAME)/videoaliases
34 mkdir -p -m 755 $(sysconfdir)/modprobe.d
35 install -m 644 blacklist.conf $(sysconfdir)/modprobe.d
41 @git tag -a -m "Tag as $(NAME)-$(VERSION)-$(RELEASE)" $(NAME)-$(VERSION)-$(RELEASE)
42 @echo "Tagged as $(NAME)-$(VERSION)-$(RELEASE)"
45 @git tag -f $(NAME)-$(VERSION)-$(RELEASE)
46 @echo "Tag forced as $(NAME)-$(VERSION)-$(RELEASE)"
50 @(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)
53 @[ -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"
54 @./check-pci-ids.py || { echo "FAILURE: ./check-pci-ids.py"; exit 1; } && echo "OK: ./check-pci-ids.py"
55 @echo -n "CHECK date of pci.ids: "; grep "Date:" pci.ids | cut -d ' ' -f 5
56 @echo -n "CHECK date of usb.ids: "; grep "Date:" usb.ids | cut -d ' ' -f 6
59 @rm -rf $(NAME)-$(VERSION) $(NAME)-$(VERSION)-$(RELEASE).tar* 2>/dev/null
61 @git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD > $(NAME)-$(VERSION)-$(RELEASE).tar
62 @mkdir $(NAME)-$(VERSION)
63 @cp ChangeLog $(NAME)-$(VERSION)/
64 @tar --append -f $(NAME)-$(VERSION)-$(RELEASE).tar $(NAME)-$(VERSION)
65 @bzip2 -f $(NAME)-$(VERSION)-$(RELEASE).tar
66 @rm -rf $(NAME)-$(VERSION)
68 @echo "The final archive is in $(NAME)-$(VERSION)-$(RELEASE).tar.bz2"
70 archive: check clean commit tag create-archive
73 @scp ${NAME}-$(VERSION)-$(RELEASE).tar.bz2 fedorahosted.org:$(NAME)
77 srpm-x: create-archive
78 @echo Creating $(NAME) src.rpm
79 @rpmbuild --nodeps -bs --define "_sourcedir $(SOURCEDIR)" --define "_srcrpmdir $(SOURCEDIR)" $(NAME).spec
80 @echo SRPM is: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
83 @rm -f $(NAME)-*.gz $(NAME)-*.src.rpm
86 @sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $< | tee $@
88 download: new-usb-ids new-pci-ids new-oui.txt
91 @curl -O http://www.linux-usb.org/usb.ids
94 @curl -O http://pciids.sourceforge.net/pci.ids
97 @curl -O http://standards.ieee.org/develop/regauth/oui/oui.txt