# Android 入口（仅 Adreno 机型）。规则在 build.mk，以 dm/host 为当前目录跑（宿主共用源码）；产物在 build/（不进 git）
#   make            = make apk：libd2r.so + d2r.apk（不用 Gradle）
#   make install    装到 adb 连着的手机（会结束正在运行的游戏）
#   make headless   无头宿主 build/dmhost（adb shell 直接跑）
#   make tests      Vulkan 后端设备测试 build/tests/t_vk_perf
#   没有游戏文件生成的表头时：DM_GENH_DIR=<表头目录>；并行：-j8
# Android entry point (Adreno devices only). The rules are in build.mk, run with dm/host as the current directory (shared host sources); outputs in build/ (not in git)
#   make            = make apk: libd2r.so + d2r.apk (no Gradle)
#   make install    install onto the phone connected over adb (ends a running game)
#   make headless   headless host build/dmhost (run directly from adb shell)
#   make tests      Vulkan backend device test build/tests/t_vk_perf
#   Without the headers generated from game files: DM_GENH_DIR=<header dir>; parallel: -j8
HOST := $(abspath ../host)
B := $(CURDIR)/build
apk: lib
	sh app/build_apk.sh
lib:
	$(MAKE) -C $(HOST) -f $(CURDIR)/build.mk APP=1 $(B)/app/libd2r.so
install: apk
	adb install -r $(B)/app/d2r.apk
headless:
	$(MAKE) -C $(HOST) -f $(CURDIR)/build.mk $(B)/dmhost
tests:
	$(MAKE) -C tests
host-tests:
	python3 tests/run_checks.py --host-only $(if $(NDK),--ndk "$(NDK)") --output $(B)/checks-$(shell date +%Y%m%d-%H%M%S)
clean:
	rm -rf $(B)
.PHONY: apk lib install headless tests host-tests clean
