[7989] | 1 | NAME=$(shell awk '/Name:/ { print $$2 }' hwdata-vl.spec) |
---|
| 2 | VERSION=$(shell awk '/Version:/ { print $$2 }' hwdata-vl.spec) |
---|
| 3 | RELEASE=$(shell awk '/Release:/ { a=$$2; sub("%.*","",a); print a }' hwdata-vl.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 = MonitorsDB pci.ids upgradelist usb.ids videodrivers oui.txt pnp.ids |
---|
| 23 | |
---|
| 24 | .PHONY: all install tag force-tag check 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 $(datadir)/$(NAME)/videoaliases |
---|
| 34 | mkdir -p -m 755 $(sysconfdir)/modprobe.d |
---|
| 35 | install -m 644 blacklist.conf $(sysconfdir)/modprobe.d |
---|
| 36 | |
---|
| 37 | tag: |
---|
| 38 | @git tag -a -m "Tag as $(NAME)-$(VERSION)-$(RELEASE)" $(NAME)-$(VERSION)-$(RELEASE) |
---|
| 39 | @echo "Tagged as $(NAME)-$(VERSION)-$(RELEASE)" |
---|
| 40 | |
---|
| 41 | force-tag: |
---|
| 42 | @git tag -f $(NAME)-$(VERSION)-$(RELEASE) |
---|
| 43 | @echo "Tag forced as $(NAME)-$(VERSION)-$(RELEASE)" |
---|
| 44 | |
---|
| 45 | changelog: |
---|
| 46 | @rm -f ChangeLog |
---|
| 47 | @(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) |
---|
| 48 | |
---|
| 49 | check: |
---|
| 50 | @[ -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" |
---|
| 51 | @./check-pci-ids.py || { echo "FAILURE: ./check-pci-ids.py"; exit 1; } && echo "OK: ./check-pci-ids.py" |
---|
| 52 | @: videodrivers is tab-separated |
---|
| 53 | @[ `grep -vc ' ' videodrivers` -eq 0 ] || { echo "FAILURE: videodrivers not TAB separated"; exit 1; } && echo "OK: videodrivers" |
---|
| 54 | |
---|
| 55 | create-archive: |
---|
| 56 | @rm -rf $(NAME)-$(VERSION) $(NAME)-$(VERSION).tar* 2>/dev/null |
---|
| 57 | @make changelog |
---|
| 58 | @git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD > $(NAME)-$(VERSION).tar |
---|
| 59 | @mkdir $(NAME)-$(VERSION) |
---|
| 60 | @cp ChangeLog $(NAME)-$(VERSION)/ |
---|
| 61 | @tar --append -f $(NAME)-$(VERSION).tar $(NAME)-$(VERSION) |
---|
| 62 | @bzip2 -f $(NAME)-$(VERSION).tar |
---|
| 63 | @rm -rf $(NAME)-$(VERSION) |
---|
| 64 | @echo "" |
---|
| 65 | @echo "The final archive is in $(NAME)-$(VERSION).tar.bz2" |
---|
| 66 | |
---|
| 67 | archive: check clean tag create-archive |
---|
| 68 | |
---|
| 69 | upload: |
---|
| 70 | @scp ${NAME}-$(VERSION).tar.bz2 fedorahosted.org:$(NAME) |
---|
| 71 | |
---|
| 72 | dummy: |
---|
| 73 | |
---|
| 74 | srpm-x: create-archive |
---|
| 75 | @echo Creating $(NAME) src.rpm |
---|
| 76 | @rpmbuild --nodeps -bs --define "_sourcedir $(SOURCEDIR)" --define "_srcrpmdir $(SOURCEDIR)" $(NAME).spec |
---|
| 77 | @echo SRPM is: $(NAME)-$(VERSION)-$(RELEASE).src.rpm |
---|
| 78 | |
---|
| 79 | clean: |
---|
| 80 | @rm -f $(NAME)-*.gz $(NAME)-*.src.rpm |
---|
| 81 | |
---|
| 82 | clog: hwdata.spec |
---|
| 83 | @sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $< | tee $@ |
---|
| 84 | |
---|
| 85 | download: new-usb-ids new-pci-ids new-oui.txt |
---|
| 86 | |
---|
| 87 | new-usb-ids: |
---|
| 88 | @curl -O http://www.linux-usb.org/usb.ids |
---|
| 89 | |
---|
| 90 | new-pci-ids: |
---|
| 91 | @curl -O http://pciids.sourceforge.net/pci.ids |
---|
| 92 | |
---|
| 93 | new-oui.txt: |
---|
| 94 | @curl -O http://standards.ieee.org/regauth/oui/oui.txt |
---|