clone

two-player chess in the terminal, kept in a shared sqlite file and played with gum

main
select-mate.sh / Makefile
Makefile 1.7K
1SHELL := /bin/bash23TEST_ROOT ?= /tmp/select-mate-live4TEST_BOARD_PATH := $(TEST_ROOT)/shared/game.db5TEST_BOARD_URI := file:$(TEST_BOARD_PATH)?mode=rwc6TEST_CONFIG_ROOT := $(TEST_ROOT)/config7TEST_ALICE_CONFIG := $(TEST_CONFIG_ROOT)/alice8TEST_BOB_CONFIG := $(TEST_CONFIG_ROOT)/bob910.PHONY: help test-prepare test-reset test-board-uri alice bob test-alice test-bob1112help:13 @printf '%s\n' \14 'make alice Open the shared live-test board as alice.' \15 'make bob Open the shared live-test board as bob.' \16 'make test-prepare Create the shared board/config layout.' \17 'make test-reset Remove the shared live-test board and configs.' \18 'make test-board-uri Print the shared board URI.'1920test-prepare:21 @mkdir -p "$(dir $(TEST_BOARD_PATH))" "$(TEST_ALICE_CONFIG)" "$(TEST_BOB_CONFIG)"22 @printf 'identity=alice\n' > "$(TEST_ALICE_CONFIG)/select-mate.conf"23 @printf 'identity=bob\n' > "$(TEST_BOB_CONFIG)/select-mate.conf"24 @printf '%s\n' "$(TEST_BOARD_URI)" | ./select-mate.sh --whoami >/dev/null25 @printf 'Shared board: %s\n' "$(TEST_BOARD_URI)"26 @printf 'Alice config: %s\n' "$(TEST_ALICE_CONFIG)/select-mate.conf"27 @printf 'Bob config: %s\n' "$(TEST_BOB_CONFIG)/select-mate.conf"28 @printf '%s\n' 'Open one terminal with `make alice` and another with `make bob`.'2930test-reset:31 @rm -rf "$(TEST_ROOT)"32 @printf 'Removed %s\n' "$(TEST_ROOT)"3334test-board-uri:35 @printf '%s\n' "$(TEST_BOARD_URI)"3637alice: test-prepare38 @printf '%s\n' "$(TEST_BOARD_URI)" | XDG_CONFIG_HOME="$(TEST_ALICE_CONFIG)" ./select-mate.sh --identity alice3940bob: test-prepare41 @printf '%s\n' "$(TEST_BOARD_URI)" | XDG_CONFIG_HOME="$(TEST_BOB_CONFIG)" ./select-mate.sh --identity bob4243test-alice: alice4445test-bob: bob