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