From 7decab8c77db82e6adb6ba7a6dc721b2b6b007ed Mon Sep 17 00:00:00 2001 From: Peter Siegmund Date: Tue, 27 Jan 2026 00:47:02 +0100 Subject: [PATCH] some build tools optimization Signed-off-by: Peter Siegmund --- .github/workflows/push.yaml | 4 ++-- .gitignore | 1 + .vscode/tasks.json | 7 +++++++ Makefile | 19 +++++++++++++++---- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 2c88b7d..38f06a3 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -7,10 +7,10 @@ jobs: name: Build gbdk project steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Build - uses: wujood/gbdk-2020-github-builder@1.0.7 + uses: wujood/gbdk-2020-github-builder@1.0.8 with: subdirectory: ./src output-name: gb-snake diff --git a/.gitignore b/.gitignore index 31ff445..ab49d39 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ gen/ obj/ +dist/ diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 439a2de..9728ad8 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -19,6 +19,13 @@ "showReuseMessage": true, "clear": false } + }, + { + "label": "run Emulicious mit snake.gb", + "type": "shell", + "command": "java -jar ~/SDK/Emulicious/Emulicious.jar dist/snake.gb", + "group": "test", + "problemMatcher": [] } ] } \ No newline at end of file diff --git a/Makefile b/Makefile index 1044a2c..559bf87 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,6 @@ PNG2ASSET = $(GBDK_HOME)bin/png2asset # LCCFLAGS += -v # Uncomment for lcc verbose output LCCFLAGS +=-Wa-l -Wl-m -Wl-j -Wf--debug - # You can set the name of the .gb ROM file here PROJECTNAME = snake @@ -30,7 +29,7 @@ CSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreac ASMSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s))) OBJS = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o) -all: clean prepare png2asset $(BINS) +all: clean prepare png2asset $(BINS) compile.bat: Makefile @echo "REM Automatically generated from Makefile" > compile.bat @@ -56,10 +55,22 @@ $(OBJDIR)/%.s: $(SRCDIR)/%.c # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) $(LCC) $(LCCFLAGS) -o $(BINS) $(OBJS) + mv $(BINS) $(DSTDIR) png2asset: - ${PNG2ASSET} ${RESDIR}/splash_screen.png -c ${GENDIR}/splash_screen.c -map -source_tileset $(RESDIR)/splash_screen_tileset.png -noflip - ${PNG2ASSET} ${RESDIR}/splash_screen_tileset.png -c ${GENDIR}/splash_screen_tileset.c -tiles_only -map -noflip + @for f in $(RESDIR)/*.png; do \ + name=`basename "$$f" .png`; \ + if echo "$$name" | grep -q '_tileset$$'; then \ + ${PNG2ASSET} "$$f" -c ${GENDIR}/"$$name".c -tiles_only -map -noflip; \ + else \ + tileset="$(RESDIR)/$${name}_tileset.png"; \ + if [ -f "$$tileset" ]; then \ + ${PNG2ASSET} "$$f" -c ${GENDIR}/"$$name".c -source_tileset "$$tileset" -map -noflip; \ + else \ + ${PNG2ASSET} "$$f" -c ${GENDIR}/"$$name".c -map -noflip; \ + fi; \ + fi; \ + done prepare: mkdir -p $(DSTDIR)