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@
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 LABEL := $(PACKAGE)-$(VERSION)
35 #----------------------------------------------------------------------
38 @echo "make build Build the live CD ISO"
39 @echo "make boot [HDA=hda.img] [HDB=hdb.img] [ISO=livecd.iso]"
40 @echo " Boot built/named ISO (uses qemu)"
41 @echo "make update Update an existing live CD ISO with new"
42 @echo " virt-p2v script, without doing full rebuild"
43 @echo "make man Make man pages (needs POD)"
47 ifeq ($(HAVE_LIVECD_CREATOR),livecd-creator)
49 build: p2v.ks checkroot checkscript
51 livecd-creator --config=$< --fslabel=$(LABEL)
56 # Run live CD under qemu.
58 ifeq ($(HAVE_QEMU_KVM),qemu-kvm)
61 ifeq ($(HAVE_QEMU),qemu)
70 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
72 QEMU_ARGS += -hda $(HDA)
75 QEMU_ARGS += -hdb $(HDB)
82 # Update an existing ISO.
84 update: checkroot checkscript
85 -./iso-attach delete $(ISO)
86 ./iso-attach add $(ISO) virt-p2v
88 # Check that we are root.
91 @if [ `id -u` -ne 0 ]; then \
92 echo "You must be root to perform this operation."; \
96 # Check that the script compiles.
104 rm -f *~ core livecd.ks livecd-post.sh
109 $(MAKE) check-manifest
110 rm -rf $(PACKAGE)-$(VERSION)
111 mkdir $(PACKAGE)-$(VERSION)
112 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
113 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
114 rm -rf $(PACKAGE)-$(VERSION)
115 ls -l $(PACKAGE)-$(VERSION).tar.gz
118 @hg manifest | sort > .check-manifest; \
119 sort MANIFEST > .orig-manifest; \
120 diff -u .orig-manifest .check-manifest; rv=$$?; \
121 rm -f .orig-manifest .check-manifest; \
126 ifeq ($(HAVE_PERLDOC),perldoc)
128 MAN_SECTION := Virtualization Support
130 man: virt-p2v.1 virt-p2v.1.txt virt-p2v.1.html
132 virt-p2v.1: virt-p2v.pod
133 pod2man -c "$(MAN_SECTION)" --release "$(PACKAGE)-$(VERSION)" $< > $@
135 virt-p2v.1.txt: virt-p2v.pod
138 virt-p2v.1.html: virt-p2v.pod
139 pod2html -css virt-p2v.1.css $< > $@
145 WEBSITE_DIR := ../redhat/et-website/virt-p2v
148 cp virt-p2v.1.html $(WEBSITE_DIR)
149 cp virt-p2v.1.css $(WEBSITE_DIR)
150 cp $(PACKAGE)-$(VERSION).tar.gz $(WEBSITE_DIR)
152 .PHONY: build boot checkroot