]> rtime.felk.cvut.cz Git - jailhouse.git/blob - Makefile
tooling: add recursive tools-build and proper install-rules to the root Makefile
[jailhouse.git] / Makefile
1 #
2 # Jailhouse, a Linux-based partitioning hypervisor
3 #
4 # Copyright (c) Siemens AG, 2013, 2014
5 #
6 # Authors:
7 #  Jan Kiszka <jan.kiszka@siemens.com>
8 #
9 # This work is licensed under the terms of the GNU GPL, version 2.  See
10 # the COPYING file in the top-level directory.
11 #
12
13 firmwaredir ?= /lib/firmware
14
15 # all directories listed here will be created using a generic rule below
16 INSTALL_DIRECTORIES := $(DESTDIR)$(firmwaredir)
17
18 INSTALL      ?= install
19 INSTALL_DATA ?= $(INSTALL) -m 644
20 INSTALL_DIR  ?= $(INSTALL) -d -m 755
21
22 # no recipes above this one (also no includes)
23 all: modules tools
24
25 # out-of-tree build for our kernel-module, firmware and inmates
26 KDIR ?= /lib/modules/`uname -r`/build
27
28 define run-kbuild =
29         $(MAKE) -C $(KDIR) M=$$PWD $@
30 endef
31
32 modules:
33         $(run-kbuild)
34
35 hypervisor/jailhouse.bin: modules
36
37 # recursive build of tools
38 tools:
39         $(MAKE) -C tools
40
41 # clean up kernel and tools
42 clean:
43         $(run-kbuild)
44         $(MAKE) -C tools $@
45
46 # create all necessary install-directories
47 $(INSTALL_DIRECTORIES):
48         $(INSTALL_DIR) $@
49
50 modules_install: modules
51         $(run-kbuild)
52         depmod -aq
53
54 firmware_install: hypervisor/jailhouse.bin $(DESTDIR)$(firmwaredir)
55         $(INSTALL_DATA) $(filter-out $(lastword $^),$^) $(lastword $^)
56
57 install: modules_install firmware_install
58         $(MAKE) -C tools $@
59
60 .PHONY: modules_install install clean firmware_install modules tools