# Tidewall build entry points. Everything runs headless with the repo-local engine.
GODOT := tools/godot.sh

.PHONY: check import parse test test-selfcheck smoke capture-test terrain-capture binaries verify-engine bot-matches match match-captures

## Everything that must pass before a push.
check: verify-engine binaries parse test test-selfcheck smoke

verify-engine:
	@$(GODOT) --verify

binaries:
	@tools/check_binaries.sh

## Refreshes Godot's global class cache, so class_name lookups resolve.
import:
	@$(GODOT) --import --quit >/dev/null 2>&1 || true

parse: import
	@$(GODOT) --script res://tools/parse_all.gd

test: import
	@tools/run_tests.sh

## Proves the test runner detects each kind of failure.
test-selfcheck: import
	@tools/test_selfcheck.sh

## Boots the headless server for 1,000 ticks and checks exit codes, logs and timing.
smoke: import
	@tools/smoke.sh

## Plays 20 bot-only matches and checks each has a winner, few bots drown and
## difficulty shows. Takes several minutes, so it isn't part of `check`.
## BOT_MATCH_SEEDS and BOT_MATCH_FIRST change how many seeds and where they start.
bot-matches: import
	@tools/bot_matches.sh

## Plays one whole offline match, lobby to results, with a scripted player and 23 bots,
## then replays its command log and checks the replay ends in the same state.
## MATCH_SEED picks the seed.
match: import
	@tools/match.sh

## Renders each stage of the match `make match` last played. Needs Docker.
match-captures: import
	@tools/match_captures.sh

## Renders the capture test scenes in the offscreen container. Needs Docker.
capture-test: import
	@tools/capture_selfcheck.sh

## Renders the terrain crack check and its control in the offscreen container. Needs Docker.
terrain-capture: import
	@tools/terrain_capture_check.sh
