mirror of
https://github.com/mars3142/gb-snake.git
synced 2026-03-12 19:49:05 +00:00
updated makefile
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -22,4 +22,5 @@
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode
|
||||
|
||||
gen/
|
||||
obj/
|
||||
|
||||
20
.vscode/settings.json
vendored
20
.vscode/settings.json
vendored
@@ -1,19 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"stdint.h": "c",
|
||||
"gb.h": "c",
|
||||
"version.h": "c"
|
||||
},
|
||||
"actionButtons": {
|
||||
"commands": [
|
||||
{
|
||||
"name": "Clean",
|
||||
"command": "make clean",
|
||||
},
|
||||
{
|
||||
"name": "Build",
|
||||
"command": "make",
|
||||
}
|
||||
]
|
||||
}
|
||||
"files.associations": {
|
||||
"stdint.h": "c"
|
||||
}
|
||||
}
|
||||
27
Makefile
27
Makefile
@@ -5,9 +5,10 @@
|
||||
|
||||
# If you move this project you can change the directory
|
||||
# to match your GBDK root directory (ex: GBDK_HOME = "C:/GBDK/"
|
||||
GBDK_HOME = ~/SDK/gbdk/
|
||||
GBDK_HOME = ${HOME}/SDK/gbdk/
|
||||
|
||||
LCC = $(GBDK_HOME)bin/lcc
|
||||
PNG2ASSET = $(GBDK_HOME)bin/png2asset
|
||||
|
||||
# You can set flags for LCC here
|
||||
# For example, you can uncomment the line below to turn on debug output
|
||||
@@ -16,17 +17,19 @@ LCC = $(GBDK_HOME)bin/lcc
|
||||
|
||||
|
||||
# You can set the name of the .gb ROM file here
|
||||
PROJECTNAME = Snake
|
||||
PROJECTNAME = snake
|
||||
|
||||
DSTDIR = dist
|
||||
GENDIR = gen
|
||||
SRCDIR = src
|
||||
OBJDIR = obj
|
||||
RESDIR = res
|
||||
BINS = $(OBJDIR)/$(PROJECTNAME).gb
|
||||
CSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreach dir,$(GENDIR),$(notdir $(wildcard $(dir)/*.c)))
|
||||
ASMSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
|
||||
OBJS = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
|
||||
|
||||
all: prepare $(BINS)
|
||||
all: clean prepare png2asset $(BINS)
|
||||
|
||||
compile.bat: Makefile
|
||||
@echo "REM Automatically generated from Makefile" > compile.bat
|
||||
@@ -34,10 +37,10 @@ compile.bat: Makefile
|
||||
|
||||
# Compile .c files in "src/" to .o object files
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
||||
$(LCC) $(LCCFLAGS) -c -o $@ $<
|
||||
$(LCC) $(LCCFLAGS) -I${GENDIR} -c -o $@ $<
|
||||
|
||||
# Compile .c files in "res/" to .o object files
|
||||
$(OBJDIR)/%.o: $(RESDIR)/%.c
|
||||
# Compile .c files in "gen/" to .o object files
|
||||
$(OBJDIR)/%.o: $(GENDIR)/%.c
|
||||
$(LCC) $(LCCFLAGS) -c -o $@ $<
|
||||
|
||||
# Compile .s assembly files in "src/" to .o object files
|
||||
@@ -53,10 +56,16 @@ $(OBJDIR)/%.s: $(SRCDIR)/%.c
|
||||
$(BINS): $(OBJS)
|
||||
$(LCC) $(LCCFLAGS) -o $(BINS) $(OBJS)
|
||||
|
||||
png2asset:
|
||||
${PNG2ASSET} ${RESDIR}/splash_screen.png -c ${GENDIR}/splash_screen.c -map -noflip
|
||||
|
||||
prepare:
|
||||
mkdir -p $(DSTDIR)
|
||||
mkdir -p $(OBJDIR)
|
||||
mkdir -p $(GENDIR)
|
||||
|
||||
clean:
|
||||
# rm -f *.gb *.ihx *.cdb *.adb *.noi *.map
|
||||
rm -f $(DSTDIR)/*.*
|
||||
rm -f $(OBJDIR)/*.*
|
||||
|
||||
rm -f $(GENDIR)/*.*
|
||||
rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm
|
||||
|
||||
BIN
res/splash_screen.aseprite
Normal file
BIN
res/splash_screen.aseprite
Normal file
Binary file not shown.
BIN
res/splash_screen.png
Normal file
BIN
res/splash_screen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 410 B |
@@ -1,7 +1,13 @@
|
||||
#include <gb/gb.h>
|
||||
#include <stdint.h>
|
||||
#include "splash_screen.h"
|
||||
|
||||
#define TILEMAP_WIDTH_IN_TILES (splash_screen_WIDTH >> 3)
|
||||
#define TILEMAP_HEIGHT_IN_TILES (splash_screen_HEIGHT >> 3)
|
||||
|
||||
void main()
|
||||
{
|
||||
///
|
||||
SHOW_BKG;
|
||||
set_bkg_data(0, splash_screen_TILE_COUNT, splash_screen_tiles);
|
||||
set_bkg_tiles(0, 0, TILEMAP_WIDTH_IN_TILES, TILEMAP_HEIGHT_IN_TILES, splash_screen_map);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user