Use autoconf to generate the Makefile.
[virt-p2v.git] / Makefile.in
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..13967ee
--- /dev/null
@@ -0,0 +1,190 @@
+# Makefile for virt-p2v
+# @configure_input@
+#
+# Copyright (C) 2007-2008 Red Hat Inc.
+# Written by Richard W.M. Jones <rjones@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+#----------------------------------------------------------------------
+# General configuration
+
+PACKAGE  := @PACKAGE@
+VERSION  := @VERSION@
+
+HAVE_PERLDOC := @HAVE_PERLDOC@
+HAVE_QEMU := @HAVE_QEMU@
+HAVE_QEMU_KVM := @HAVE_QEMU_KVM@
+HAVE_LIVECD_CREATOR := @HAVE_LIVECD_CREATOR@
+
+# i386 images also work on x86-64, so best to stick with i386.
+ARCH     := i386
+
+# Base repository.
+BASE    := 8
+BASEURL         := http://download.fedora.redhat.com/pub/fedora/linux/releases/$(BASE)/Everything/$(ARCH)/os/
+
+LANG    := en_US.UTF-8
+KEYBOARD := us
+TIMEZONE := US/Eastern
+
+LABEL   := $(PACKAGE)-$(VERSION)
+
+ISO     := $(LABEL).iso
+
+#----------------------------------------------------------------------
+
+all:
+       @echo "make build     Build the live CD ISO"
+       @echo "make boot [HDA=hda.img] [HDB=hdb.img] [ISO=livecd.iso]"
+       @echo "                 Boot built/named ISO (uses qemu)"
+       @echo "make update    Update an existing live CD ISO with new"
+       @echo "                 virt-p2v script, without doing full rebuild"
+       @echo "make man       Make man pages (needs POD)"
+
+# Build live CD.
+
+ifeq ($(HAVE_LIVECD_CREATOR),livecd-creator)
+
+build: checkroot checkscript livecd.ks
+       rm -f $(ISO)
+       livecd-creator --config=livecd.ks --fslabel=$(LABEL)
+       ls -lhtr *.iso
+
+livecd.ks: livecd.ks.in livecd-post.sh Makefile
+       rm -f $@
+       sed \
+         -e 's|@ARCH@|$(ARCH)|g' \
+         -e 's|@BASE@|$(BASE)|g' \
+         -e 's|@BASEURL@|$(BASEURL)|g' \
+         -e 's|@LANG@|$(LANG)|g' \
+         -e 's|@KEYBOARD@|$(KEYBOARD)|g' \
+         -e 's|@TIMEZONE@|$(TIMEZONE)|g' \
+         < $< | cat - livecd-post.sh > $@
+
+livecd-post.sh: livecd-post.sh.in virt-p2v virt-p2v-update-wrapper iso-attach inittab lvm.conf Makefile
+       rm -f $@
+       sed \
+         -e '/@VIRT-P2V@/ r virt-p2v' \
+         -e '/@VIRT-P2V@/ d' \
+         -e '/@VIRT-P2V-UPDATE-WRAPPER@/ r virt-p2v-update-wrapper' \
+         -e '/@VIRT-P2V-UPDATE-WRAPPER@/ d' \
+         -e '/@ISO-ATTACH@/ r iso-attach' \
+         -e '/@ISO-ATTACH@/ d' \
+         -e '/@INITTAB@/ r inittab' \
+         -e '/@INITTAB@/ d' \
+         -e '/@LVM.CONF@/ r lvm.conf' \
+         -e '/@LVM.CONF@/ d' \
+         < $< > $@
+
+endif
+
+# Run live CD under qemu.
+
+ifeq ($(HAVE_QEMU_KVM),qemu-kvm)
+QEMU   := qemu-kvm
+else
+ifeq ($(HAVE_QEMU),qemu)
+QEMU   := qemu
+endif
+endif
+
+ifneq ($(QEMU),)
+HDA    :=
+HDB    :=
+
+QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
+ifneq ($(HDA),)
+QEMU_ARGS += -hda $(HDA)
+endif
+ifneq ($(HDB),)
+QEMU_ARGS += -hdb $(HDB)
+endif
+
+boot:
+       $(QEMU) $(QEMU_ARGS)
+endif
+
+# Update an existing ISO.
+
+update: checkroot checkscript
+       -./iso-attach delete $(ISO)
+       ./iso-attach add $(ISO) virt-p2v
+
+# Check that we are root.
+
+checkroot:
+       @if [ `id -u` -ne 0 ]; then \
+         echo "You must be root to perform this operation."; \
+         exit 1; \
+       fi
+
+# Check that the script compiles.
+
+checkscript:
+       ./virt-p2v --test
+
+# Clean.
+
+clean:
+       rm -f *~ core livecd.ks livecd-post.sh
+
+# Manifest.
+
+dist:
+       $(MAKE) check-manifest
+       rm -rf $(PACKAGE)-$(VERSION)
+       mkdir $(PACKAGE)-$(VERSION)
+       tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
+       tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
+       rm -rf $(PACKAGE)-$(VERSION)
+       ls -l $(PACKAGE)-$(VERSION).tar.gz
+
+check-manifest:
+       @hg manifest | sort > .check-manifest; \
+       sort MANIFEST > .orig-manifest; \
+       diff -u .orig-manifest .check-manifest; rv=$$?; \
+       rm -f .orig-manifest .check-manifest; \
+       exit $$rv
+
+# Manual page.
+
+ifeq ($(HAVE_PERLDOC),perldoc)
+
+MAN_SECTION := Virtualization Support
+
+man: virt-p2v.1 virt-p2v.1.txt virt-p2v.1.html
+
+virt-p2v.1: virt-p2v.pod
+       pod2man -c "$(MAN_SECTION)" --release "$(PACKAGE)-$(VERSION)" $< > $@
+
+virt-p2v.1.txt: virt-p2v.pod
+       pod2text $< > $@
+
+virt-p2v.1.html: virt-p2v.pod
+       pod2html -css virt-p2v.1.css $< > $@
+
+endif
+
+# Website.
+
+WEBSITE_DIR := ../redhat/et-website/virt-p2v
+
+website: man dist
+       cp virt-p2v.1.html $(WEBSITE_DIR)
+       cp virt-p2v.1.css $(WEBSITE_DIR)
+       cp $(PACKAGE)-$(VERSION).tar.gz $(WEBSITE_DIR)
+
+.PHONY:        build boot checkroot
\ No newline at end of file