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
27 HAVE_PERLDOC := @HAVE_PERLDOC@
28 HAVE_QEMU := @HAVE_QEMU@
29 HAVE_QEMU_KVM := @HAVE_QEMU_KVM@
30 HAVE_LIVECD_CREATOR := @HAVE_LIVECD_CREATOR@
32 # i386 images also work on x86-64, so best to stick with i386.
37 BASEURL := http://download.fedora.redhat.com/pub/fedora/linux/releases/$(BASE)/Everything/$(ARCH)/os/
41 TIMEZONE := US/Eastern
43 LABEL := $(PACKAGE)-$(VERSION)
47 #----------------------------------------------------------------------
50 @echo "make build Build the live CD ISO"
51 @echo "make boot [HDA=hda.img] [HDB=hdb.img] [ISO=livecd.iso]"
52 @echo " Boot built/named ISO (uses qemu)"
53 @echo "make update Update an existing live CD ISO with new"
54 @echo " virt-p2v script, without doing full rebuild"
55 @echo "make man Make man pages (needs POD)"
59 ifeq ($(HAVE_LIVECD_CREATOR),livecd-creator)
61 build: checkroot checkscript livecd.ks
63 livecd-creator --config=livecd.ks --fslabel=$(LABEL)
66 livecd.ks: livecd.ks.in livecd-post.sh Makefile
69 -e 's|@ARCH@|$(ARCH)|g' \
70 -e 's|@BASE@|$(BASE)|g' \
71 -e 's|@BASEURL@|$(BASEURL)|g' \
72 -e 's|@LANG@|$(LANG)|g' \
73 -e 's|@KEYBOARD@|$(KEYBOARD)|g' \
74 -e 's|@TIMEZONE@|$(TIMEZONE)|g' \
75 < $< | cat - livecd-post.sh > $@
77 livecd-post.sh: livecd-post.sh.in virt-p2v virt-p2v-update-wrapper iso-attach inittab lvm.conf Makefile
80 -e '/@VIRT-P2V@/ r virt-p2v' \
82 -e '/@VIRT-P2V-UPDATE-WRAPPER@/ r virt-p2v-update-wrapper' \
83 -e '/@VIRT-P2V-UPDATE-WRAPPER@/ d' \
84 -e '/@ISO-ATTACH@/ r iso-attach' \
85 -e '/@ISO-ATTACH@/ d' \
86 -e '/@INITTAB@/ r inittab' \
88 -e '/@LVM.CONF@/ r lvm.conf' \
94 # Run live CD under qemu.
96 ifeq ($(HAVE_QEMU_KVM),qemu-kvm)
99 ifeq ($(HAVE_QEMU),qemu)
108 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
110 QEMU_ARGS += -hda $(HDA)
113 QEMU_ARGS += -hdb $(HDB)
120 # Update an existing ISO.
122 update: checkroot checkscript
123 -./iso-attach delete $(ISO)
124 ./iso-attach add $(ISO) virt-p2v
126 # Check that we are root.
129 @if [ `id -u` -ne 0 ]; then \
130 echo "You must be root to perform this operation."; \
134 # Check that the script compiles.
142 rm -f *~ core livecd.ks livecd-post.sh
147 $(MAKE) check-manifest
148 rm -rf $(PACKAGE)-$(VERSION)
149 mkdir $(PACKAGE)-$(VERSION)
150 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
151 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
152 rm -rf $(PACKAGE)-$(VERSION)
153 ls -l $(PACKAGE)-$(VERSION).tar.gz
156 @hg manifest | sort > .check-manifest; \
157 sort MANIFEST > .orig-manifest; \
158 diff -u .orig-manifest .check-manifest; rv=$$?; \
159 rm -f .orig-manifest .check-manifest; \
164 ifeq ($(HAVE_PERLDOC),perldoc)
166 MAN_SECTION := Virtualization Support
168 man: virt-p2v.1 virt-p2v.1.txt virt-p2v.1.html
170 virt-p2v.1: virt-p2v.pod
171 pod2man -c "$(MAN_SECTION)" --release "$(PACKAGE)-$(VERSION)" $< > $@
173 virt-p2v.1.txt: virt-p2v.pod
176 virt-p2v.1.html: virt-p2v.pod
177 pod2html -css virt-p2v.1.css $< > $@
183 WEBSITE_DIR := ../redhat/et-website/virt-p2v
186 cp virt-p2v.1.html $(WEBSITE_DIR)
187 cp virt-p2v.1.css $(WEBSITE_DIR)
188 cp $(PACKAGE)-$(VERSION).tar.gz $(WEBSITE_DIR)
190 .PHONY: build boot checkroot