Load kernel module for MPX-885 card fixing TIVI-2713
[platform/upstream/hwdata.git] / Makefile
1 NAME=hwdata
2 VERSION=$(shell awk '/Version:/ { print $$2 }' hwdata.spec)
3 RELEASE=$(shell rpm -q --define 'dist %{nil}' --specfile --qf "%{release}" hwdata.spec)
4 SOURCEDIR := $(shell pwd)
5
6 include Makefile.inc
7
8 CVSROOT = $(shell cat CVS/Root 2>/dev/null || :)
9
10 CVSTAG = $(NAME)-r$(subst .,-,$(VERSION))
11
12 FILES = pci.ids usb.ids oui.txt pnp.ids
13
14 .PHONY: all install tag force-tag check commit create-archive archive srpm-x \
15     clean clog new-pci-ids new-usb-ids new-pnp-ids
16
17 all: 
18
19 install:
20         mkdir -p -m 755 $(DESTDIR)$(datadir)/$(NAME)
21         for foo in $(FILES) ; do \
22                 install -m 644 $$foo $(DESTDIR)$(datadir)/$(NAME) ;\
23         done
24         mkdir -p -m 755 $(DESTDIR)$(libdir)/modprobe.d
25         install -m 644 -T blacklist.conf $(DESTDIR)$(libdir)/modprobe.d/dist-blacklist.conf
26
27 commit:
28         git commit -a ||:
29
30 tag:
31         @git tag -s -m "Tag as $(NAME)-$(VERSION)-$(RELEASE)" $(NAME)-$(VERSION)-$(RELEASE)
32         @echo "Tagged as $(NAME)-$(VERSION)-$(RELEASE)"
33
34 force-tag:
35         @git tag -f $(NAME)-$(VERSION)-$(RELEASE)
36         @echo "Tag forced as $(NAME)-$(VERSION)-$(RELEASE)"
37
38 changelog:
39         @rm -f ChangeLog
40         @(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)
41
42 check:
43         @[ -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"
44         @./check-pci-ids.py || { echo "FAILURE: ./check-pci-ids.py"; exit 1; } && echo "OK: ./check-pci-ids.py"
45         @echo -n "CHECK date of pci.ids: "; grep "Date:" pci.ids | cut -d ' ' -f 5
46         @echo -n "CHECK date of usb.ids: "; grep "Date:" usb.ids | cut -d ' ' -f 6
47
48 create-archive:
49         @rm -rf $(NAME)-$(VERSION) $(NAME)-$(VERSION).tar*  2>/dev/null
50         @make changelog
51         @git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD > $(NAME)-$(VERSION).tar
52         @mkdir $(NAME)-$(VERSION)
53         @cp ChangeLog $(NAME)-$(VERSION)/
54         @tar --append -f $(NAME)-$(VERSION).tar $(NAME)-$(VERSION)
55         @bzip2 -f $(NAME)-$(VERSION).tar
56         @rm -rf $(NAME)-$(VERSION)
57         @echo ""
58         @echo "The final archive is in $(NAME)-$(VERSION).tar.bz2"
59
60 archive: check clean commit tag create-archive
61
62 upload:
63         @scp ${NAME}-$(VERSION).tar.bz2 fedorahosted.org:$(NAME)
64
65 dummy:
66
67 srpm-x: create-archive
68         @echo Creating $(NAME) src.rpm
69         @rpmbuild --nodeps -bs --define "_sourcedir $(SOURCEDIR)" --define "_srcrpmdir $(SOURCEDIR)" $(NAME).spec
70         @echo SRPM is: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
71
72 clean:
73         @rm -f $(NAME)-*.gz $(NAME)-*.src.rpm new-pnp.xlsx pnp.ids.txt
74
75 clog: hwdata.spec
76         @sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $< | tee $@
77
78 download: new-usb-ids new-pci-ids new-oui.txt new-pnp-ids
79
80 new-usb-ids:
81         @curl -O http://www.linux-usb.org/usb.ids
82
83 new-pci-ids:
84         @curl -O http://pciids.sourceforge.net/pci.ids
85
86 new-oui.txt:
87         @curl -O http://standards.ieee.org/develop/regauth/oui/oui.txt
88
89 new-pnp-ids: pnp.ids
90
91 pnp.ids: pnp.ids.txt pnp.ids.patch
92         patch -o $@ <pnp.ids.patch
93
94 pnp.ids.txt: new-pnp.xlsx
95         @unoconv --stdout -f csv $? | \
96             tr ' ' ' ' | \
97             sed -n \
98                 -e 's/^\s*"\s*\(.*\)\s*"/\1/' \
99                 -e 's/\s\{2,\}/ /g' \
100                 -e 's/\s*(used as 2nd pnpid)\s*//' \
101                 -e 's:^\(.*\)\s*,\s*\([a-zA-Z@]\{3\}\)\s*,\s*\([0-9]\+/[0-9]\+/[0-9]\+\):\2\t\1:p' | \
102             sed 's/\s*$$//' | sort -u >$@
103
104 new-pnp.xlsx:
105         @curl -o $@ \
106             http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/ISA_PNPID_List.xlsx