]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Add 'install' target to Makefile
authorPekka Enberg <penberg@kernel.org>
Fri, 17 Aug 2012 07:51:05 +0000 (10:51 +0300)
committerPekka Enberg <penberg@kernel.org>
Fri, 17 Aug 2012 07:51:05 +0000 (10:51 +0300)
Add a new 'install' target to Makefile that installs 'lkvm' binary to
$HOME/bin by default. The installed binary still needs to be launched
from linux/tools/kvm directory because of our silly external dependency
to stage 2 guest init file:

  [penberg@tux ~]$ lkvm run
    Fatal: Failed linking stage 2 of init.

The most convinent way to fix that is to embed the stage 2 image in
'lkvm' executable like we do with our mini-BIOS.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/Makefile

index f9e1ec19264047c2abd306406b3808250865cf7c..924b1912b6b424e744cf4e045d625c67a1a7ddc3 100644 (file)
@@ -24,6 +24,14 @@ CC   := $(CROSS_COMPILE)$(CC)
 FIND   := find
 CSCOPE := cscope
 TAGS   := ctags
+INSTALL := install
+
+prefix = $(HOME)
+bindir_relative = bin
+bindir = $(prefix)/$(bindir_relative)
+
+DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
+bindir_SQ = $(subst ','\'',$(bindir))
 
 PROGRAM        := lkvm
 PROGRAM_ALIAS := vm
@@ -380,6 +388,12 @@ check: all
        ./$(PROGRAM) run -d tests/boot/boot_test.iso -p "init=init"
 .PHONY: check
 
+install: all
+       $(E) "  INSTALL"
+       $(Q) $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' 
+       $(Q) $(INSTALL) $(PROGRAM) '$(DESTDIR_SQ)$(bindir_SQ)' 
+.PHONY: install
+
 clean:
        $(E) "  CLEAN"
        $(Q) rm -f x86/bios/*.bin