Copy initial release from CVS.
[virt-what.git] / Makefile
1 # Makefile for virt-what
2 #
3 # Copyright (C) 2008-2009 Red Hat Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 PACKAGE = virt-what
20 VERSION = 1.0
21
22 prefix  = /usr/local
23 bindir  = $(prefix)/bin
24 mandir  = $(prefix)/share/man
25
26 all:    virt-what.1 virt-what.txt virt-what
27
28 virt-what: virt-what.sh
29         sed -e 's/@VERSION@/$(VERSION)/g' < $< > $@
30         chmod 0755 $@
31
32 virt-what.1: virt-what.pod
33         pod2man -c "Virtualization Support" --release "$(PACKAGE)-$(VERSION)" \
34           $< > $@
35
36 virt-what.txt: virt-what.pod
37         pod2text $< > $@
38
39 clean:
40         rm -f virt-what virt-what.1 virt-what.txt
41         rm -f *~
42
43 # Install.
44
45 install:
46         mkdir -p $(DESTDIR)$(bindir)
47         mkdir -p $(DESTDIR)$(mandir)/man1
48         install -m 0755 virt-what $(DESTDIR)$(bindir)/
49         install -m 0644 virt-what.1 $(DESTDIR)$(mandir)/man1/
50
51 # Distribution.
52
53 dist:
54         $(MAKE) check-manifest
55         rm -rf $(PACKAGE)-$(VERSION)
56         mkdir $(PACKAGE)-$(VERSION)
57         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
58         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
59         rm -rf $(PACKAGE)-$(VERSION)
60         ls -l $(PACKAGE)-$(VERSION).tar.gz
61
62 check-manifest:
63         @for d in `find -type d -name CVS | grep -v '^\./debian/'`; \
64         do \
65         b=`dirname $$d`/; \
66         awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \
67         sed -e "s|^|$$b|" -e "s|^\./||"; \
68         done | sort > .check-manifest; \
69         sort MANIFEST > .orig-manifest; \
70         diff -u .orig-manifest .check-manifest; rv=$$?; \
71         rm -f .orig-manifest .check-manifest; \
72         exit $$rv