# the COPYING file in the top-level directory.
#
-firmwaredir ?= /lib/firmware
-
-# all directories listed here will be created using a generic rule below
-INSTALL_DIRECTORIES := $(DESTDIR)$(firmwaredir)
-
-INSTALL ?= install
-INSTALL_DATA ?= $(INSTALL) -m 644
-INSTALL_DIR ?= $(INSTALL) -d -m 755
-
# no recipes above this one (also no includes)
all: modules tools
+# includes installation-related variables and definitions
+include scripts/install.mk
+
# out-of-tree build for our kernel-module, firmware and inmates
KDIR ?= /lib/modules/`uname -r`/build
$(run-kbuild)
$(MAKE) -C tools $@
-# create all necessary install-directories
-$(INSTALL_DIRECTORIES):
- $(INSTALL_DIR) $@
-
modules_install: modules
$(run-kbuild)
depmod -aq
firmware_install: hypervisor/jailhouse.bin $(DESTDIR)$(firmwaredir)
- $(INSTALL_DATA) $(filter-out $(lastword $^),$^) $(lastword $^)
+ $(INSTALL_DATA) $^
install: modules_install firmware_install
$(MAKE) -C tools $@
--- /dev/null
+#
+# Jailhouse, a Linux-based partitioning hypervisor
+#
+# Copyright (c) Siemens AG, 2014
+#
+# Authors:
+# Jan Kiszka <jan.kiszka@siemens.com>
+# Benjamin Block <bebl@mageta.org>
+#
+# This work is licensed under the terms of the GNU GPL, version 2. See
+# the COPYING file in the top-level directory.
+#
+
+prefix ?= /usr/local
+exec_prefix ?= $(prefix)
+bindir ?= $(exec_prefix)/bin
+libexecdir ?= $(exec_prefix)/libexec
+datarootdir ?= $(prefix)/share
+datadir ?= $(datarootdir)
+firmwaredir ?= /lib/firmware
+
+# all directories listed here will be created using a generic rule below
+INSTALL_DIRECTORIES := $(prefix) \
+ $(exec_prefix) \
+ $(bindir) \
+ $(libexecdir) \
+ $(datarootdir) \
+ $(datadir) \
+ $(firmwaredir)
+
+INSTALL ?= install
+INSTALL_PROGRAM ?= $(INSTALL)
+INSTALL_DATA ?= $(INSTALL) -m 644
+INSTALL_DIR ?= $(INSTALL) -d -m 755
+
+# creates a rule for each dir in $(INSTALL_DIRECTORIES) under the current
+# $(DESTDIR) and additionally to that for each of these dirs a subdir named
+# `jailhouse`. These can be used as prerequirement for install-rules and will
+# thus be created on demand (or not at all if not used in that way).
+$(sort $(INSTALL_DIRECTORIES:%=$(DESTDIR)%) \
+ $(INSTALL_DIRECTORIES:%=$(DESTDIR)%/jailhouse)):
+ $(INSTALL_DIR) $@
# the COPYING file in the top-level directory.
#
-prefix ?= /usr/local
-exec_prefix ?= $(prefix)
-bindir ?= $(exec_prefix)/bin
-libexecdir ?= $(exec_prefix)/libexec
-datarootdir ?= $(prefix)/share
-datadir ?= $(datarootdir)
-
ifeq ($(V),1)
Q =
else
Q = @
endif
-INSTALL ?= install
-INSTALL_PROGRAM ?= $(INSTALL)
-INSTALL_DATA ?= $(INSTALL) -m 644
-INSTALL_DIR ?= $(INSTALL) -d -m 755
-
CC = $(CROSS_COMPILE)gcc
CFLAGS = -g -O3 -I.. -DLIBEXECDIR=\"$(libexecdir)\" \
sed -i 's|^datadir = None|datadir = "$(datadir)"|' $1
endef
+# no recipes above this one (also no includes)
all: $(TARGETS)
+# includes installation-related variables and definitions
+include ../scripts/install.mk
+
jailhouse: jailhouse.c ../jailhouse.h ../VERSION
$(CC) $(CFLAGS) -o $@ $<
./$< -g $@
$(Q)chmod +x $@
-install-bin: $(INST_TARGETS)
- $(INSTALL_DIR) $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) $^ $(DESTDIR)$(bindir)
+install-bin: $(INST_TARGETS) $(DESTDIR)$(bindir)
+ $(INSTALL_PROGRAM) $^
-install-libexec: $(HELPERS)
- $(INSTALL_DIR) $(DESTDIR)$(libexecdir)/jailhouse
- $(INSTALL_PROGRAM) $^ $(DESTDIR)$(libexecdir)/jailhouse
- $(Q)$(call patch_datadir_var, \
- $(DESTDIR)$(libexecdir)/jailhouse/jailhouse-config-create)
+install-libexec: $(HELPERS) $(DESTDIR)$(libexecdir)/jailhouse
+ $(INSTALL_PROGRAM) $^
+ $(Q)$(call patch_datadir_var, $(lastword $^)/jailhouse-config-create)
-install-data: $(TEMPLATES)
- $(INSTALL_DIR) $(DESTDIR)$(datadir)/jailhouse
- $(INSTALL_DATA) $^ $(DESTDIR)$(datadir)/jailhouse
+install-data: $(TEMPLATES) $(DESTDIR)$(datadir)/jailhouse
+ $(INSTALL_DATA) $^
install: install-bin install-libexec install-data