| Dan Willemsen | cc60f01 | 2016-03-22 14:44:17 -0700 | [diff] [blame] | 1 | # We need to rebootstrap soong if SOONG_OUT_DIR or the reverse path from |
| 2 | # SOONG_OUT_DIR to TOP changes |
| 3 | SOONG_NEEDS_REBOOTSTRAP := |
| 4 | ifneq ($(wildcard $(SOONG_BOOTSTRAP)),) |
| 5 | ifneq ($(SOONG_OUT_DIR),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$BUILDDIR))) |
| 6 | SOONG_NEEDS_REBOOTSTRAP := FORCE |
| 7 | $(warning soong_out_dir changed) |
| 8 | endif |
| Colin Cross | 367ab29 | 2016-05-02 15:31:17 -0700 | [diff] [blame] | 9 | ifneq ($(strip $(shell build/soong/scripts/reverse_path.py $(SOONG_OUT_DIR))),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$SRCDIR_FROM_BUILDDIR))) |
| Dan Willemsen | cc60f01 | 2016-03-22 14:44:17 -0700 | [diff] [blame] | 10 | SOONG_NEEDS_REBOOTSTRAP := FORCE |
| 11 | $(warning reverse path changed) |
| 12 | endif |
| 13 | endif |
| 14 | |
| 15 | # Bootstrap soong. |
| 16 | $(SOONG_BOOTSTRAP): bootstrap.bash $(SOONG_NEEDS_REBOOTSTRAP) |
| Colin Cross | 3ebb2f7 | 2015-11-09 14:53:36 -0800 | [diff] [blame] | 17 | $(hide) mkdir -p $(dir $@) |
| Dan Willemsen | cc60f01 | 2016-03-22 14:44:17 -0700 | [diff] [blame] | 18 | $(hide) BUILDDIR=$(SOONG_OUT_DIR) ./bootstrap.bash |
| Colin Cross | 3ebb2f7 | 2015-11-09 14:53:36 -0800 | [diff] [blame] | 19 | |
| Dan Willemsen | 5f38f9b | 2015-12-11 13:50:00 -0800 | [diff] [blame] | 20 | # Tell soong that it is embedded in make |
| 21 | $(SOONG_IN_MAKE): |
| 22 | $(hide) mkdir -p $(dir $@) |
| 23 | $(hide) touch $@ |
| 24 | |
| Dan Willemsen | 2d12ce1 | 2016-03-10 15:03:41 -0800 | [diff] [blame] | 25 | # Run Soong, this implicitly create an Android.mk listing all soong outputs as |
| 26 | # prebuilts. |
| 27 | .PHONY: run_soong |
| Dan Willemsen | cc60f01 | 2016-03-22 14:44:17 -0700 | [diff] [blame] | 28 | run_soong: $(SOONG_BOOTSTRAP) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE |
| Dan Willemsen | 0533e4d | 2016-08-15 13:38:21 -0700 | [diff] [blame] | 29 | $(hide) SKIP_NINJA=true $(SOONG) |