kvm: qemu: cleanup and improve kvm_load/save_registers usage
[kvm-userspace.git] / Makefile
blob48a8dffab2d966b1a03daf91599e1c72c8b4663a
2 include config.mak
4 DESTDIR=
6 rpmrelease = devel
8 sane-arch = $(subst i386,x86,$(subst x86_64,x86,$(ARCH)))
10 .PHONY: kernel user libkvm qemu bios vgabios extboot clean libfdt
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)' ''
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 LINUX=$(KERNELDIR) header-sync
37 rm -f kernel/include/asm
38 ln -sf asm-$(sane-arch) kernel/include/asm
40 bios:
41 $(MAKE) -C $@
42 cp bios/BIOS-bochs-latest qemu/pc-bios/bios.bin
44 vgabios:
45 $(MAKE) -C $@
46 cp vgabios/VGABIOS-lgpl-latest.bin qemu/pc-bios/vgabios.bin
47 cp vgabios/VGABIOS-lgpl-latest.cirrus.bin qemu/pc-bios/vgabios-cirrus.bin
49 extboot:
50 $(MAKE) -C $@
51 if ! [ -f qemu/pc-bios/extboot.bin ] \
52 || ! cmp -s qemu/pc-bios/extboot.bin extboot/extboot.bin; then \
53 cp extboot/extboot.bin qemu/pc-bios/extboot.bin; \
55 libfdt:
56 $(MAKE) -C $@
59 bindir = /usr/bin
60 bin = $(bindir)/kvm
61 initdir = /etc/init.d
62 confdir = /etc/kvm
63 utilsdir = /etc/kvm/utils
65 install-rpm:
66 mkdir -p $(DESTDIR)/$(bindir)
67 mkdir -p $(DESTDIR)/$(confdir)
68 mkdir -p $(DESTDIR)/$(initdir)
69 mkdir -p $(DESTDIR)/$(utilsdir)
70 mkdir -p $(DESTDIR)/etc/udev/rules.d
71 make -C qemu DESTDIR=$(DESTDIR)/ install
72 ln -sf /usr/kvm/bin/qemu-system-x86_64 $(DESTDIR)/$(bin)
73 install -m 755 kvm_stat $(DESTDIR)/$(bindir)/kvm_stat
74 cp scripts/kvm $(DESTDIR)/$(initdir)/kvm
75 cp scripts/qemu-ifup $(DESTDIR)/$(confdir)/qemu-ifup
76 install -t $(DESTDIR)/etc/udev/rules.d scripts/*kvm*.rules
78 install:
79 $(kcmd)make -C kernel DESTDIR="$(DESTDIR)" install
80 make -C libkvm DESTDIR="$(DESTDIR)" install
81 make -C qemu DESTDIR="$(DESTDIR)" install
83 tmpspec = .tmp.kvm.spec
84 RPMTOPDIR = $$(pwd)/rpmtop
86 rpm: srpm
87 rm -rf $(RPMTOPDIR)/BUILD
88 mkdir -p $(RPMTOPDIR)/{BUILD,RPMS/$$(uname -i)}
89 rpmbuild --rebuild \
90 --define="_topdir $(RPMTOPDIR)" \
91 $(RPMTOPDIR)/SRPMS/kvm-0.0-$(rpmrelease).src.rpm
93 srpm:
94 mkdir -p $(RPMTOPDIR)/{SOURCES,SRPMS}
95 sed 's/^Release:.*/Release: $(rpmrelease)/' kvm.spec > $(tmpspec)
96 tar czf $(RPMTOPDIR)/SOURCES/kvm.tar.gz qemu
97 tar czf $(RPMTOPDIR)/SOURCES/user.tar.gz user
98 tar czf $(RPMTOPDIR)/SOURCES/libkvm.tar.gz libkvm
99 tar czf $(RPMTOPDIR)/SOURCES/kernel.tar.gz kernel
100 tar czf $(RPMTOPDIR)/SOURCES/scripts.tar.gz scripts
101 tar czf $(RPMTOPDIR)/SOURCES/extboot.tar.gz extboot
102 cp Makefile configure kvm_stat $(RPMTOPDIR)/SOURCES
103 rpmbuild --define="_topdir $(RPMTOPDIR)" -bs $(tmpspec)
104 $(RM) $(tmpspec)
106 clean:
107 for i in $(if $(WANT_MODULE), kernel) user libkvm qemu libfdt; do \
108 make -C $$i clean; \
109 done
111 distclean: clean
112 rm -f config.mak user/config.mak