blob: 4a74f2ee35e96982aaa343fa15dc66f4220613fb [file] [log] [blame]
Dan Willemsencc60f012016-03-22 14:44:17 -07001# We need to rebootstrap soong if SOONG_OUT_DIR or the reverse path from
2# SOONG_OUT_DIR to TOP changes
3SOONG_NEEDS_REBOOTSTRAP :=
4ifneq ($(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 Cross367ab292016-05-02 15:31:17 -07009 ifneq ($(strip $(shell build/soong/scripts/reverse_path.py $(SOONG_OUT_DIR))),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$SRCDIR_FROM_BUILDDIR)))
Dan Willemsencc60f012016-03-22 14:44:17 -070010 SOONG_NEEDS_REBOOTSTRAP := FORCE
11 $(warning reverse path changed)
12 endif
13endif
14
15# Bootstrap soong.
16$(SOONG_BOOTSTRAP): bootstrap.bash $(SOONG_NEEDS_REBOOTSTRAP)
Colin Cross3ebb2f72015-11-09 14:53:36 -080017 $(hide) mkdir -p $(dir $@)
Dan Willemsencc60f012016-03-22 14:44:17 -070018 $(hide) BUILDDIR=$(SOONG_OUT_DIR) ./bootstrap.bash
Colin Cross3ebb2f72015-11-09 14:53:36 -080019
Dan Willemsen5f38f9b2015-12-11 13:50:00 -080020# Tell soong that it is embedded in make
21$(SOONG_IN_MAKE):
22 $(hide) mkdir -p $(dir $@)
23 $(hide) touch $@
24
Dan Willemsen2d12ce12016-03-10 15:03:41 -080025# Run Soong, this implicitly create an Android.mk listing all soong outputs as
26# prebuilts.
27.PHONY: run_soong
Dan Willemsencc60f012016-03-22 14:44:17 -070028run_soong: $(SOONG_BOOTSTRAP) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE
Dan Willemsen0533e4d2016-08-15 13:38:21 -070029 $(hide) SKIP_NINJA=true $(SOONG)