Copy configure to tarball.
[virt-p2v.git] / Makefile.in
1 # Makefile for virt-p2v
2 # @configure_input@
3 #
4 # Copyright (C) 2007-2008 Red Hat Inc.
5 # Written by Richard W.M. Jones <rjones@redhat.com>
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21 #----------------------------------------------------------------------
22 # General configuration
23
24 PACKAGE         := @PACKAGE_NAME@
25 VERSION         := @PACKAGE_VERSION@
26
27 INSTALL         := @INSTALL@
28
29 HAVE_PERLDOC    := @HAVE_PERLDOC@
30 HAVE_QEMU       := @HAVE_QEMU@
31 HAVE_QEMU_KVM   := @HAVE_QEMU_KVM@
32 HAVE_LIVECD_CREATOR := @HAVE_LIVECD_CREATOR@
33
34 LABEL           := $(PACKAGE)-$(VERSION)
35 ISO             := $(LABEL).iso
36
37 #----------------------------------------------------------------------
38
39 all:
40         @echo "make build     Build the live CD ISO"
41         @echo "make boot [HDA=hda.img] [HDB=hdb.img] [ISO=livecd.iso]"
42         @echo "                 Boot built/named ISO (uses qemu)"
43         @echo "make update    Update an existing live CD ISO with new"
44         @echo "                 virt-p2v script, without doing full rebuild"
45         @echo "make man       Make man pages (needs POD)"
46
47 # Build live CD.
48
49 ifeq ($(HAVE_LIVECD_CREATOR),livecd-creator)
50
51 build:  p2v.ks checkroot checkscript
52         rm -f $(ISO)
53         livecd-creator --config=$< --fslabel=$(LABEL)
54         ls -lhtr *.iso
55
56 endif
57
58 # Run live CD under qemu.
59
60 ifeq ($(HAVE_QEMU_KVM),qemu-kvm)
61 QEMU    := qemu-kvm
62 else
63 ifeq ($(HAVE_QEMU),qemu)
64 QEMU    := qemu
65 endif
66 endif
67
68 ifneq ($(QEMU),)
69 HDA     :=
70 HDB     :=
71
72 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
73 ifneq ($(HDA),)
74 QEMU_ARGS += -hda $(HDA)
75 endif
76 ifneq ($(HDB),)
77 QEMU_ARGS += -hdb $(HDB)
78 endif
79
80 boot:
81         $(QEMU) $(QEMU_ARGS)
82 endif
83
84 # Update an existing ISO.
85
86 update: checkroot checkscript
87         -./iso-attach delete $(ISO)
88         ./iso-attach add $(ISO) virt-p2v
89
90 # Check that we are root.
91
92 checkroot:
93         @if [ `id -u` -ne 0 ]; then \
94           echo "You must be root to perform this operation."; \
95           exit 1; \
96         fi
97
98 # Check that the script compiles.
99
100 checkscript:
101         ./virt-p2v --test
102
103 # Clean.
104
105 clean:
106         rm -f *~ core livecd.ks livecd-post.sh
107
108 # Manifest.
109
110 dist:
111         $(MAKE) check-manifest
112         rm -rf $(PACKAGE)-$(VERSION)
113         mkdir $(PACKAGE)-$(VERSION)
114         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
115         $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/
116         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
117         rm -rf $(PACKAGE)-$(VERSION)
118         ls -l $(PACKAGE)-$(VERSION).tar.gz
119
120 check-manifest:
121         @hg manifest | sort > .check-manifest; \
122         sort MANIFEST > .orig-manifest; \
123         diff -u .orig-manifest .check-manifest; rv=$$?; \
124         rm -f .orig-manifest .check-manifest; \
125         exit $$rv
126
127 # Manual page.
128
129 ifeq ($(HAVE_PERLDOC),perldoc)
130
131 MAN_SECTION := Virtualization Support
132
133 man: virt-p2v.1 virt-p2v.1.txt virt-p2v.1.html
134
135 virt-p2v.1: virt-p2v.pod
136         pod2man -c "$(MAN_SECTION)" --release "$(PACKAGE)-$(VERSION)" $< > $@
137
138 virt-p2v.1.txt: virt-p2v.pod
139         pod2text $< > $@
140
141 virt-p2v.1.html: virt-p2v.pod
142         pod2html -css virt-p2v.1.css $< > $@
143
144 endif
145
146 # Website.
147
148 WEBSITE_DIR := ../redhat/et-website/virt-p2v
149
150 website: man dist
151         cp virt-p2v.1.html $(WEBSITE_DIR)
152         cp virt-p2v.1.css $(WEBSITE_DIR)
153         cp $(PACKAGE)-$(VERSION).tar.gz $(WEBSITE_DIR)
154
155 # Upload ISO.
156
157 upload_iso:
158         scp -l 300 $(ISO) et.redhat.com:public_html/tmp/
159
160 .PHONY: build boot checkroot