build: extract clean target from Rules.mk
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 6 Mar 2020 09:14:33 +0000 (10:14 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 6 Mar 2020 09:15:04 +0000 (10:15 +0100)
commit5446def53a3ed8785db0e708f349be2bd781f838
tree2921747f183482aeb698845272ef5831283cbcc8
parentdeacf17ae3aef81df20263dc45980d8436d90bba
build: extract clean target from Rules.mk

Most of the code executed by Rules.mk isn't necessary for the clean
target, especially not the CFLAGS. This patch makes running make clean
much faster.

The patch extract the clean target into a different Makefile,
Makefile.clean.

Since Makefile.clean, doesn't want to include Config.mk, we need to
define the variables DEPS_INCLUDE and DEPS in a place common to
Rules.mk and Makefile.clean, this is Kbuild.include. DEPS_RM is only
needed in Makefile.clean so can be defined there.

Even so Rules.mk includes Config.mk, it includes Kbuild.include after,
so the effective definition of DEPS_INCLUDE is "xen/" one and the
same one as used by Makefile.clean.

This is inspired by Kbuild, with Makefile.clean partially copied from
Linux v5.4.

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