Remove bogus install of configure script.
[virt-p2v.git] / Makefile
1 # $Id$
2
3 #----------------------------------------------------------------------
4 # General configuration
5
6 PACKAGE  := virt-p2v
7 VERSION  := 0.3
8
9 # i386 images also work on x86-64, so best to stick with i386.
10 ARCH     := i386
11
12 LANG     := en_US.UTF-8
13 KEYBOARD := us
14 TIMEZONE := US/Eastern
15
16 BASEREPO := http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Fedora/$(ARCH)/os/
17
18 # Select a suitable HTTP proxy.
19 # The default assumes a local squid proxy.
20 export http_proxy := http://127.0.0.1:3128/
21 export ftp_proxy := http://127.0.0.1:3128/
22
23 LABEL    := $(PACKAGE)-$(VERSION)
24
25 #----------------------------------------------------------------------
26
27 all:
28         @echo "make build     Build the live CD ISO"
29         @echo "make boot [HDA=hda.img] [HDB=hdb.img] [ISO=livecd.iso]"
30         @echo "               Boot built/named ISO (uses qemu)"
31
32 # Build live CD.
33
34 build: checkroot livecd.ks
35         rm -f $(LABEL).iso
36         livecd-creator --config=livecd.ks --fslabel=$(LABEL)
37         ls -lhtr *.iso
38
39 livecd.ks: livecd.ks.in livecd-post.sh Makefile
40         rm -f $@
41         sed \
42           -e 's|@BASEREPO@|$(BASEREPO)|g' \
43           -e 's|@LANG@|$(LANG)|g' \
44           -e 's|@KEYBOARD@|$(KEYBOARD)|g' \
45           -e 's|@TIMEZONE@|$(TIMEZONE)|g' \
46           < $< | cat - livecd-post.sh > $@
47
48 livecd-post.sh: livecd-post.sh.in p2v.init virt-p2v.sh inittab lvm.conf Makefile
49         rm -f $@
50         sed \
51           -e '/@P2V.INIT@/ r p2v.init' \
52           -e '/@P2V.INIT@/ d' \
53           -e '/@VIRT-P2V.SH@/ r virt-p2v.sh' \
54           -e '/@VIRT-P2V.SH@/ d' \
55           -e '/@INITTAB@/ r inittab' \
56           -e '/@INITTAB@/ d' \
57           -e '/@LVM.CONF@/ r lvm.conf' \
58           -e '/@LVM.CONF@/ d' \
59           < $< > $@
60
61 # Run live CD under qemu.
62
63 QEMU    := qemu
64 ISO     := $(LABEL).iso
65 HDA     :=
66 HDB     :=
67
68 QEMU_ARGS := -m 512 -cdrom $(ISO) -boot d
69 ifneq ($(HDA),)
70 QEMU_ARGS += -hda $(HDA)
71 endif
72 ifneq ($(HDB),)
73 QEMU_ARGS += -hdb $(HDB)
74 endif
75
76 boot:
77         $(QEMU) $(QEMU_ARGS)
78
79 # Standard rules.
80
81 checkroot:
82         @if [ `id -u` -ne 0 ]; then \
83           echo "You must be root to perform this operation."; \
84           exit 1; \
85         fi
86
87 clean:
88         rm -f *~ core livecd.ks livecd-post.sh
89
90 # Manifest.
91
92 dist:
93         $(MAKE) check-manifest
94         rm -rf $(PACKAGE)-$(VERSION)
95         mkdir $(PACKAGE)-$(VERSION)
96         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
97         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
98         rm -rf $(PACKAGE)-$(VERSION)
99         ls -l $(PACKAGE)-$(VERSION).tar.gz
100
101 check-manifest:
102         @for d in `find -type d -name CVS | grep -v '^\./debian/'`; \
103         do \
104         b=`dirname $$d`/; \
105         awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \
106         sed -e "s|^|$$b|" -e "s|^\./||"; \
107         done | sort > .check-manifest; \
108         sort MANIFEST > .orig-manifest; \
109         diff -u .orig-manifest .check-manifest; rv=$$?; \
110         rm -f .orig-manifest .check-manifest; \
111         exit $$rv
112
113 .PHONY: build boot checkroot