Move it up one level so the hypervisor core can make use of it
itself.

Signed-off-by: Henning Schild <[email protected]>

diff --git a/Kbuild b/Kbuild
--- a/Kbuild
+++ b/Kbuild
@@ -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
+
+$(obj)/hypervisor/include/generated/config.mk: $(src)/Makefile FORCE
+       $(call filechk,config_mk)
+
+CONFIG_MK := $(obj)/hypervisor/include/generated/config.mk
+
+define filechk_version
+       $(src)/scripts/gen_version_h $(src)/
+endef
+
+$(obj)/hypervisor/include/generated/version.h: $(src)/Makefile FORCE
+       $(call filechk,version)
+
+VERSION_H := $(obj)/hypervisor/include/generated/version.h
+
+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: $(VERSION_H)
+$(obj)/hypervisor $(obj)/inmates $(obj)/driver: $(CONFIG_MK)
 
-clean-dirs := Documentation/generated
+clean-dirs := Documentation/generated hypervisor/include/generated
diff --git a/hypervisor/Makefile b/hypervisor/Makefile
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -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,11 @@ 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
-
-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
@@ -10,7 +10,7 @@
 # the COPYING file in the top-level directory.
 #
 
-include $(CONFIG_MK)
+include $(obj)/../../include/generated/config.mk
 
 GCOV_PROFILE := n
 
diff --git a/hypervisor/arch/x86/Kbuild b/hypervisor/arch/x86/Kbuild
--- a/hypervisor/arch/x86/Kbuild
+++ b/hypervisor/arch/x86/Kbuild
@@ -12,6 +12,8 @@
 # the COPYING file in the top-level directory.
 #
 
+include $(obj)/../../include/generated/config.mk
+
 GCOV_PROFILE := n
 
 BUILT_IN_OBJECTS := built-in-amd.o built-in-intel.o

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to