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