Use correct @PACKAGE_foo@ macros.
[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 # i386 images also work on x86-64, so best to stick with i386.
33 ARCH     := i386
34
35 # Base repository.
36 BASE     := 8
37 BASEURL  := http://download.fedora.redhat.com/pub/fedora/linux/releases/$(BASE)/Everything/$(ARCH)/os/
38
39 LANG     := en_US.UTF-8
40 KEYBOARD := us
41 TIMEZONE := US/Eastern
42
43 LABEL    := $(PACKAGE)-$(VERSION)
44
45 ISO      := $(LABEL).iso
46
47 #----------------------------------------------------------------------
48
49 all:
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)"
56
57 # Build live CD.
58
59 ifeq ($(HAVE_LIVECD_CREATOR),livecd-creator)
60
61 build: checkroot checkscript livecd.ks
62         rm -f $(ISO)
63         livecd-creator --config=livecd.ks --fslabel=$(LABEL)
64         ls -lhtr *.iso
65
66 livecd.ks: livecd.ks.in livecd-post.sh Makefile
67         rm -f $@
68         sed \
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 > $@
76
77 livecd-post.sh: livecd-post.sh.in virt-p2v virt-p2v-update-wrapper iso-attach inittab lvm.conf Makefile
78         rm -f $@
79         sed \
80           -e '/@VIRT-P2V@/ r virt-p2v' \
81           -e '/@VIRT-P2V@/ d' \
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' \
87           -e '/@INITTAB@/ d' \
88           -e '/@LVM.CONF@/ r lvm.conf' \
89           -e '/@LVM.CONF@/ d' \
90           < $< > $@
91
92 endif
93
94 # Run live CD under qemu.
95
96 ifeq ($(HAVE_QEMU_KVM),qemu-kvm)
97 QEMU    := qemu-kvm
98 else
99 ifeq ($(HAVE_QEMU),qemu)
100 QEMU    := qemu
101 endif
102 endif
103
104 ifneq ($(QEMU),)
105 HDA     :=
106 HDB     :=
107
108 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
109 ifneq ($(HDA),)
110 QEMU_ARGS += -hda $(HDA)
111 endif
112 ifneq ($(HDB),)
113 QEMU_ARGS += -hdb $(HDB)
114 endif
115
116 boot:
117         $(QEMU) $(QEMU_ARGS)
118 endif
119
120 # Update an existing ISO.
121
122 update: checkroot checkscript
123         -./iso-attach delete $(ISO)
124         ./iso-attach add $(ISO) virt-p2v
125
126 # Check that we are root.
127
128 checkroot:
129         @if [ `id -u` -ne 0 ]; then \
130           echo "You must be root to perform this operation."; \
131           exit 1; \
132         fi
133
134 # Check that the script compiles.
135
136 checkscript:
137         ./virt-p2v --test
138
139 # Clean.
140
141 clean:
142         rm -f *~ core livecd.ks livecd-post.sh
143
144 # Manifest.
145
146 dist:
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
154
155 check-manifest:
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; \
160         exit $$rv
161
162 # Manual page.
163
164 ifeq ($(HAVE_PERLDOC),perldoc)
165
166 MAN_SECTION := Virtualization Support
167
168 man: virt-p2v.1 virt-p2v.1.txt virt-p2v.1.html
169
170 virt-p2v.1: virt-p2v.pod
171         pod2man -c "$(MAN_SECTION)" --release "$(PACKAGE)-$(VERSION)" $< > $@
172
173 virt-p2v.1.txt: virt-p2v.pod
174         pod2text $< > $@
175
176 virt-p2v.1.html: virt-p2v.pod
177         pod2html -css virt-p2v.1.css $< > $@
178
179 endif
180
181 # Website.
182
183 WEBSITE_DIR := ../redhat/et-website/virt-p2v
184
185 website: man dist
186         cp virt-p2v.1.html $(WEBSITE_DIR)
187         cp virt-p2v.1.css $(WEBSITE_DIR)
188         cp $(PACKAGE)-$(VERSION).tar.gz $(WEBSITE_DIR)
189
190 .PHONY: build boot checkroot