kvm: qemu: fix leak of ioperm data
[kvm-userspace.git] / Makefile
bloba7ce0ba13da0b6aaa2449050e3f975fa7ba818bf
2 include config.mak
4 DESTDIR=
6 rpmrelease = devel
8 sane-arch = $(subst i386,x86,$(subst x86_64,x86,$(subst s390x,s390,$(ARCH))))
10 .PHONY: kernel user libkvm qemu bios vgabios extboot clean libfdt cscope
12 all: libkvm qemu
13 ifneq '$(filter $(ARCH), x86_64 i386 ia64)' ''
14 all: $(if $(WANT_MODULE), kernel) user
15 endif
17 kcmd = $(if $(WANT_MODULE),,@\#)
19 qemu kernel user libkvm:
20 $(MAKE) -C $@
22 qemu: libkvm
23 ifneq '$(filter $(ARCH), i386 x86_64)' ''
24 qemu: extboot
25 endif
26 ifneq '$(filter $(ARCH), powerpc ia64)' ''
27 qemu: libfdt
28 endif
29 user: libkvm
31 user libkvm qemu: header-sync-$(if $(WANT_MODULE),n,y)
33 header-sync-n:
35 header-sync-y:
36 make -C kernel \
37 LINUX=$(if $(KERNELSOURCEDIR),$(KERNELSOURCEDIR),$(KERNELDIR)) \
38 header-sync
39 rm -f kernel/include/asm
40 ln -sf asm-$(sane-arch) kernel/include/asm
42 bios:
43 $(MAKE) -C $@
44 cp bios/BIOS-bochs-latest qemu/pc-bios/bios.bin
46 vgabios:
47 $(MAKE) -C $@
48 cp vgabios/VGABIOS-lgpl-latest.bin qemu/pc-bios/vgabios.bin
49 cp vgabios/VGABIOS-lgpl-latest.cirrus.bin qemu/pc-bios/vgabios-cirrus.bin
51 extboot:
52 $(MAKE) -C $@
53 if ! [ -f qemu/pc-bios/extboot.bin ] \
54 || ! cmp -s qemu/pc-bios/extboot.bin extboot/extboot.bin; then \
55 cp extboot/extboot.bin qemu/pc-bios/extboot.bin; \
57 libfdt:
58 $(MAKE) -C $@
60 LINUX=linux-2.6
62 sync:
63 make -C kernel sync LINUX=$(shell readlink -f "$(LINUX)")
65 bindir = /usr/bin
66 bin = $(bindir)/kvm
67 initdir = /etc/init.d
68 confdir = /etc/kvm
69 utilsdir = /etc/kvm/utils
71 install-rpm:
72 mkdir -p $(DESTDIR)/$(bindir)
73 mkdir -p $(DESTDIR)/$(confdir)
74 mkdir -p $(DESTDIR)/$(initdir)
75 mkdir -p $(DESTDIR)/$(utilsdir)
76 mkdir -p $(DESTDIR)/etc/udev/rules.d
77 make -C qemu DESTDIR=$(DESTDIR)/ install
78 ln -sf /usr/kvm/bin/qemu-system-x86_64 $(DESTDIR)/$(bin)
79 install -m 755 kvm_stat $(DESTDIR)/$(bindir)/kvm_stat
80 cp scripts/kvm $(DESTDIR)/$(initdir)/kvm
81 cp scripts/qemu-ifup $(DESTDIR)/$(confdir)/qemu-ifup
82 install -t $(DESTDIR)/etc/udev/rules.d scripts/*kvm*.rules
84 install:
85 $(kcmd)make -C kernel DESTDIR="$(DESTDIR)" install
86 make -C libkvm DESTDIR="$(DESTDIR)" install
87 make -C qemu DESTDIR="$(DESTDIR)" install
89 tmpspec = .tmp.kvm.spec
90 RPMTOPDIR = $$(pwd)/rpmtop
92 rpm: srpm
93 rm -rf $(RPMTOPDIR)/BUILD
94 mkdir -p $(RPMTOPDIR)/{BUILD,RPMS/$$(uname -i)}
95 rpmbuild --rebuild \
96 --define="_topdir $(RPMTOPDIR)" \
97 $(RPMTOPDIR)/SRPMS/kvm-0.0-$(rpmrelease).src.rpm
99 srpm:
100 mkdir -p $(RPMTOPDIR)/{SOURCES,SRPMS}
101 sed 's/^Release:.*/Release: $(rpmrelease)/' kvm.spec > $(tmpspec)
102 tar czf $(RPMTOPDIR)/SOURCES/kvm.tar.gz qemu
103 tar czf $(RPMTOPDIR)/SOURCES/user.tar.gz user
104 tar czf $(RPMTOPDIR)/SOURCES/libkvm.tar.gz libkvm
105 tar czf $(RPMTOPDIR)/SOURCES/kernel.tar.gz kernel
106 tar czf $(RPMTOPDIR)/SOURCES/scripts.tar.gz scripts
107 tar czf $(RPMTOPDIR)/SOURCES/extboot.tar.gz extboot
108 cp Makefile configure kvm_stat $(RPMTOPDIR)/SOURCES
109 rpmbuild --define="_topdir $(RPMTOPDIR)" -bs $(tmpspec)
110 $(RM) $(tmpspec)
112 clean:
113 for i in $(if $(WANT_MODULE), kernel) user libkvm qemu libfdt; do \
114 make -C $$i clean; \
115 done
116 rm -f ./cscope.*
118 distclean: clean
119 rm -f config.mak user/config.mak
121 cscope:
122 rm -f ./cscope.*
123 find . -wholename './kernel' -prune -o -name "*.[ch]" -print > ./cscope.files
124 cscope -b