Handle out being a symlink
Soong needs to be able to reverse the relative path to out. Switch to absolute paths if .. won't work because of out being a symlink to somewhere else. Bug: 27612837 Change-Id: Ib8b9e0f80523148cfd4b69a03d164578916d8fd5
This commit is contained in:
parent
926096eff6
commit
d53c0c7b45
1 changed files with 15 additions and 6 deletions
|
@ -1,16 +1,25 @@
|
|||
SOONG_OUT_DIR := $(OUT_DIR)/soong
|
||||
|
||||
# This needs to exist before the realpath checks below
|
||||
$(shell mkdir -p $(SOONG_OUT_DIR))
|
||||
|
||||
ifeq (,$(filter /%,$(SOONG_OUT_DIR)))
|
||||
SOONG_TOP_RELPATH := $(shell python -c "import os; print os.path.relpath('$(TOP)', '$(SOONG_OUT_DIR)')")
|
||||
# Protect against out being a symlink and relative paths not working
|
||||
ifneq ($(realpath $(SOONG_OUT_DIR)/$(SOONG_TOP_RELPATH)),$(realpath $(TOP)))
|
||||
SOONG_OUT_DIR := $(abspath $(SOONG_OUT_DIR))
|
||||
SOONG_TOP_RELPATH := $(abspath $(TOP))
|
||||
endif
|
||||
else
|
||||
SOONG_TOP_RELPATH := $(abspath $(TOP))
|
||||
endif
|
||||
|
||||
SOONG := $(SOONG_OUT_DIR)/soong
|
||||
SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja
|
||||
SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk
|
||||
SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
|
||||
SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make
|
||||
|
||||
ifeq (,$(filter /%,$(SOONG_OUT_DIR)))
|
||||
SOONG_TOP_RELPATH := $(shell python -c "import os; print os.path.relpath('$(TOP)', '$(SOONG_OUT_DIR)')")
|
||||
else
|
||||
SOONG_TOP_RELPATH := $(realpath $(TOP))
|
||||
endif
|
||||
|
||||
# Bootstrap soong. Run only the first time for clean builds
|
||||
$(SOONG):
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
|
|
Loading…
Reference in a new issue