kvm: qemu: ia64: hw/ipf.c apic_set_irq_delivered() build fix
[kvm-userspace.git] / Makefile
blob617504cafbc585ea01a3813fcea7ad9411dc6f0e
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 # sync if kernel/Makefile exists and if using --with-patched-kernel
32 user libkvm qemu: header-sync-$(if $(wildcard kernel/Makefile),$(if $(WANT_MODULE),n,y),n)
34 header-sync-n:
36 header-sync-y:
37 make -C kernel \
38 LINUX=$(if $(KERNELSOURCEDIR),$(KERNELSOURCEDIR),$(KERNELDIR)) \
39 header-sync
40 rm -f kernel/include/asm
41 ln -sf asm-$(sane-arch) kernel/include/asm
43 bios:
44 $(MAKE) -C $@
45 cp bios/BIOS-bochs-latest qemu/pc-bios/bios.bin
47 vgabios:
48 $(MAKE) -C $@
49 cp vgabios/VGABIOS-lgpl-latest.bin qemu/pc-bios/vgabios.bin
50 cp vgabios/VGABIOS-lgpl-latest.cirrus.bin qemu/pc-bios/vgabios-cirrus.bin
52 extboot:
53 $(MAKE) -C $@
54 if ! [ -f qemu/pc-bios/extboot.bin ] \
55 || ! cmp -s qemu/pc-bios/extboot.bin extboot/extboot.bin; then \
56 cp extboot/extboot.bin qemu/pc-bios/extboot.bin; \
58 libfdt:
59 $(MAKE) -C $@
61 LINUX=linux-2.6
63 sync:
64 make -C kernel sync LINUX=$(shell readlink -f "$(LINUX)")
66 bindir = /usr/bin
67 bin = $(bindir)/kvm
68 initdir = /etc/init.d
69 confdir = /etc/kvm
70 utilsdir = /etc/kvm/utils
72 install-rpm:
73 mkdir -p $(DESTDIR)/$(bindir)
74 mkdir -p $(DESTDIR)/$(confdir)
75 mkdir -p $(DESTDIR)/$(initdir)
76 mkdir -p $(DESTDIR)/$(utilsdir)
77 mkdir -p $(DESTDIR)/etc/udev/rules.d
78 make -C qemu DESTDIR=$(DESTDIR)/ install
79 ln -sf /usr/kvm/bin/qemu-system-x86_64 $(DESTDIR)/$(bin)
80 install -m 755 kvm_stat $(DESTDIR)/$(bindir)/kvm_stat
81 cp scripts/kvm $(DESTDIR)/$(initdir)/kvm
82 cp scripts/qemu-ifup $(DESTDIR)/$(confdir)/qemu-ifup
83 install -t $(DESTDIR)/etc/udev/rules.d scripts/*kvm*.rules
85 install:
86 $(kcmd)make -C kernel DESTDIR="$(DESTDIR)" install
87 make -C libkvm DESTDIR="$(DESTDIR)" install
88 make -C qemu DESTDIR="$(DESTDIR)" install
90 tmpspec = .tmp.kvm.spec
91 RPMTOPDIR = $$(pwd)/rpmtop
93 rpm: srpm
94 rm -rf $(RPMTOPDIR)/BUILD
95 mkdir -p $(RPMTOPDIR)/{BUILD,RPMS/$$(uname -i)}
96 rpmbuild --rebuild \
97 --define="_topdir $(RPMTOPDIR)" \
98 $(RPMTOPDIR)/SRPMS/kvm-0.0-$(rpmrelease).src.rpm
100 srpm:
101 mkdir -p $(RPMTOPDIR)/{SOURCES,SRPMS}
102 sed 's/^Release:.*/Release: $(rpmrelease)/' kvm.spec > $(tmpspec)
103 tar czf $(RPMTOPDIR)/SOURCES/kvm.tar.gz qemu
104 tar czf $(RPMTOPDIR)/SOURCES/user.tar.gz user
105 tar czf $(RPMTOPDIR)/SOURCES/libkvm.tar.gz libkvm
106 tar czf $(RPMTOPDIR)/SOURCES/kernel.tar.gz kernel
107 tar czf $(RPMTOPDIR)/SOURCES/scripts.tar.gz scripts
108 tar czf $(RPMTOPDIR)/SOURCES/extboot.tar.gz extboot
109 cp Makefile configure kvm_stat $(RPMTOPDIR)/SOURCES
110 rpmbuild --define="_topdir $(RPMTOPDIR)" -bs $(tmpspec)
111 $(RM) $(tmpspec)
113 clean:
114 for i in $(if $(WANT_MODULE), kernel) user libkvm qemu libfdt; do \
115 make -C $$i clean; \
116 done
117 rm -f ./cscope.*
119 distclean: clean
120 rm -f config.mak user/config.mak
122 cscope:
123 rm -f ./cscope.*
124 find . -wholename './kernel' -prune -o -name "*.[ch]" -print > ./cscope.files
125 cscope -b