build: avoid re-executing the main Makefile by introducing build.mk
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 28 Jan 2022 10:42:24 +0000 (11:42 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 28 Jan 2022 10:42:24 +0000 (11:42 +0100)
commit7be85daac5acca30bd4d6779ec03982528c35558
tree25b740a8c519298cdfa4bf09755e502be7aeb720
parent672f2198f4eb6b14cbbf4abb4e2d27af15578dad
build: avoid re-executing the main Makefile by introducing build.mk

Currently, the xen/Makefile is re-parsed several times: once to start
the build process, and several more time with Rules.mk including it.
This makes it difficult to work with a Makefile used for several
purpose, and it actually slow down the build process.

So this patch introduce "build.mk" which Rules.mk will use when
present instead of the "Makefile" of a directory. (Linux's Kbuild
named that file "Kbuild".)

We have a few targets to move to "build.mk" identified by them been
build via "make -f Rules.mk" without changing directory.

As for the main targets like "build", we can have them depends on
there underscore-prefix targets like "_build" without having to use
"Rules.mk" while still retaining the check for unsupported
architecture. (Those main rules are changed to be single-colon as
there should only be a single recipe for them.)

With nearly everything needed to move to "build.mk" moved, there is a
single dependency left from "Rules.mk": the variable $(TARGET), so its
assignement is moved to the main Makefile.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/Makefile
xen/Rules.mk
xen/build.mk [new file with mode: 0644]