diff mbox series

[XEN,v3,07/23] xen/build: Use obj-y += subdir/ instead of subdir-y

Message ID 20200226113355.2532224-8-anthony.perard@citrix.com (mailing list archive)
State Superseded
Headers show
Series xen: Build system improvements | expand

Commit Message

Anthony PERARD Feb. 26, 2020, 11:33 a.m. UTC
This is part of upgrading our build system and import more of Linux's
one.

In Linux, subdir-y in Makefiles is only used to descend into
subdirectory when there are no object to build, Xen doesn't have that
and all subdir have object to be included in the final binary.

To allow the new syntax, the "obj-y" and "subdir-*" calculation in
Rules.mk is changed and partially imported from Linux's Kbuild.

The command used to modify the Makefile was:
    sed -i -r 's#^subdir-(.*)#obj-\1/#;' **/Makefile

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    v3:
    - no more tabs
    - reshuffle variable, and remove __subdir-y

 xen/Rules.mk                         | 19 ++++++++-----------
 xen/arch/arm/Makefile                | 14 +++++++-------
 xen/arch/arm/arm32/Makefile          |  2 +-
 xen/arch/arm/arm64/Makefile          |  2 +-
 xen/arch/x86/Makefile                | 18 +++++++++---------
 xen/arch/x86/acpi/Makefile           |  2 +-
 xen/arch/x86/cpu/Makefile            |  4 ++--
 xen/arch/x86/guest/Makefile          |  4 ++--
 xen/arch/x86/hvm/Makefile            |  6 +++---
 xen/arch/x86/mm/Makefile             |  4 ++--
 xen/arch/x86/x86_64/Makefile         |  2 +-
 xen/common/Makefile                  | 10 +++++-----
 xen/drivers/Makefile                 | 14 +++++++-------
 xen/drivers/acpi/Makefile            |  6 +++---
 xen/drivers/passthrough/Makefile     |  8 ++++----
 xen/drivers/passthrough/vtd/Makefile |  2 +-
 xen/lib/Makefile                     |  2 +-
 xen/xsm/Makefile                     |  2 +-
 xen/xsm/flask/Makefile               |  2 +-
 19 files changed, 60 insertions(+), 63 deletions(-)

Comments

Roger Pau Monne Feb. 27, 2020, 9:22 a.m. UTC | #1
On Wed, Feb 26, 2020 at 11:33:39AM +0000, Anthony PERARD wrote:
> This is part of upgrading our build system and import more of Linux's
> one.
> 
> In Linux, subdir-y in Makefiles is only used to descend into
> subdirectory when there are no object to build, Xen doesn't have that
> and all subdir have object to be included in the final binary.
> 
> To allow the new syntax, the "obj-y" and "subdir-*" calculation in
> Rules.mk is changed and partially imported from Linux's Kbuild.
> 
> The command used to modify the Makefile was:
>     sed -i -r 's#^subdir-(.*)#obj-\1/#;' **/Makefile
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

LGTM:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.
Jan Beulich Feb. 27, 2020, 9:43 a.m. UTC | #2
On 26.02.2020 12:33, Anthony PERARD wrote:
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -111,17 +111,14 @@ define gendep
>  endef
>  $(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extra-y)),$(eval $(call gendep,$(o))))
>  
> -# Ensure each subdirectory has exactly one trailing slash.
> -subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n) $(subdir-)))
> -subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y)))
> -
> -# Add explicitly declared subdirectories to the object lists.
> -obj-y += $(patsubst %/,%/built_in.o,$(subdir-y))
> -
> -# Add implicitly declared subdirectories (in the object lists) to the
> -# subdirectory list, and rewrite the object-list entry.
> -subdir-y += $(filter %/,$(obj-y))
> -obj-y    := $(patsubst %/,%/built-in.o,$(obj-y))
> +# Handle objects in subdirs
> +# ---------------------------------------------------------------------------
> +# o if we encounter foo/ in $(obj-y), replace it by foo/built_in.o
> +#   and add the directory to the list of dirs to descend into: $(subdir-y)
> +subdir-y := $(subdir-y) $(filter %/, $(obj-y))
> +obj-y    := $(patsubst %/, %/built_in.o, $(obj-y))
> +
> +subdir-n   := $(subdir-n) $(subdir-) $(filter %/, $(obj-n) $(obj-))

I'm slightly puzzled by the mismatch in blank padding on the three
lines above. I assume the last one is to match ...

>  subdir-all := $(subdir-y) $(subdir-n)

... this, but I think it would be better for all of them to match,
or as the 2nd best option, for subdir-n to match subdir-y. Easy
enough to do while committing I guess, but this would want your
consent.

Applicable parts

Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Jan Beulich March 4, 2020, 2:14 p.m. UTC | #3
On 27.02.2020 10:43, Jan Beulich wrote:
> On 26.02.2020 12:33, Anthony PERARD wrote:
>> --- a/xen/Rules.mk
>> +++ b/xen/Rules.mk
>> @@ -111,17 +111,14 @@ define gendep
>>  endef
>>  $(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extra-y)),$(eval $(call gendep,$(o))))
>>  
>> -# Ensure each subdirectory has exactly one trailing slash.
>> -subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n) $(subdir-)))
>> -subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y)))
>> -
>> -# Add explicitly declared subdirectories to the object lists.
>> -obj-y += $(patsubst %/,%/built_in.o,$(subdir-y))
>> -
>> -# Add implicitly declared subdirectories (in the object lists) to the
>> -# subdirectory list, and rewrite the object-list entry.
>> -subdir-y += $(filter %/,$(obj-y))
>> -obj-y    := $(patsubst %/,%/built-in.o,$(obj-y))
>> +# Handle objects in subdirs
>> +# ---------------------------------------------------------------------------
>> +# o if we encounter foo/ in $(obj-y), replace it by foo/built_in.o
>> +#   and add the directory to the list of dirs to descend into: $(subdir-y)
>> +subdir-y := $(subdir-y) $(filter %/, $(obj-y))
>> +obj-y    := $(patsubst %/, %/built_in.o, $(obj-y))
>> +
>> +subdir-n   := $(subdir-n) $(subdir-) $(filter %/, $(obj-n) $(obj-))
> 
> I'm slightly puzzled by the mismatch in blank padding on the three
> lines above. I assume the last one is to match ...
> 
>>  subdir-all := $(subdir-y) $(subdir-n)
> 
> ... this, but I think it would be better for all of them to match,
> or as the 2nd best option, for subdir-n to match subdir-y. Easy
> enough to do while committing I guess, but this would want your
> consent.

Oh, these two lines go away again in patch 9. No need for any
adjustment then.

Jan
Jan Beulich March 5, 2020, 9:24 a.m. UTC | #4
On 26.02.2020 12:33, Anthony PERARD wrote:
> This is part of upgrading our build system and import more of Linux's
> one.
> 
> In Linux, subdir-y in Makefiles is only used to descend into
> subdirectory when there are no object to build, Xen doesn't have that
> and all subdir have object to be included in the final binary.
> 
> To allow the new syntax, the "obj-y" and "subdir-*" calculation in
> Rules.mk is changed and partially imported from Linux's Kbuild.
> 
> The command used to modify the Makefile was:
>     sed -i -r 's#^subdir-(.*)#obj-\1/#;' **/Makefile
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> 
> Notes:
>     v3:
>     - no more tabs
>     - reshuffle variable, and remove __subdir-y
> 
>  xen/Rules.mk                         | 19 ++++++++-----------
>  xen/arch/arm/Makefile                | 14 +++++++-------
>  xen/arch/arm/arm32/Makefile          |  2 +-
>  xen/arch/arm/arm64/Makefile          |  2 +-

Julien, Stefano - any chance of getting an ack here?

>  xen/arch/x86/Makefile                | 18 +++++++++---------
>  xen/arch/x86/acpi/Makefile           |  2 +-
>  xen/arch/x86/cpu/Makefile            |  4 ++--
>  xen/arch/x86/guest/Makefile          |  4 ++--
>  xen/arch/x86/hvm/Makefile            |  6 +++---
>  xen/arch/x86/mm/Makefile             |  4 ++--
>  xen/arch/x86/x86_64/Makefile         |  2 +-
>  xen/common/Makefile                  | 10 +++++-----
>  xen/drivers/Makefile                 | 14 +++++++-------
>  xen/drivers/acpi/Makefile            |  6 +++---
>  xen/drivers/passthrough/Makefile     |  8 ++++----
>  xen/drivers/passthrough/vtd/Makefile |  2 +-

Kevin, how about this one?

>  xen/lib/Makefile                     |  2 +-
>  xen/xsm/Makefile                     |  2 +-
>  xen/xsm/flask/Makefile               |  2 +-

Daniel, how about these?

I guess the latter two are small enough to skip further waiting for
acks once the Arm one would be in place. Getting this patch in
would unblock a fair part of the remainder of this series.

Jan
Andrew Cooper March 5, 2020, 1:42 p.m. UTC | #5
On 05/03/2020 09:24, Jan Beulich wrote:
> On 26.02.2020 12:33, Anthony PERARD wrote:
>> This is part of upgrading our build system and import more of Linux's
>> one.
>>
>> In Linux, subdir-y in Makefiles is only used to descend into
>> subdirectory when there are no object to build, Xen doesn't have that
>> and all subdir have object to be included in the final binary.
>>
>> To allow the new syntax, the "obj-y" and "subdir-*" calculation in
>> Rules.mk is changed and partially imported from Linux's Kbuild.
>>
>> The command used to modify the Makefile was:
>>     sed -i -r 's#^subdir-(.*)#obj-\1/#;' **/Makefile
>>
>> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
>> ---
>>
>> Notes:
>>     v3:
>>     - no more tabs
>>     - reshuffle variable, and remove __subdir-y
>>
>>  xen/Rules.mk                         | 19 ++++++++-----------
>>  xen/arch/arm/Makefile                | 14 +++++++-------
>>  xen/arch/arm/arm32/Makefile          |  2 +-
>>  xen/arch/arm/arm64/Makefile          |  2 +-
> Julien, Stefano - any chance of getting an ack here?
>
>>  xen/arch/x86/Makefile                | 18 +++++++++---------
>>  xen/arch/x86/acpi/Makefile           |  2 +-
>>  xen/arch/x86/cpu/Makefile            |  4 ++--
>>  xen/arch/x86/guest/Makefile          |  4 ++--
>>  xen/arch/x86/hvm/Makefile            |  6 +++---
>>  xen/arch/x86/mm/Makefile             |  4 ++--
>>  xen/arch/x86/x86_64/Makefile         |  2 +-
>>  xen/common/Makefile                  | 10 +++++-----
>>  xen/drivers/Makefile                 | 14 +++++++-------
>>  xen/drivers/acpi/Makefile            |  6 +++---
>>  xen/drivers/passthrough/Makefile     |  8 ++++----
>>  xen/drivers/passthrough/vtd/Makefile |  2 +-
> Kevin, how about this one?
>
>>  xen/lib/Makefile                     |  2 +-
>>  xen/xsm/Makefile                     |  2 +-
>>  xen/xsm/flask/Makefile               |  2 +-
> Daniel, how about these?
>
> I guess the latter two are small enough to skip further waiting for
> acks once the Arm one would be in place. Getting this patch in
> would unblock a fair part of the remainder of this series.

This is a mechanical change to the entire tree, unrelated to the logic
in the maintainers areas.

It is a good example where "The Rest" qualifies better than the sum of
every sub-maintainer.  Given that this has already been pending for a
week, I'd say it is fine to go in now.

~Andrew
Julien Grall March 5, 2020, 3:02 p.m. UTC | #6
Hi Jan,

On 05/03/2020 09:24, Jan Beulich wrote:
> On 26.02.2020 12:33, Anthony PERARD wrote:
>> This is part of upgrading our build system and import more of Linux's
>> one.
>>
>> In Linux, subdir-y in Makefiles is only used to descend into
>> subdirectory when there are no object to build, Xen doesn't have that
>> and all subdir have object to be included in the final binary.
>>
>> To allow the new syntax, the "obj-y" and "subdir-*" calculation in
>> Rules.mk is changed and partially imported from Linux's Kbuild.
>>
>> The command used to modify the Makefile was:
>>      sed -i -r 's#^subdir-(.*)#obj-\1/#;' **/Makefile
>>
>> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
>> ---
>>
>> Notes:
>>      v3:
>>      - no more tabs
>>      - reshuffle variable, and remove __subdir-y
>>
>>   xen/Rules.mk                         | 19 ++++++++-----------
>>   xen/arch/arm/Makefile                | 14 +++++++-------
>>   xen/arch/arm/arm32/Makefile          |  2 +-
>>   xen/arch/arm/arm64/Makefile          |  2 +-
> 
> Julien, Stefano - any chance of getting an ack here?

Stewart pointed one build issue on Arm in the cover letter. I am not 
sure where the bug lies, so I would like to hold off my ack until 
someone figure out what's going on.

> 
>>   xen/arch/x86/Makefile                | 18 +++++++++---------
>>   xen/arch/x86/acpi/Makefile           |  2 +-
>>   xen/arch/x86/cpu/Makefile            |  4 ++--
>>   xen/arch/x86/guest/Makefile          |  4 ++--
>>   xen/arch/x86/hvm/Makefile            |  6 +++---
>>   xen/arch/x86/mm/Makefile             |  4 ++--
>>   xen/arch/x86/x86_64/Makefile         |  2 +-
>>   xen/common/Makefile                  | 10 +++++-----
>>   xen/drivers/Makefile                 | 14 +++++++-------
>>   xen/drivers/acpi/Makefile            |  6 +++---
>>   xen/drivers/passthrough/Makefile     |  8 ++++----
>>   xen/drivers/passthrough/vtd/Makefile |  2 +-
> 
> Kevin, how about this one?
> 
>>   xen/lib/Makefile                     |  2 +-
>>   xen/xsm/Makefile                     |  2 +-
>>   xen/xsm/flask/Makefile               |  2 +-
> 
> Daniel, how about these?
> 
> I guess the latter two are small enough to skip further waiting for
> acks once the Arm one would be in place. Getting this patch in
> would unblock a fair part of the remainder of this series.
> 
> Jan
> 

Cheers,
Anthony PERARD March 5, 2020, 3:59 p.m. UTC | #7
On Thu, Mar 05, 2020 at 03:02:22PM +0000, Julien Grall wrote:
> Hi Jan,
> 
> > >   xen/Rules.mk                         | 19 ++++++++-----------
> > >   xen/arch/arm/Makefile                | 14 +++++++-------
> > >   xen/arch/arm/arm32/Makefile          |  2 +-
> > >   xen/arch/arm/arm64/Makefile          |  2 +-
> > 
> > Julien, Stefano - any chance of getting an ack here?
> 
> Stewart pointed one build issue on Arm in the cover letter. I am not sure
> where the bug lies, so I would like to hold off my ack until someone figure
> out what's going on.

The bug is in patch "[XEN PATCH v3 15/23] xen/build: have the root
Makefile generates the CFLAGS". So this patch is fine :-).

Cheers,
Julien Grall March 5, 2020, 4:31 p.m. UTC | #8
Hi Anthony,

On 05/03/2020 15:59, Anthony PERARD wrote:
> On Thu, Mar 05, 2020 at 03:02:22PM +0000, Julien Grall wrote:
>> Hi Jan,
>>
>>>>    xen/Rules.mk                         | 19 ++++++++-----------
>>>>    xen/arch/arm/Makefile                | 14 +++++++-------
>>>>    xen/arch/arm/arm32/Makefile          |  2 +-
>>>>    xen/arch/arm/arm64/Makefile          |  2 +-
>>>
>>> Julien, Stefano - any chance of getting an ack here?
>>
>> Stewart pointed one build issue on Arm in the cover letter. I am not sure
>> where the bug lies, so I would like to hold off my ack until someone figure
>> out what's going on.
> 
> The bug is in patch "[XEN PATCH v3 15/23] xen/build: have the root
> Makefile generates the CFLAGS". So this patch is fine :-).

Fine :). Thank you for looking at it. You can add my Acked-by on this patch:

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,
Tian, Kevin March 9, 2020, 6:46 a.m. UTC | #9
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Thursday, March 5, 2020 5:24 PM
> 
> On 26.02.2020 12:33, Anthony PERARD wrote:
> > This is part of upgrading our build system and import more of Linux's
> > one.
> >
> > In Linux, subdir-y in Makefiles is only used to descend into
> > subdirectory when there are no object to build, Xen doesn't have that
> > and all subdir have object to be included in the final binary.
> >
> > To allow the new syntax, the "obj-y" and "subdir-*" calculation in
> > Rules.mk is changed and partially imported from Linux's Kbuild.
> >
> > The command used to modify the Makefile was:
> >     sed -i -r 's#^subdir-(.*)#obj-\1/#;' **/Makefile
> >
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > ---
> >
> > Notes:
> >     v3:
> >     - no more tabs
> >     - reshuffle variable, and remove __subdir-y
> >
> >  xen/Rules.mk                         | 19 ++++++++-----------
> >  xen/arch/arm/Makefile                | 14 +++++++-------
> >  xen/arch/arm/arm32/Makefile          |  2 +-
> >  xen/arch/arm/arm64/Makefile          |  2 +-
> 
> Julien, Stefano - any chance of getting an ack here?
> 
> >  xen/arch/x86/Makefile                | 18 +++++++++---------
> >  xen/arch/x86/acpi/Makefile           |  2 +-
> >  xen/arch/x86/cpu/Makefile            |  4 ++--
> >  xen/arch/x86/guest/Makefile          |  4 ++--
> >  xen/arch/x86/hvm/Makefile            |  6 +++---
> >  xen/arch/x86/mm/Makefile             |  4 ++--
> >  xen/arch/x86/x86_64/Makefile         |  2 +-
> >  xen/common/Makefile                  | 10 +++++-----
> >  xen/drivers/Makefile                 | 14 +++++++-------
> >  xen/drivers/acpi/Makefile            |  6 +++---
> >  xen/drivers/passthrough/Makefile     |  8 ++++----
> >  xen/drivers/passthrough/vtd/Makefile |  2 +-
> 
> Kevin, how about this one?

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> 
> >  xen/lib/Makefile                     |  2 +-
> >  xen/xsm/Makefile                     |  2 +-
> >  xen/xsm/flask/Makefile               |  2 +-
> 
> Daniel, how about these?
> 
> I guess the latter two are small enough to skip further waiting for
> acks once the Arm one would be in place. Getting this patch in
> would unblock a fair part of the remainder of this series.
> 
> Jan
diff mbox series

Patch

diff --git a/xen/Rules.mk b/xen/Rules.mk
index c7a067d25409..cc9c71bb1327 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -111,17 +111,14 @@  define gendep
 endef
 $(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extra-y)),$(eval $(call gendep,$(o))))
 
-# Ensure each subdirectory has exactly one trailing slash.
-subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n) $(subdir-)))
-subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y)))
-
-# Add explicitly declared subdirectories to the object lists.
-obj-y += $(patsubst %/,%/built_in.o,$(subdir-y))
-
-# Add implicitly declared subdirectories (in the object lists) to the
-# subdirectory list, and rewrite the object-list entry.
-subdir-y += $(filter %/,$(obj-y))
-obj-y    := $(patsubst %/,%/built-in.o,$(obj-y))
+# Handle objects in subdirs
+# ---------------------------------------------------------------------------
+# o if we encounter foo/ in $(obj-y), replace it by foo/built_in.o
+#   and add the directory to the list of dirs to descend into: $(subdir-y)
+subdir-y := $(subdir-y) $(filter %/, $(obj-y))
+obj-y    := $(patsubst %/, %/built_in.o, $(obj-y))
+
+subdir-n   := $(subdir-n) $(subdir-) $(filter %/, $(obj-n) $(obj-))
 
 subdir-all := $(subdir-y) $(subdir-n)
 
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 70f532e42a06..1044c2298a05 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -1,11 +1,11 @@ 
-subdir-$(CONFIG_ARM_32) += arm32
-subdir-$(CONFIG_ARM_64) += arm64
-subdir-$(CONFIG_ARM_64) += efi
-subdir-$(CONFIG_ACPI) += acpi
+obj-$(CONFIG_ARM_32) += arm32/
+obj-$(CONFIG_ARM_64) += arm64/
+obj-$(CONFIG_ARM_64) += efi/
+obj-$(CONFIG_ACPI) += acpi/
 ifneq ($(CONFIG_NO_PLAT),y)
-subdir-y += platforms
+obj-y += platforms/
 endif
-subdir-$(CONFIG_TEE) += tee
+obj-$(CONFIG_TEE) += tee/
 
 obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o
 obj-y += bootfdt.init.o
@@ -48,7 +48,7 @@  obj-y += sysctl.o
 obj-y += time.o
 obj-y += traps.o
 obj-y += vcpreg.o
-subdir-$(CONFIG_NEW_VGIC) += vgic
+obj-$(CONFIG_NEW_VGIC) += vgic/
 ifneq ($(CONFIG_NEW_VGIC),y)
 obj-y += gic-vgic.o
 obj-y += vgic.o
diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile
index 0ac254f34714..539bbef298a7 100644
--- a/xen/arch/arm/arm32/Makefile
+++ b/xen/arch/arm/arm32/Makefile
@@ -1,4 +1,4 @@ 
-subdir-y += lib
+obj-y += lib/
 
 obj-$(EARLY_PRINTK) += debug.o
 obj-y += domctl.o
diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile
index c4f3a28a0d0b..db8565b71a33 100644
--- a/xen/arch/arm/arm64/Makefile
+++ b/xen/arch/arm/arm64/Makefile
@@ -1,4 +1,4 @@ 
-subdir-y += lib
+obj-y += lib/
 
 obj-y += cache.o
 obj-$(CONFIG_HARDEN_BRANCH_PREDICTOR) += bpi.o
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index bce5fdb3170f..ed709e2373ac 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -1,12 +1,12 @@ 
-subdir-y += acpi
-subdir-y += cpu
-subdir-y += genapic
-subdir-$(CONFIG_GUEST) += guest
-subdir-$(CONFIG_HVM) += hvm
-subdir-y += mm
-subdir-$(CONFIG_XENOPROF) += oprofile
-subdir-$(CONFIG_PV) += pv
-subdir-y += x86_64
+obj-y += acpi/
+obj-y += cpu/
+obj-y += genapic/
+obj-$(CONFIG_GUEST) += guest/
+obj-$(CONFIG_HVM) += hvm/
+obj-y += mm/
+obj-$(CONFIG_XENOPROF) += oprofile/
+obj-$(CONFIG_PV) += pv/
+obj-y += x86_64/
 
 alternative-y := alternative.init.o
 alternative-$(CONFIG_LIVEPATCH) :=
diff --git a/xen/arch/x86/acpi/Makefile b/xen/arch/x86/acpi/Makefile
index 27b4aa30b0ca..1b9e62571301 100644
--- a/xen/arch/x86/acpi/Makefile
+++ b/xen/arch/x86/acpi/Makefile
@@ -1,4 +1,4 @@ 
-subdir-y += cpufreq
+obj-y += cpufreq/
 
 obj-y += lib.o power.o suspend.o cpu_idle.o cpuidle_menu.o
 obj-bin-y += boot.init.o wakeup_prot.o
diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile
index 466acc8b10e5..de983006a1b1 100644
--- a/xen/arch/x86/cpu/Makefile
+++ b/xen/arch/x86/cpu/Makefile
@@ -1,5 +1,5 @@ 
-subdir-y += mcheck
-subdir-y += mtrr
+obj-y += mcheck/
+obj-y += mtrr/
 
 obj-y += amd.o
 obj-y += centaur.o
diff --git a/xen/arch/x86/guest/Makefile b/xen/arch/x86/guest/Makefile
index f164196772e8..a1e370d69df8 100644
--- a/xen/arch/x86/guest/Makefile
+++ b/xen/arch/x86/guest/Makefile
@@ -1,4 +1,4 @@ 
 obj-y += hypervisor.o
 
-subdir-$(CONFIG_HYPERV_GUEST) += hyperv
-subdir-$(CONFIG_XEN_GUEST) += xen
+obj-$(CONFIG_HYPERV_GUEST) += hyperv/
+obj-$(CONFIG_XEN_GUEST) += xen/
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 43e5f3a21f8b..346419154460 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,6 +1,6 @@ 
-subdir-y += svm
-subdir-y += vmx
-subdir-y += viridian
+obj-y += svm/
+obj-y += vmx/
+obj-y += viridian/
 
 obj-y += asid.o
 obj-y += dm.o
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 5010a29d6cb0..d87dc0aa6eeb 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -1,5 +1,5 @@ 
-subdir-y += shadow
-subdir-$(CONFIG_HVM) += hap
+obj-y += shadow/
+obj-$(CONFIG_HVM) += hap/
 
 obj-$(CONFIG_HVM) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index 4bfa1480eb7e..2bb1eb0a8131 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -1,4 +1,4 @@ 
-subdir-$(CONFIG_PV) += compat
+obj-$(CONFIG_PV) += compat/
 
 obj-bin-y += entry.o
 obj-y += traps.o
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 2abb8250b0f2..e8cde653708f 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -66,9 +66,9 @@  obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall
 
 extra-y := symbols-dummy.o
 
-subdir-$(CONFIG_COVERAGE) += coverage
-subdir-y += sched
-subdir-$(CONFIG_UBSAN) += ubsan
+obj-$(CONFIG_COVERAGE) += coverage/
+obj-y += sched/
+obj-$(CONFIG_UBSAN) += ubsan/
 
-subdir-$(CONFIG_NEEDS_LIBELF) += libelf
-subdir-$(CONFIG_HAS_DEVICE_TREE) += libfdt
+obj-$(CONFIG_NEEDS_LIBELF) += libelf/
+obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
diff --git a/xen/drivers/Makefile b/xen/drivers/Makefile
index 30bab3cfdb36..2a1ae8ad130a 100644
--- a/xen/drivers/Makefile
+++ b/xen/drivers/Makefile
@@ -1,7 +1,7 @@ 
-subdir-y += char
-subdir-$(CONFIG_HAS_CPUFREQ) += cpufreq
-subdir-$(CONFIG_HAS_PCI) += pci
-subdir-$(CONFIG_HAS_VPCI) += vpci
-subdir-$(CONFIG_HAS_PASSTHROUGH) += passthrough
-subdir-$(CONFIG_ACPI) += acpi
-subdir-$(CONFIG_VIDEO) += video
+obj-y += char/
+obj-$(CONFIG_HAS_CPUFREQ) += cpufreq/
+obj-$(CONFIG_HAS_PCI) += pci/
+obj-$(CONFIG_HAS_VPCI) += vpci/
+obj-$(CONFIG_HAS_PASSTHROUGH) += passthrough/
+obj-$(CONFIG_ACPI) += acpi/
+obj-$(CONFIG_VIDEO) += video/
diff --git a/xen/drivers/acpi/Makefile b/xen/drivers/acpi/Makefile
index 444b11d5839d..4f8e97228ee2 100644
--- a/xen/drivers/acpi/Makefile
+++ b/xen/drivers/acpi/Makefile
@@ -1,6 +1,6 @@ 
-subdir-y += tables
-subdir-y += utilities
-subdir-$(CONFIG_X86) += apei
+obj-y += tables/
+obj-y += utilities/
+obj-$(CONFIG_X86) += apei/
 
 obj-bin-y += tables.init.o
 obj-$(CONFIG_NUMA) += numa.o
diff --git a/xen/drivers/passthrough/Makefile b/xen/drivers/passthrough/Makefile
index d50ab188c83c..e973e16c7484 100644
--- a/xen/drivers/passthrough/Makefile
+++ b/xen/drivers/passthrough/Makefile
@@ -1,7 +1,7 @@ 
-subdir-$(CONFIG_X86) += vtd
-subdir-$(CONFIG_X86) += amd
-subdir-$(CONFIG_X86) += x86
-subdir-$(CONFIG_ARM) += arm
+obj-$(CONFIG_X86) += vtd/
+obj-$(CONFIG_X86) += amd/
+obj-$(CONFIG_X86) += x86/
+obj-$(CONFIG_ARM) += arm/
 
 obj-y += iommu.o
 obj-$(CONFIG_HAS_PCI) += pci.o
diff --git a/xen/drivers/passthrough/vtd/Makefile b/xen/drivers/passthrough/vtd/Makefile
index f302653858a0..fde7555fac07 100644
--- a/xen/drivers/passthrough/vtd/Makefile
+++ b/xen/drivers/passthrough/vtd/Makefile
@@ -1,4 +1,4 @@ 
-subdir-$(CONFIG_X86) += x86
+obj-$(CONFIG_X86) += x86/
 
 obj-y += iommu.o
 obj-y += dmar.o
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index dcdb75931378..7019ca00e8fd 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -1 +1 @@ 
-subdir-$(CONFIG_X86) += x86
+obj-$(CONFIG_X86) += x86/
diff --git a/xen/xsm/Makefile b/xen/xsm/Makefile
index e4d581e065f8..cf0a728f1c96 100644
--- a/xen/xsm/Makefile
+++ b/xen/xsm/Makefile
@@ -3,4 +3,4 @@  obj-$(CONFIG_XSM) += xsm_policy.o
 obj-$(CONFIG_XSM) += dummy.o
 obj-$(CONFIG_XSM_SILO) += silo.o
 
-subdir-$(CONFIG_XSM_FLASK) += flask
+obj-$(CONFIG_XSM_FLASK) += flask/
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 7c3f381287be..b1fd45421993 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -2,7 +2,7 @@  obj-y += avc.o
 obj-y += hooks.o
 obj-y += flask_op.o
 
-subdir-y += ss
+obj-y += ss/
 
 CFLAGS += -I./include