On 2017-04-13 08:01, Jan Kiszka wrote: > On 2017-04-12 13:38, Henning Schild wrote: >> Move it up one level so the hypervisor core can make use of it >> itself. >> >> Signed-off-by: Henning Schild <[email protected]> >> Tested-by: Ralf Ramsauer <[email protected]> >> > > [side note: didn't you patch hg to produce diffstats?] > >> 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 <[email protected]> >> @@ -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 > > I would rather prefer GENERATED_CONFIG_MK and, for consistency, > GENERATED_VERSION_H. Leave a note on the changelog about this renaming > such as > > "Rename CONFIG_MK var at this chance to avoid confusing it to be a > tunable itself. Chose a consistent name for VERSION_H as well." > > >> +$(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 > > Sorry, but there is still one cosmetic remaining: "make clean" checks > and generates the two files. I'm looking for a pattern that allows to > express the proper dependency without causing this, but maybe you have > an idea as well. > > Yeah, surgeries on the build system are never simple...
Thought longer about it, but I couldn't find a good solution within the kbuild system. Things worked so far because we are breaking up the build in hypervisor/Makefile so that the time of the architecture build is under our control, but we can also define when the generated files are produced (only on jailhouse*.bin build, not on other targets - such as clean). We have to do the same now for all the directories that depend on the generated files. That is likely best done in the top-level Makefile, before we start kbuild. And that will require importing the filechk macro, I suppose. Jan -- Siemens AG, Corporate Technology, CT RDA ITP SES-DE Corporate Competence Center Embedded Linux -- 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.
