]> rtime.felk.cvut.cz Git - jailhouse.git/blob - tools/Makefile
tools, inmates: Add "cell linux" subcommand to jailhouse tool
[jailhouse.git] / tools / 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 CC = $(CROSS_COMPILE)gcc
14
15 CFLAGS = -g -O3 -I../driver -DLIBEXECDIR=\"$(libexecdir)\" \
16         -Wall -Wmissing-declarations -Wmissing-prototypes \
17         -DJAILHOUSE_VERSION=\"$(shell cat ../VERSION)\"
18
19 TARGETS := jailhouse
20
21 INST_TARGETS := $(TARGETS)
22 HELPERS := \
23         jailhouse-cell-linux \
24         jailhouse-cell-list \
25         jailhouse-cell-stats \
26         jailhouse-config-create
27 TEMPLATES := jailhouse-config-collect.tmpl root-cell-config.c.tmpl
28
29 HAS_PYTHON_MAKO := \
30         $(shell python -c "from mako.template import Template" 2>/dev/null \
31         && echo yes)
32
33 ifeq ($(strip $(HAS_PYTHON_MAKO)), yes)
34         TARGETS += jailhouse-config-collect
35         HELPERS += jailhouse-config-collect
36 else
37         TARGETS += no_python_mako
38 endif
39
40 define patch_dirvar
41         sed -i 's|^$1 = None|$1 = "$($1)"|' $2
42 endef
43
44 # no recipes above this one (also no includes)
45 all: $(TARGETS)
46
47 # includes installation-related variables and definitions
48 include ../scripts/include.mk
49
50 jailhouse: jailhouse.c ../driver/jailhouse.h ../VERSION
51         $(CC) $(CFLAGS) -o $@ $<
52
53 jailhouse-config-collect: jailhouse-config-create jailhouse-config-collect.tmpl
54         ./$< -g $@
55         $(Q)chmod +x $@
56
57 install-bin: $(INST_TARGETS) $(DESTDIR)$(sbindir)
58         $(INSTALL_PROGRAM) $^
59
60 install-libexec: $(HELPERS) $(DESTDIR)$(libexecdir)/jailhouse
61         $(INSTALL_PROGRAM) $^
62         $(Q)$(call patch_dirvar,libexecdir,$(lastword $^)/jailhouse-cell-linux)
63         $(Q)$(call patch_dirvar,datadir,$(lastword $^)/jailhouse-config-create)
64
65 install-data: $(TEMPLATES) $(DESTDIR)$(datadir)/jailhouse
66         $(INSTALL_DATA) $^
67
68 install: install-bin install-libexec install-data
69
70 clean:
71         rm -f $(TARGETS)
72
73 no_python_mako:
74         @echo -ne "WARNING: Could not create the helper script to generate" \
75                   "configurations on remote machines" \
76                   "(\"jailhouse-conf-collect\"). You need Python and the" \
77                   "Mako library for it.\n"
78
79 .PHONY: install install-bin install-libexec install-data clean no_python_mako