]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
build: use obj-y += subdir/ instead of subdir-y
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 6 Mar 2020 09:11:23 +0000 (10:11 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 6 Mar 2020 09:11:23 +0000 (10:11 +0100)
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>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
19 files changed:
xen/Rules.mk
xen/arch/arm/Makefile
xen/arch/arm/arm32/Makefile
xen/arch/arm/arm64/Makefile
xen/arch/x86/Makefile
xen/arch/x86/acpi/Makefile
xen/arch/x86/cpu/Makefile
xen/arch/x86/guest/Makefile
xen/arch/x86/hvm/Makefile
xen/arch/x86/mm/Makefile
xen/arch/x86/x86_64/Makefile
xen/common/Makefile
xen/drivers/Makefile
xen/drivers/acpi/Makefile
xen/drivers/passthrough/Makefile
xen/drivers/passthrough/vtd/Makefile
xen/lib/Makefile
xen/xsm/Makefile
xen/xsm/flask/Makefile

index c7a067d25409d9b7fca69ac06049f9cbcf397dd8..cc9c71bb13278b298ae27dc6e78d520cb2b9a4a0 100644 (file)
@@ -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)
 
index 70f532e42a06326618f0efc7d75de5c970cb1c4c..1044c2298a055b39196ac9ab6a44860eb437c0e7 100644 (file)
@@ -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
index 0ac254f34714437f81dcfaa096be820ff20dd7ee..539bbef298a7bf99f4be2ca0d8df54857bdb5b88 100644 (file)
@@ -1,4 +1,4 @@
-subdir-y += lib
+obj-y += lib/
 
 obj-$(EARLY_PRINTK) += debug.o
 obj-y += domctl.o
index c4f3a28a0d0bc1a4ac2f6c2d568f444d084093c2..db8565b71a333d6bbdd04744cfc5ae636eddb0e6 100644 (file)
@@ -1,4 +1,4 @@
-subdir-y += lib
+obj-y += lib/
 
 obj-y += cache.o
 obj-$(CONFIG_HARDEN_BRANCH_PREDICTOR) += bpi.o
index bce5fdb3170f0faca34af9f9e8340daa371b60da..ed709e2373acabac079be2c2aebaa3422b009038 100644 (file)
@@ -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) :=
index 27b4aa30b0cacad84852b6dbc4909ad391fc827a..1b9e62571301f8fb0c41c049605f6959e5af41e4 100644 (file)
@@ -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
index 466acc8b10e54cc8f9e53abe52cb713ddba1def6..de983006a1b1314cb2a837a50875ab8f47f36d18 100644 (file)
@@ -1,5 +1,5 @@
-subdir-y += mcheck
-subdir-y += mtrr
+obj-y += mcheck/
+obj-y += mtrr/
 
 obj-y += amd.o
 obj-y += centaur.o
index f164196772e8db0a22fbd035befd1df12ffaa423..a1e370d69df88adda9501e3ab5d99677af0bc7b0 100644 (file)
@@ -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/
index 43e5f3a21f8b8ae9a7a7cf8175d8a2a2afe3badb..3464191544601a1a05ca018ef1e21024172d9fda 100644 (file)
@@ -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
index 5010a29d6cb035d46b1cf7c158fcb446fda00472..d87dc0aa6eeb0179a90292f8a0c96dac5cc8ca84 100644 (file)
@@ -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
index 4bfa1480eb7ec43c2714e013483d56f42b0db5f2..2bb1eb0a8131969834045af2a65762e711eb9674 100644 (file)
@@ -1,4 +1,4 @@
-subdir-$(CONFIG_PV) += compat
+obj-$(CONFIG_PV) += compat/
 
 obj-bin-y += entry.o
 obj-y += traps.o
index 2abb8250b0f2c3dfc3f8b6e47b7110b781d3547e..e8cde653708ff374038b312fe3e4637a0f6862b9 100644 (file)
@@ -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/
index 30bab3cfdb368a53cdde599eab78151190c4c17a..2a1ae8ad130a2e62bf391528be669d07c056fece 100644 (file)
@@ -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/
index 444b11d5839d36c266745de42e0903be940790d4..4f8e97228ee25ca938ebc2bc9aae09c236b53926 100644 (file)
@@ -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
index d50ab188c83cc3e7e646752fe4570ded30779e8e..e973e16c748439ac58d4e99d76d8d487b55b2baa 100644 (file)
@@ -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
index f302653858a046c285f8bdb6a1bca2d6b32ddbde..fde7555fac077218ffc6456a342eadf24bdc99a1 100644 (file)
@@ -1,4 +1,4 @@
-subdir-$(CONFIG_X86) += x86
+obj-$(CONFIG_X86) += x86/
 
 obj-y += iommu.o
 obj-y += dmar.o
index dcdb75931378d41e05c3b8042b6d43c2ea97b3bb..7019ca00e8fd7402735536149d7ce7adb61abdcf 100644 (file)
@@ -1 +1 @@
-subdir-$(CONFIG_X86) += x86
+obj-$(CONFIG_X86) += x86/
index e4d581e065f8fcb7280d8e1d2b0d889e4b1bc94b..cf0a728f1c96579f0cf96ce7283b37404002735f 100644 (file)
@@ -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/
index 7c3f381287be8ffc093a4b54e8e71c68b7f5f90c..b1fd45421993980a58444401dfee8e5461fd203a 100644 (file)
@@ -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