I have been just wondering why the U-Boot top Makefile is so dirty. It is sprinkled with SoC-specific code as follows:
ifneq ($(CONFIG_OMAP_COMMON),) LIBS-y += $(CPUDIR)/omap-common/libomap-common.o endif ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610)) LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o endif ifeq ($(SOC),s5pc1xx) LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o endif ifeq ($(SOC),exynos) LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o endif ifneq ($(CONFIG_TEGRA),) LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o LIBS-y += arch/$(ARCH)/cpu/tegra-common/libcputegra-common.o LIBS-y += $(CPUDIR)/tegra-common/libtegra-common.o endif And it describes drivers not right under the top directory, which should be essentially cared by drivers/Makefile. LIBS-y += drivers/bios_emulator/libatibiosemu.o LIBS-y += drivers/block/libblock.o LIBS-$(CONFIG_BOOTCOUNT_LIMIT) += drivers/bootcount/libbootcount.o LIBS-y += drivers/crypto/libcrypto.o LIBS-y += drivers/dma/libdma.o ... This series adds the directory descending feature like Kbuild. 1/6 tweaks scripts/Makefile.build to support 'obj-y += foo/' syntax. If the build system finds 'foo/' (trailed by a slash), it visits foo directory. 2/6-6/6 demonstarate how we can refactor makefiles with this syntax. 2/6: Move some drivers LIBS from top Makefile to drivers/Makefile 3/6: Move some fs LIBS from top Makefile to fs/Makefile 4/6: Move Tegra specific lines from top Makefile under arch/arm/ 5/6: Move OMAP specific lines from top Makefile under arch/arm/ 6/6: Move Samsung SoC specific lines from top Makefile under arch/arm/ Note: This series uses [PATCH v3]First step towards Kbuild: Use Kbuild-style makefiles (19 patch files). as a prerequisite. Please apply them first. I believe no boards are broken by this refactoring. In order to confirm my claim, I compiled all boards except nds32 and nios2 architrecutures. (I could not get an appropriate prebuilt cross compilers for those two arch.) For arm, avr32, sandbox, x86, I could perfectly compile all boards without any warnings. For the other architectures, I could compile some boards and I could not the others. But the SUMMARY result is still the same after applying this series. In addition I compared all the error and warning messages for all boards and they are the same. This means these patches do not introduce any additional errors, warnings. Cc: Simon Glass <s...@chromium.org> Cc: Tom Rini <tr...@ti.com> Masahiro Yamada (6): Makefile: support descending down to subdirectories drivers: move some drivers to drivers/Makefile fs: move some file system to fs/Makefile ARM: tegra: move Tegra specific code under arch/arm/ ARM: omap: move OMAP specific code under arch/arm/ ARM: s5pc, exynos: move Samsung ARM SoC specific code under arch/arm/ Makefile | 44 +++---------------------------------------- arch/arm/cpu/Makefile | 2 ++ arch/arm/cpu/arm720t/Makefile | 2 ++ arch/arm/cpu/armv7/Makefile | 9 +++++++++ board/LEOX/elpt860/u-boot.lds | 1 - board/tqc/tqm8xx/u-boot.lds | 4 ++-- drivers/Makefile | 15 +++++++++++++++ fs/Makefile | 11 +++++++++++ scripts/Makefile.build | 15 +++++++++++++++ spl/Makefile | 14 +------------- 10 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 arch/arm/cpu/Makefile create mode 100644 drivers/Makefile -- 1.8.1.2 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot