ビルドの高速化 outディレクトリを変更する

Android Buildのメーリングリストで以下の内容がありました

New experimental build system feature: out/ directories in another location
http://groups.google.com/group/android-building/browse_thread/thread/ca6c1648aa52acb9

This should be useful when storing the build output on a physically
different volume. Additional benefits might come from using a
dedicated volume for that where journaling is disabled, and/or from
using an SSD.

To use it, set the OUT_DIR_COMMON_BASE environment to the directory
where the output directories will be created. A subdirectory will be
created there for each source tree. The name of the subdirectory
matches that of the source tree.

要約すると

  • build環境のoutフォルダを任意の場所に設定( = OUT_DIR_COMMON_BASE)できるよ
  • outフォルダをSSDにすれば、高速化できるよ

ってことです。

ただし、この修正はmasterブランチのみ対応されています。
(※android-4.0.3_r1ブランチには対応なし)
他のブランチで使用する場合はマージするなり、直書きで修正すれば使用できると思います。



では、以下のファイルを見てみましょう。
\build\core\envsetup.mk

# ---------------------------------------------------------------
# figure out the output directories

ifeq (,$(strip $(OUT_DIR)))
ifeq (,$(strip $(OUT_DIR_COMMON_BASE)))
OUT_DIR := $(TOPDIR)out
else
OUT_DIR := $(OUT_DIR_COMMON_BASE)/$(notdir $(PWD))
endif
endif

DEBUG_OUT_DIR := $(OUT_DIR)/debug

修正内容は以下を参照:
http://218.211.38.204/?p=android/platform/build.git;a=commit;h=ffe03c984b2836a9b4e4ddb5a17ec0dd26ba686c