From ffa82e8f924534aae39f0945384165818d434dd7 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Sat, 17 Jan 2026 21:25:00 +0100 Subject: [PATCH] export_assets make target --- .gitignore | 1 + .woodpecker.yml | 4 ++-- Makefile | 32 ++++++++++++++------------------ 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index afb1f44..a5b9ea1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +.local impostor.lua diff --git a/.woodpecker.yml b/.woodpecker.yml index d11b62b..ee12ebc 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -9,8 +9,8 @@ steps: <<: *environment XDG_RUNTIME_DIR: /tmp commands: - - make build PROJECT=$GAME_NAME - - make export PROJECT=$GAME_NAME + - make build + - make export - name: artifact image: alpine diff --git a/Makefile b/Makefile index 8b4a66f..3f44841 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,5 @@ # ----------------------------------------- # Makefile – TIC-80 project builder -# Usage: -# make build -# make import_assets -# make watch -# make export # ----------------------------------------- PROJECT = impostor @@ -17,28 +12,29 @@ OUTPUT_TIC = $(PROJECT).tic SRC_DIR = inc SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER)) -ASSETS_DIR = assets -ASSET_TYPES = tiles sprites sfx music +ASSETS_LUA = inc/meta/meta.assets.lua all: build -build: import_assets $(OUTPUT) +build: $(OUTPUT) $(OUTPUT): $(SRC) $(ORDER) @rm -f $(OUTPUT) @while read f; do \ cat "$(SRC_DIR)/$$f" >> $(OUTPUT); \ - echo "\n" >> $(OUTPUT); \ + echo "" >> $(OUTPUT); \ done < $(ORDER) -import_assets: - @for t in $(ASSET_TYPES); do \ - for f in $(ASSETS_DIR)/$$t/*.png; do \ - [ -e "$$f" ] || continue; \ - echo "==> Importing $$f as $$t..."; \ - tic80 --cli --skip --fs=. --cmd="import $$t $$f & exit"; \ - done; \ - done +export_assets: build + @echo "==> Exporting TIC-80 asset sections" + @mkdir -p inc/meta + @sed -n '/^-- /,/^-- <\/PALETTE>/p;\ + /^-- /,/^-- <\/TILES>/p;\ + /^-- /,/^-- <\/SPRITES>/p;\ + /^-- /,/^-- <\/MAP>/p;\ + /^-- /,/^-- <\/SFX>/p;\ + /^-- /,/^-- <\/MUSIC>/p' \ + $(OUTPUT) > $(ASSETS_LUA) export: build tic80 --cli --skip --fs=. \ @@ -46,4 +42,4 @@ export: build watch: make build - fswatch -o $(SRC_DIR) $(ORDER) $(ASSETS_DIR) | while read; do make build; done + fswatch -o $(SRC_DIR) $(ORDER) assets | while read; do make build; done