kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 5 Nov 2017 05:30:53 +0000 (14:30 +0900)
committerRob Herring <robh@kernel.org>
Thu, 9 Nov 2017 23:03:07 +0000 (17:03 -0600)
commit7e7962dd1a5307bca1793a3f9a98ad5514306c7a
treef864a54ad98215bb7408767d9d2e32690e925980
parent3cad14d56adbf7d621fc5a35db42f3acc0a2d6e8
kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
It could be a race problem when building DTBS in parallel.

Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
sub-directories, so this broke when Broadcom added one more hierarchy
in arch/arm64/boot/dts/broadcom/<soc>/.

One idea to fix the issues in a clean way is to move DTB handling
to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
natively, so it should not hurt to do so.

Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
enabled.  All clutter things in Makefiles go away.

As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
directly to traverse sub-directories.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
[robh: corrected BUILTIN_DTB to CONFIG_BUILTIN_DTB]
Signed-off-by: Rob Herring <robh@kernel.org>
48 files changed:
arch/arc/boot/dts/Makefile
arch/arm/boot/dts/Makefile
arch/arm64/boot/dts/Makefile
arch/arm64/boot/dts/actions/Makefile
arch/arm64/boot/dts/al/Makefile
arch/arm64/boot/dts/allwinner/Makefile
arch/arm64/boot/dts/altera/Makefile
arch/arm64/boot/dts/amd/Makefile
arch/arm64/boot/dts/amlogic/Makefile
arch/arm64/boot/dts/apm/Makefile
arch/arm64/boot/dts/arm/Makefile
arch/arm64/boot/dts/broadcom/Makefile
arch/arm64/boot/dts/broadcom/northstar2/Makefile
arch/arm64/boot/dts/broadcom/stingray/Makefile
arch/arm64/boot/dts/cavium/Makefile
arch/arm64/boot/dts/exynos/Makefile
arch/arm64/boot/dts/freescale/Makefile
arch/arm64/boot/dts/hisilicon/Makefile
arch/arm64/boot/dts/lg/Makefile
arch/arm64/boot/dts/marvell/Makefile
arch/arm64/boot/dts/mediatek/Makefile
arch/arm64/boot/dts/nvidia/Makefile
arch/arm64/boot/dts/qcom/Makefile
arch/arm64/boot/dts/realtek/Makefile
arch/arm64/boot/dts/renesas/Makefile
arch/arm64/boot/dts/rockchip/Makefile
arch/arm64/boot/dts/socionext/Makefile
arch/arm64/boot/dts/sprd/Makefile
arch/arm64/boot/dts/xilinx/Makefile
arch/arm64/boot/dts/zte/Makefile
arch/h8300/boot/dts/Makefile
arch/metag/boot/dts/Makefile
arch/mips/boot/dts/Makefile
arch/mips/boot/dts/brcm/Makefile
arch/mips/boot/dts/cavium-octeon/Makefile
arch/mips/boot/dts/img/Makefile
arch/mips/boot/dts/ingenic/Makefile
arch/mips/boot/dts/lantiq/Makefile
arch/mips/boot/dts/mti/Makefile
arch/mips/boot/dts/netlogic/Makefile
arch/mips/boot/dts/ni/Makefile
arch/mips/boot/dts/pic32/Makefile
arch/mips/boot/dts/qca/Makefile
arch/mips/boot/dts/ralink/Makefile
arch/mips/boot/dts/xilfpga/Makefile
arch/xtensa/boot/dts/Makefile
scripts/Makefile.dtbinst
scripts/Makefile.lib