the prefix is unneeded since the make install target uses a destdir parameter
[kvm-coreboot.git] / packages / kvm / kvm.mk
blobe9588cc48c887341b5652395fd16ed8e3086438c
1 KVM_URL=http://heanet.dl.sourceforge.net/sourceforge/kvm
2 KVM_VERSION=72
3 KVM_SOURCE=kvm-$(KVM_VERSION).tar.gz
4 KVM_DIR=$(BUILD_DIR)/kvm
5 KVM_SRC_DIR=$(KVM_DIR)/kvm-$(KVM_VERSION)
6 KVM_STAMP_DIR=$(KVM_DIR)/stamps
8 KVM_PATCHES=$(PACKAGE_DIR)/kvm/patches
10 $(SOURCE_DIR)/$(KVM_SOURCE):
11 mkdir -p $(SOURCE_DIR)
12 @ wget $(WGET_Q) -P $(SOURCE_DIR) $(KVM_URL)/$(KVM_SOURCE)
14 $(KVM_STAMP_DIR)/.unpacked: $(SOURCE_DIR)/$(KVM_SOURCE)
15 tar -C $(KVM_DIR) -zxf $(SOURCE_DIR)/$(KVM_SOURCE)
16 touch $@
18 $(KVM_STAMP_DIR)/.patched: $(KVM_STAMP_DIR)/.unpacked
19 @ echo "Patching kvm..."
20 @ $(BIN_DIR)/doquilt.sh $(KVM_SRC_DIR) $(KVM_PATCHES)
21 @ echo "all:" > $(KVM_SRC_DIR)/user/Makefile #an ugly hack to disable these make targets
22 @ echo "all:" > $(KVM_SRC_DIR)/kernel/Makefile
23 @ echo "all:" > $(KVM_SRC_DIR)/bios/Makefile
24 @ touch $@
27 $(KVM_STAMP_DIR)/.configured: $(KVM_STAMP_DIR)/.patched
28 @ echo "Configuring kvm..."
29 @ ( cd $(KVM_SRC_DIR); ./configure \
30 --arch=i686 \
31 --disable-sdl \
32 --disable-gfx-check \
33 --disable-curses )
34 @ touch $@
36 $(KVM_SRC_DIR)/.built: $(KVM_STAMP_DIR)/.configured
37 @ echo "Building kvm..."
38 @ $(MAKE) \
39 CFLAGS="$(CFLAGS) -nostdinc -fno-builtin \
40 -I../../libkvm -I../libkvm \
41 -isystem $(STAGING_DIR)/include " \
42 LDFLAGS="$(LDFLAGS) -nostdlib -L $(STAGING_DIR)/lib \
43 -Wl,-rpath-link, $(STAGING_DIR)/lib \
44 -Wl,--dynamic-linker,/lib/ld-uClibc.so.0 \
45 -Wl,--warn-common -Wl,--sort-common \
46 -lm -Wall -print-search-dirs " kcmd='#' \
47 -C $(KVM_SRC_DIR)
48 @ touch $@
50 $(INITRD_DIR)/bin/kvm: $(KVM_SRC_DIR)/.built
51 @ echo "Installing kvm..."
52 @ $(MAKE) DESTDIR=$(INITRD_DIR) kcmd='#' \
53 LDFLAGS="$(LDFLAGS) -nostdlib -L $(STAGING_DIR)/lib \
54 -Wl,-rpath-link, $(STAGING_DIR)/lib \
55 -Wl,--dynamic-linker,/lib/ld-uClibc.so.0 \
56 -Wl,--warn-common -Wl,--sort-common \
57 -lm -Wall -print-search-dirs " kcmd='#' \
58 -C $(KVM_SRC_DIR) install
59 # @ strip -s $(KVM_SRC_DIR)/qemu/qemu-nbd
60 # @ strip -s $(KVM_SRC_DIR)/qemu/qemu-img
61 # @ strip -s $(KVM_SRC_DIR)/qemu/x86_64-softmmu/kvm
63 # @ install -T $(KVM_SRC_DIR)/qemu/qemu-img $(INITRD_DIR)/usr/bin/kvm-img
64 # @ install $(KVM_SRC_DIR)/qemu/qemu-nbd $(INITRD_DIR)/usr/bin
65 # @ install -m 0644 -T -D $(KVM_SRC_DIR)/scripts/qemu-ifup $(INITRD_DIR)/etc/kvm/kvm-ifup
66 # @ install -m 0644 -T $(KVM_SRC_DIR)/scripts/qemu-ifdown $(INITRD_DIR)/etc/kvm/kvm-ifdown
67 # @ install -m 0644 -d $(KVM_SRC_DIR)/scripts/65-kvm.rules $(INITRD_DIR)/etc/udev/rules.d
68 # @ install $(KVM_SRC_DIR)/qemu/x86_64-softmmu/kvm $(INITRD_DIR)/usr/bin
69 # @ install -m 0644 $(KVM_SRC_DIR)/libkvm/libkvm.a $(INITRD_DIR)/usr/lib64
74 $(KVM_STAMP_DIR):
75 mkdir -p $@
77 kvm: $(KVM_STAMP_DIR) $(INITRD_DIR)/bin/kvm
79 kvm-clean:
80 @ rm -f $(KVM_STAMP_DIR)/.configured
81 ifneq ($(wildcard $(KVM_SRC_DIR)/Makefile),)
82 $(MAKE) -C $(KVM_SRC_DIR) clean
83 endif
84 kvm-distclean:
85 rm -rf $(KVM_DIR)/*