]> rtime.felk.cvut.cz Git - jailhouse.git/blobdiff - tools/Makefile
tools: Add configuration generator
[jailhouse.git] / tools / Makefile
index bfddc3b3cf4908a905a7096a3579acbb4c103fd4..45554e4c353d19f9190ac15364711a7e87cad6dd 100644 (file)
@@ -15,8 +15,34 @@ CC = $(CROSS_COMPILE)gcc
 CFLAGS = -g -O3 -I.. -I../hypervisor/include \
        -Wall -Wmissing-declarations -Wmissing-prototypes
 
+TARGETS := jailhouse
+
+HAS_PYTHON_MAKO := \
+       $(shell python -c "from mako.template import Template" 2>/dev/null \
+       && echo yes)
+
+ifeq ($(strip $(HAS_PYTHON_MAKO)), yes)
+       TARGETS += jailhouse-config-collect
+else
+       TARGETS += no_python_mako
+endif
+
+all: $(TARGETS)
+
 jailhouse: jailhouse.c ../jailhouse.h ../hypervisor/include/jailhouse/cell-config.h
        $(CC) $(CFLAGS) -o $@ $<
 
+jailhouse-config-collect: jailhouse-config-create jailhouse-config-collect.tmpl
+       ./$< -g $@
+       chmod +x $@
+
+.PHONY: clean no_python_mako
+
 clean:
-       rm -f jailhouse
+       rm -f $(TARGETS)
+
+no_python_mako:
+       @echo -ne "WARNING: Could not create the helper script to generate" \
+                 "configurations on remote machines" \
+                 "(\"jailhouse-conf-collect\"). You need Python and the" \
+                 "Mako library for it.\n"