2 # Jailhouse, a Linux-based partitioning hypervisor
4 # Copyright (c) Siemens AG, 2013, 2014
7 # Jan Kiszka <jan.kiszka@siemens.com>
9 # This work is licensed under the terms of the GNU GPL, version 2. See
10 # the COPYING file in the top-level directory.
14 exec_prefix ?= $(prefix)
15 bindir ?= $(exec_prefix)/bin
16 libexecdir ?= $(exec_prefix)/libexec
17 datarootdir ?= $(prefix)/share
18 datadir ?= $(datarootdir)
27 INSTALL_PROGRAM ?= $(INSTALL)
28 INSTALL_DATA ?= $(INSTALL) -m 644
29 INSTALL_DIR ?= $(INSTALL) -d -m 755
31 CC = $(CROSS_COMPILE)gcc
33 CFLAGS = -g -O3 -I.. -DLIBEXECDIR=\"$(libexecdir)\" \
34 -Wall -Wmissing-declarations -Wmissing-prototypes
38 INST_TARGETS := $(TARGETS)
41 jailhouse-cell-stats \
42 jailhouse-config-create
43 TEMPLATES := jailhouse-config-collect.tmpl root-cell-config.c.tmpl
46 $(shell python -c "from mako.template import Template" 2>/dev/null \
49 ifeq ($(strip $(HAS_PYTHON_MAKO)), yes)
50 TARGETS += jailhouse-config-collect
51 HELPERS += jailhouse-config-collect
53 TARGETS += no_python_mako
56 define patch_datadir_var
57 sed -i 's|^datadir = None|datadir = "$(datadir)"|' $1
62 jailhouse: jailhouse.c ../jailhouse.h
63 $(CC) $(CFLAGS) -o $@ $<
65 jailhouse-config-collect: jailhouse-config-create jailhouse-config-collect.tmpl
69 install-bin: $(INST_TARGETS)
70 $(INSTALL_DIR) $(DESTDIR)$(bindir)
71 $(INSTALL_PROGRAM) $^ $(DESTDIR)$(bindir)
73 install-libexec: $(HELPERS)
74 $(INSTALL_DIR) $(DESTDIR)$(libexecdir)/jailhouse
75 $(INSTALL_PROGRAM) $^ $(DESTDIR)$(libexecdir)/jailhouse
76 $(Q)$(call patch_datadir_var, \
77 $(DESTDIR)$(libexecdir)/jailhouse/jailhouse-config-create)
79 install-data: $(TEMPLATES)
80 $(INSTALL_DIR) $(DESTDIR)$(datadir)/jailhouse
81 $(INSTALL_DATA) $^ $(DESTDIR)$(datadir)/jailhouse
83 install: install-bin install-libexec install-data
89 @echo -ne "WARNING: Could not create the helper script to generate" \
90 "configurations on remote machines" \
91 "(\"jailhouse-conf-collect\"). You need Python and the" \
92 "Mako library for it.\n"
94 .PHONY: install install-bin install-libexec install-data clean no_python_mako