spacetaxi/tools/staxiharness/Makefile
2026-10-05 18:50:09 -05:00

43 lines
1.7 KiB
Makefile

# Host-side checks of Space Taxi's front-end screens (the parts tools/stsim
# cannot reach: they live in spacetaxi.c, above the simulation). Builds the
# game on JoeyLib's BLANK port with spacetaxi.c INCLUDED into the harness so
# its statics are reachable, and wraps the keyboard queue and the save file
# with scripted stand-ins.
#
# make -C tools/staxiharness build + run
#
# JOEYLIB is the JoeyLib checkout, as an absolute path (default: joeylib
# beside this repository). The title screen comes from the game's DOS bake,
# so build the game for DOS first.
REPO := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../..)
JOEYLIB ?= $(REPO)/../joeylib
JL := $(abspath $(JOEYLIB))
GEN := $(REPO)/build/generated/dos
OUT := $(REPO)/build/tools/staxiharness
SRCS := $(filter-out $(REPO)/spacetaxi.c,$(wildcard $(REPO)/*.c)) \
$(wildcard $(JL)/src/core/*.c) $(wildcard $(JL)/src/generic/*.c) \
$(JL)/src/blank/blank.c
CFLAGS := -O0 -g -w -DJOEYLIB_PLATFORM_BLANK -I$(JL)/include -I$(JL)/src/core \
-I$(JL)/src/codegen -I$(REPO)
WRAPS := -Wl,--wrap=jlInputGetChar -Wl,--wrap=jlSaveWrite -Wl,--wrap=jlSaveRead
.PHONY: all run clean
all: run
$(OUT)/harness: harness.c $(REPO)/spacetaxi.c $(SRCS)
@mkdir -p $(OUT)
$(CC) $(CFLAGS) harness.c $(SRCS) $(WRAPS) -o $@
# The title screen's level file is read through DATA/levels (the DOS bake
# is the cross-platform STL4 form), so run from a directory that has one.
run: $(OUT)/harness
@test -f $(GEN)/levels/title.dat || { echo "staxiharness: no $(GEN)/levels/title.dat (build the game for DOS first)" >&2; exit 2; }
@mkdir -p $(OUT)/DATA
@ln -sfn $(GEN)/levels $(OUT)/DATA/levels
@ln -sfn $(GEN)/speech.bin $(OUT)/DATA/speech.bin
cd $(OUT) && ./harness
clean:
rm -rf $(OUT)