Don't create videoaliases subdir at install
[oweals/hwdata.git] / Makefile
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)
5
6 prefix=$(DESTDIR)/usr
7 sysconfdir=$(DESTDIR)/etc
8 bindir=$(prefix)/bin
9 sbindir=$(prefix)/sbin
10 datadir=$(prefix)/share
11 mandir=$(datadir)/man
12 includedir=$(prefix)/include
13 libdir=$(prefix)/lib
14
15 CC=gcc
16 CFLAGS=$(RPM_OPT_FLAGS) -g
17
18 CVSROOT = $(shell cat CVS/Root 2>/dev/null || :)
19
20 CVSTAG = $(NAME)-r$(subst .,-,$(VERSION))
21
22 FILES = pci.ids usb.ids oui.txt pnp.ids
23
24 .PHONY: all install tag force-tag check commit create-archive archive srpm-x clean clog new-pci-ids new-usb-ids
25
26 all: 
27
28 install:
29         mkdir -p -m 755 $(datadir)/$(NAME)
30         for foo in $(FILES) ; do \
31                 install -m 644 $$foo $(datadir)/$(NAME) ;\
32         done
33         mkdir -p -m 755 $(sysconfdir)/modprobe.d
34         install -m 644 blacklist.conf $(sysconfdir)/modprobe.d
35
36 commit:
37         git commit -a ||:
38
39 tag:
40         @git tag -a -m "Tag as $(NAME)-$(VERSION)-$(RELEASE)" $(NAME)-$(VERSION)-$(RELEASE)
41         @echo "Tagged as $(NAME)-$(VERSION)-$(RELEASE)"
42
43 force-tag:
44         @git tag -f $(NAME)-$(VERSION)-$(RELEASE)
45         @echo "Tag forced as $(NAME)-$(VERSION)-$(RELEASE)"
46
47 changelog:
48         @rm -f ChangeLog
49         @(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)
50
51 check:
52         @[ -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"
53         @./check-pci-ids.py || { echo "FAILURE: ./check-pci-ids.py"; exit 1; } && echo "OK: ./check-pci-ids.py"
54         @echo -n "CHECK date of pci.ids: "; grep "Date:" pci.ids | cut -d ' ' -f 5
55         @echo -n "CHECK date of usb.ids: "; grep "Date:" usb.ids | cut -d ' ' -f 6
56
57 create-archive:
58         @rm -rf $(NAME)-$(VERSION) $(NAME)-$(VERSION)-$(RELEASE).tar*  2>/dev/null
59         @make changelog
60         @git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD > $(NAME)-$(VERSION)-$(RELEASE).tar
61         @mkdir $(NAME)-$(VERSION)
62         @cp ChangeLog $(NAME)-$(VERSION)/
63         @tar --append -f $(NAME)-$(VERSION)-$(RELEASE).tar $(NAME)-$(VERSION)
64         @bzip2 -f $(NAME)-$(VERSION)-$(RELEASE).tar
65         @rm -rf $(NAME)-$(VERSION)
66         @echo ""
67         @echo "The final archive is in $(NAME)-$(VERSION)-$(RELEASE).tar.bz2"
68
69 archive: check clean commit tag create-archive
70
71 upload:
72         @scp ${NAME}-$(VERSION)-$(RELEASE).tar.bz2 fedorahosted.org:$(NAME)
73
74 dummy:
75
76 srpm-x: create-archive
77         @echo Creating $(NAME) src.rpm
78         @rpmbuild --nodeps -bs --define "_sourcedir $(SOURCEDIR)" --define "_srcrpmdir $(SOURCEDIR)" $(NAME).spec
79         @echo SRPM is: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
80
81 clean:
82         @rm -f $(NAME)-*.gz $(NAME)-*.src.rpm
83
84 clog: hwdata.spec
85         @sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $< | tee $@
86
87 download: new-usb-ids new-pci-ids new-oui.txt
88
89 new-usb-ids:
90         @curl -O http://www.linux-usb.org/usb.ids
91
92 new-pci-ids:
93         @curl -O http://pciids.sourceforge.net/pci.ids
94
95 new-oui.txt:
96         @curl -O http://standards.ieee.org/develop/regauth/oui/oui.txt