some build tools optimization

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2026-01-27 00:47:02 +01:00
parent 5143e55753
commit 7decab8c77
4 changed files with 25 additions and 6 deletions

View File

@@ -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

1
.gitignore vendored
View File

@@ -24,3 +24,4 @@
gen/
obj/
dist/

7
.vscode/tasks.json vendored
View File

@@ -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": []
}
]
}

View File

@@ -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)