Generate kickstart file.
[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 HAVE_PERLDOC := @HAVE_PERLDOC@
28 HAVE_QEMU := @HAVE_QEMU@
29 HAVE_QEMU_KVM := @HAVE_QEMU_KVM@
30 HAVE_LIVECD_CREATOR := @HAVE_LIVECD_CREATOR@
31
32 LABEL    := $(PACKAGE)-$(VERSION)
33 ISO      := $(LABEL).iso
34
35 #----------------------------------------------------------------------
36
37 all:
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)"
44
45 # Build live CD.
46
47 ifeq ($(HAVE_LIVECD_CREATOR),livecd-creator)
48
49 build:  p2v.ks checkroot checkscript
50         rm -f $(ISO)
51         livecd-creator --config=$< --fslabel=$(LABEL)
52         ls -lhtr *.iso
53
54 endif
55
56 # Run live CD under qemu.
57
58 ifeq ($(HAVE_QEMU_KVM),qemu-kvm)
59 QEMU    := qemu-kvm
60 else
61 ifeq ($(HAVE_QEMU),qemu)
62 QEMU    := qemu
63 endif
64 endif
65
66 ifneq ($(QEMU),)
67 HDA     :=
68 HDB     :=
69
70 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
71 ifneq ($(HDA),)
72 QEMU_ARGS += -hda $(HDA)
73 endif
74 ifneq ($(HDB),)
75 QEMU_ARGS += -hdb $(HDB)
76 endif
77
78 boot:
79         $(QEMU) $(QEMU_ARGS)
80 endif
81
82 # Update an existing ISO.
83
84 update: checkroot checkscript
85         -./iso-attach delete $(ISO)
86         ./iso-attach add $(ISO) virt-p2v
87
88 # Check that we are root.
89
90 checkroot:
91         @if [ `id -u` -ne 0 ]; then \
92           echo "You must be root to perform this operation."; \
93           exit 1; \
94         fi
95
96 # Check that the script compiles.
97
98 checkscript:
99         ./virt-p2v --test
100
101 # Clean.
102
103 clean:
104         rm -f *~ core livecd.ks livecd-post.sh
105
106 # Manifest.
107
108 dist:
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
116
117 check-manifest:
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; \
122         exit $$rv
123
124 # Manual page.
125
126 ifeq ($(HAVE_PERLDOC),perldoc)
127
128 MAN_SECTION := Virtualization Support
129
130 man: virt-p2v.1 virt-p2v.1.txt virt-p2v.1.html
131
132 virt-p2v.1: virt-p2v.pod
133         pod2man -c "$(MAN_SECTION)" --release "$(PACKAGE)-$(VERSION)" $< > $@
134
135 virt-p2v.1.txt: virt-p2v.pod
136         pod2text $< > $@
137
138 virt-p2v.1.html: virt-p2v.pod
139         pod2html -css virt-p2v.1.css $< > $@
140
141 endif
142
143 # Website.
144
145 WEBSITE_DIR := ../redhat/et-website/virt-p2v
146
147 website: man dist
148         cp virt-p2v.1.html $(WEBSITE_DIR)
149         cp virt-p2v.1.css $(WEBSITE_DIR)
150         cp $(PACKAGE)-$(VERSION).tar.gz $(WEBSITE_DIR)
151
152 .PHONY: build boot checkroot