Move it up one level so the hypervisor core can make use of it
itself.
Signed-off-by: Henning Schild <
henning...@siemens.com>
Tested-by: Ralf Ramsauer <
ralf.r...@oth-regensburg.de>
diff --git a/Kbuild b/Kbuild
--- a/Kbuild
+++ b/Kbuild
@@ -1,7 +1,7 @@
#
# Jailhouse, a Linux-based partitioning hypervisor
#
-# Copyright (c) Siemens AG, 2013-2015
+# Copyright (c) Siemens AG, 2013-2017
#
# Authors:
# Jan Kiszka <
jan.k...@siemens.com>
@@ -11,12 +11,40 @@
# the COPYING file in the top-level directory.
#
+define filechk_config_mk
+( \
+ echo "\$$(foreach config,\$$(filter CONFIG_%, \
+ \$$(.VARIABLES)), \$$(eval undefine \$$(config)))"; \
+ if [ -f $(src)/hypervisor/include/jailhouse/config.h ]; then \
+ sed -e "/^#define \([^[:space:]]*\)[[:space:]]*1/!d" \
+ -e "s/^#define \([^[:space:]]*\)[[:space:]]*1/\1=y/"\
+ $(src)/hypervisor/include/jailhouse/config.h; \
+ fi \
+)
+endef
+
+FILE_CONFIG_MK := $(obj)/hypervisor/include/generated/
config.mk
+export FILE_CONFIG_MK
+$(FILE_CONFIG_MK): $(src)/Makefile FORCE
+ $(call filechk,config_mk)
+
+define filechk_version
+ $(src)/scripts/gen_version_h $(src)/
+endef
+
+FILE_VERSION_H := $(obj)/hypervisor/include/generated/version.h
+export FILE_VERSION_H
+$(FILE_VERSION_H): $(src)/Makefile FORCE
+ $(call filechk,version)
+
+FORCE:
+
subdir-y := driver hypervisor configs inmates tools
subdir-ccflags-y := -Werror
-# inmates build depends on generated
config.mk of the hypervisor,
-# and the driver needs version.h from there
-$(obj)/inmates $(obj)/driver: $(obj)/hypervisor
+# directory dependencies on generated files
+$(obj)/driver $(obj)/hypervisor: $(FILE_VERSION_H)
+$(obj)/hypervisor $(obj)/inmates $(obj)/driver: $(FILE_CONFIG_MK)
-clean-dirs := Documentation/generated
+clean-dirs := Documentation/generated hypervisor/include/generated
diff --git a/driver/Makefile b/driver/Makefile
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -20,7 +20,7 @@ jailhouse-y := cell.o main.o sysfs.o
jailhouse-$(CONFIG_PCI) += pci.o
jailhouse-$(CONFIG_OF) += vpci_template.dtb.o
-$(obj)/main.o: $(obj)/../hypervisor/include/generated/version.h
+$(obj)/main.o: $(FILE_VERSION_H)
targets += vpci_template.dtb vpci_template.dtb.S
diff --git a/hypervisor/Makefile b/hypervisor/Makefile
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -1,7 +1,7 @@
#
# Jailhouse, a Linux-based partitioning hypervisor
#
-# Copyright (c) Siemens AG, 2013-2016
+# Copyright (c) Siemens AG, 2013-2017
# Copyright (c) Valentine Sinitsyn, 2014
#
# Authors:
@@ -35,26 +35,7 @@ GCOV_PROFILE := n
CORE_OBJECTS = setup.o printk.o paging.o control.o lib.o mmio.o pci.o ivshmem.o
CORE_OBJECTS += uart.o uart-8250.o
-define filechk_config_mk
-( \
- echo "\$$(foreach config,\$$(filter CONFIG_%, \
- \$$(.VARIABLES)), \$$(eval undefine \$$(config)))"; \
- if [ -f $(src)/include/jailhouse/config.h ]; then \
- sed -e "/^#define \([^[:space:]]*\)[[:space:]]*1/!d" \
- -e "s/^#define \([^[:space:]]*\)[[:space:]]*1/\1=y/" \
- $(src)/include/jailhouse/config.h; \
- fi \
-)
-endef
-
-$(obj)/include/generated/
config.mk: Makefile FORCE
- $(call filechk,config_mk)
-
-define filechk_version
- $(src)/../scripts/gen_version_h $(src)/..
-endef
-
-clean-dirs := include/generated arch/$(SRCARCH)/include/generated
+clean-dirs := arch/$(SRCARCH)/include/generated
define sed-y
"/^=>/{s:=>#\(.*\):/* \1 */:; \
@@ -91,17 +72,13 @@ targets := $(defines-file) arch/$(SRCARC
$(Q)mkdir -p $(dir $@)
$(call cmd,defines)
-$(obj)/include/generated/version.h: $(src)/Makefile FORCE
- $(call filechk,version)
-
$(foreach co,$(CORE_OBJECTS),\
$(eval $(obj)/$(co): $(obj)/$(defines-file)))
-$(obj)/setup.o: $(obj)/include/generated/version.h
+$(obj)/setup.o: $(FILE_VERSION_H)
-arch-builtin: $(obj)/$(defines-file) $(obj)/include/generated/
config.mk FORCE
- $(Q)$(MAKE) $(build)=$(obj)/arch/$(SRCARCH) \
- CONFIG_MK=$(obj)/include/generated/
config.mk
+arch-builtin: $(obj)/$(defines-file) FORCE
+ $(Q)$(MAKE) $(build)=$(obj)/arch/$(SRCARCH)
always :=
diff --git a/hypervisor/arch/arm-common/Kbuild b/hypervisor/arch/arm-common/Kbuild
--- a/hypervisor/arch/arm-common/Kbuild
+++ b/hypervisor/arch/arm-common/Kbuild
@@ -1,7 +1,7 @@
#
# Jailhouse, a Linux-based partitioning hypervisor
#
-# Copyright (c) Siemens AG, 2013-2016
+# Copyright (c) Siemens AG, 2013-2017
#
# Authors:
# Jan Kiszka <
jan.k...@siemens.com>
@@ -10,7 +10,7 @@
# the COPYING file in the top-level directory.
#
-include $(CONFIG_MK)
+include $(FILE_CONFIG_MK)
GCOV_PROFILE := n