the-maze/Makefile
File Type: text/x-makefile
FB_GAME := fbc -w all
FB_EDIT := fbc -w all -lang qb
OUT_DIR := out
# Main sources
GAME_SRC := game.bas
EDIT_SRC := edit.bas
# Assets to bundle into the output directory.
# Easy to extend for images, sounds, levels, config, etc.
# Just add new files here (supports subdirectories too).
ASSET_FILES := \
game.ini \
edit.ini \
world1.dat
# Future examples:
# assets/images/player.png \
# assets/sounds/beep.wav \
# assets/levels/level2.dat
GAME_BIN := $(OUT_DIR)/game
EDIT_BIN := $(OUT_DIR)/edit
ASSET_BINS := $(addprefix $(OUT_DIR)/, $(ASSET_FILES))
.PHONY: all game edit assets clean run
all: game edit assets
$(OUT_DIR):
mkdir -p $(OUT_DIR)
# Binaries depend on their sources *and* the Makefile (so changing
# compiler flags or build options triggers a rebuild).
$(GAME_BIN): $(GAME_SRC) Makefile | $(OUT_DIR)
$(FB_GAME) $(GAME_SRC) -x $@
$(EDIT_BIN): $(EDIT_SRC) Makefile | $(OUT_DIR)
$(FB_EDIT) $(EDIT_SRC) -x $@
# Copy assets. Also depends on Makefile in case the copy logic changes.
# Creates parent directories as needed for future subdir assets.
$(OUT_DIR)/%: % Makefile | $(OUT_DIR)
@mkdir -p $(dir $@)
cp $< $@
assets: $(ASSET_BINS)
game: $(GAME_BIN) assets
edit: $(EDIT_BIN) assets
clean:
rm -rf $(OUT_DIR)
# Optional args: make run ARGS='--fullscreen --scale=3'
# Always run from OUT_DIR so relative paths (game.ini, world1.dat) resolve.
run: game
cd $(OUT_DIR) && ./game $(ARGS)