kbuild: change out-of-tree build
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Tue, 4 Feb 2014 08:24:24 +0000 (17:24 +0900)
committerTom Rini <trini@ti.com>
Wed, 19 Feb 2014 16:07:50 +0000 (11:07 -0500)
commit9e4140329ee9a787d0f96ac2829d618d47f7973f
tree6a40432f6f6723ba9ac5309076af17aec3bc0a9b
parentd958002589cb724907e8d4360d546403d1e6b7d8
kbuild: change out-of-tree build

This commit changes the working directory
where the build process occurs.

Before this commit, build process occurred under the source
tree for both in-tree and out-of-tree build.

That's why we needed to add $(obj) prefix to all generated
files in makefiles like follows:
  $(obj)u-boot.bin:  $(obj)u-boot

Here, $(obj) is empty for in-tree build, whereas it points
to the output directory for out-of-tree build.

And our old build system changes the current working directory
with "make -C <sub-dir>" syntax when descending into the
sub-directories.

On the other hand, Kbuild uses a different idea
to handle out-of-tree build and directory descending.

The build process of Kbuild always occurs under the output tree.
When "O=dir/to/store/output/files" is given, the build system
changes the current working directory to that directory and
restarts the make.

Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>"
syntax for descending into sub-directories.
(We can write it like "make $(obj)=<sub-dir>" with a shorthand.)
This means the current working directory is always the top
of the output directory.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>
64 files changed:
MAKEALL
Makefile
arch/arm/cpu/arm1136/config.mk
arch/arm/cpu/arm926ejs/config.mk
arch/arm/cpu/arm926ejs/davinci/config.mk
arch/arm/cpu/armv7/am33xx/config.mk
arch/arm/cpu/armv7/config.mk
arch/arm/cpu/armv7/omap3/config.mk
arch/arm/cpu/armv7/omap4/config.mk
arch/arm/cpu/armv7/omap5/config.mk
arch/arm/cpu/armv7/socfpga/config.mk
arch/blackfin/config.mk
arch/blackfin/cpu/Makefile
arch/mips/cpu/mips32/config.mk
arch/mips/cpu/mips64/config.mk
arch/mips/cpu/xburst/config.mk
arch/nds32/config.mk
arch/powerpc/lib/Makefile
arch/sandbox/cpu/Makefile
arch/sparc/config.mk
arch/x86/lib/Makefile
board/ait/cam_enc_4xx/config.mk
board/avionic-design/medcom-wide/Makefile
board/avionic-design/plutux/Makefile
board/avionic-design/tec-ng/Makefile
board/avionic-design/tec/Makefile
board/compal/paz00/Makefile
board/compulab/trimslice/Makefile
board/cray/L1/Makefile
board/h2200/Makefile
board/matrix_vision/mvblm7/Makefile
board/matrix_vision/mvsmr/Makefile
board/nvidia/common/Makefile
board/pcs440ep/config.mk
board/samsung/origen/Makefile
common/Makefile
config.mk
doc/DocBook/Makefile
drivers/bios_emulator/Makefile
dts/Makefile
examples/api/Makefile
examples/standalone/Makefile
fs/ubifs/Makefile
lib/Makefile
mkconfig
nand_spl/board/amcc/acadia/Makefile
nand_spl/board/amcc/bamboo/Makefile
nand_spl/board/amcc/canyonlands/Makefile
nand_spl/board/amcc/kilauea/Makefile
nand_spl/board/amcc/sequoia/Makefile
nand_spl/board/freescale/mpc8315erdb/Makefile
nand_spl/board/freescale/mpc8536ds/Makefile
nand_spl/board/freescale/mpc8569mds/Makefile
nand_spl/board/freescale/mpc8572ds/Makefile
nand_spl/board/freescale/p1023rds/Makefile
nand_spl/board/freescale/p1_p2_rdb/Makefile
nand_spl/board/sheldon/simpc8313/Makefile
post/lib_powerpc/fpu/Makefile
rules.mk
scripts/Kbuild.include
scripts/Makefile.build
scripts/Makefile.host.tmp
spl/Makefile
tools/Makefile