1 # Makefile for virt-p2v
4 # Copyright (C) 2007-2008 Red Hat Inc.
5 # Written by Richard W.M. Jones <rjones@redhat.com>
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.
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.
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
21 #----------------------------------------------------------------------
22 # General configuration
24 PACKAGE := @PACKAGE_NAME@
25 VERSION := @PACKAGE_VERSION@
29 HAVE_PERLDOC := @HAVE_PERLDOC@
30 HAVE_QEMU := @HAVE_QEMU@
31 HAVE_QEMU_KVM := @HAVE_QEMU_KVM@
32 HAVE_LIVECD_CREATOR := @HAVE_LIVECD_CREATOR@
34 LABEL := $(PACKAGE)-$(VERSION)
37 #----------------------------------------------------------------------
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)"
49 ifeq ($(HAVE_LIVECD_CREATOR),livecd-creator)
51 build: p2v.ks checkroot checkscript
53 livecd-creator --config=$< --fslabel=$(LABEL)
58 # Run live CD under qemu.
60 ifeq ($(HAVE_QEMU_KVM),qemu-kvm)
63 ifeq ($(HAVE_QEMU),qemu)
72 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
74 QEMU_ARGS += -hda $(HDA)
77 QEMU_ARGS += -hdb $(HDB)
84 # Update an existing ISO.
86 update: checkroot checkscript
87 -./iso-attach delete $(ISO)
88 ./iso-attach add $(ISO) virt-p2v
90 # Check that we are root.
93 @if [ `id -u` -ne 0 ]; then \
94 echo "You must be root to perform this operation."; \
98 # Check that the script compiles.
106 rm -f *~ core livecd.ks livecd-post.sh
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
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; \
129 ifeq ($(HAVE_PERLDOC),perldoc)
131 MAN_SECTION := Virtualization Support
133 man: virt-p2v.1 virt-p2v.1.txt virt-p2v.1.html
135 virt-p2v.1: virt-p2v.pod
136 pod2man -c "$(MAN_SECTION)" --release "$(PACKAGE)-$(VERSION)" $< > $@
138 virt-p2v.1.txt: virt-p2v.pod
141 virt-p2v.1.html: virt-p2v.pod
142 pod2html -css virt-p2v.1.css $< > $@
148 WEBSITE_DIR := ../redhat/et-website/virt-p2v
151 cp virt-p2v.1.html $(WEBSITE_DIR)
152 cp virt-p2v.1.css $(WEBSITE_DIR)
153 cp $(PACKAGE)-$(VERSION).tar.gz $(WEBSITE_DIR)
158 scp -l 300 $(ISO) et.redhat.com:public_html/tmp/
160 .PHONY: build boot checkroot