Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ I built this project on macOS. The instructions should be pretty easy to follow
The build pipeline has dependencies on [node.js](http://nodejs.org) and [SDCC](http://sdcc.sourceforge.net). You'll need to install them.

### Dependencies
`cd` into `ihx2gb/` and run `npm install`.

`cd` into `img2gb/` and run `npm install`.

`cd` into `stringc/` and run `npm install`.

### Building the Game
`cd` into `game/` and run `make` or `make debug`.

### Building the Game and Dependencies
Just run `make`, `make debug` or `make run` in the root folder.

### Building with an SDCC Snapshot
*This is for versions of SDCC that aren't installed*
```
SDCC_HOME=/path/to/sdcc/share/sdcc/
make SDCCBIN=${SDCC_HOME}../../bin/
```
73 changes: 48 additions & 25 deletions game/makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
CC = sdcc
ASMC = sdasgb
SDCCBIN =
CC = $(SDCCBIN)sdcc
AS = $(SDCCBIN)sdasgb
MKROM = $(SDCCBIN)makebin
# https://github.com/LIJI32/SameBoy or any other emulator
EMU = sameboy
# https://github.com/bbbbbr/romusage
ROMUSE = romusage
NODE = node
CFLAGS = -c -mgbz80
ASMFLAGS = -plosgffjw
LINKFLAGS = -mgbz80 --no-std-crt0 --data-loc 0xc0a0
ASFLAGS = -plosgffjw
LDFLAGS = -mgbz80 --no-std-crt0 --data-loc 0xc0a0

GFXS = $(notdir $(shell find data/gfx -name '*.png'))
GFXSRC = $(patsubst %.png,data_gfx_%.c,$(GFXS))
Expand All @@ -13,44 +20,60 @@ OBJS = $(SRCS:.c=.o)
SRCFILES = $(patsubst %.c,src/%.c,$(SRCS))
OBJFILES = $(patsubst %.s,obj/%.rel,$(ASMS)) $(patsubst %.c,obj/%.rel,$(SRCS))

build: obj/dependencies bin/BubbleFactory.gb
ROM = BubbleFactory

debug: CFLAGS += -DDEBUG
.PHONY: build debug run clean spaceleft statistics

build: obj/dependencies bin/$(ROM).gb

debug: CFLAGS += -DDEBUG --debug
debug: LDFLAGS += -Wl-y
debug: build

src/data_strings.c: data/strings.json
node ../stringc data/stringsMap.json $< $@
$(NODE) ../stringc data/stringsMap.json $< $@

src/data_gfx_%.c: data/gfx/%.png
node ../img2gb -n $(notdir $(basename $<)) $< $@
$(NODE) ../img2gb -n $(notdir $(basename $<)) $< $@

obj/dependencies: $(SRCFILES)
obj/dependencies: $(SRCFILES) | obj/
@echo "regenerate dependency file"
@mkdir -p obj
@rm -f obj/dependencies
@$(RM) -f obj/dependencies
@for srcFile in $(SRCFILES) ; do \
{ printf "obj/"; $(CC) -MM $$srcFile; } >> obj/dependencies ; \
done

-include obj/dependencies

bin/BubbleFactory.gb: obj/game.ihx
@mkdir -p bin
node ../ihx2gb --name BUBBLEFACT --licensee DH --cartridge 0x1B --ram 1 --version 1 $< $@
bin/$(ROM).gb: obj/game.ihx | bin/
$(MKROM) -Z -yn BUBBLEFACT -yk DH -yt 0x1B -ya 1 -yS -yp0x014C=1 $< $@
cp obj/game.sym bin/$(ROM).sym
cp obj/game.noi bin/$(ROM).noi
test \! -s obj/game.cdb || cp obj/game.cdb bin/$(ROM).cdb

obj/game.ihx: $(OBJFILES)
@mkdir -p obj
$(CC) $(LINKFLAGS) $^ -o $@
obj/game.ihx: $(OBJFILES) | obj/
$(CC) $(LDFLAGS) $^ -o $@

obj/%.rel: src/%.c
@mkdir -p obj
obj/%.rel: src/%.c | obj/
$(CC) $(CFLAGS) $< -o $@

obj/%.rel: src/%.s
@mkdir -p obj
$(ASMC) $(ASMFLAGS) $@ $<
obj/%.rel: src/%.s | obj/
$(AS) $(ASFLAGS) $@ $<

%/:
@mkdir -p $@

spaceleft: build
$(ROMUSE) bin/$(ROM).noi -g -E

statistics: build
test \! -s bin/$(ROM).cdb || $(ROMUSE) bin/$(ROM).cdb -g
$(ROMUSE) bin/$(ROM).noi -G -E -sH -a

run: build
$(EMU) bin/$(ROM).gb

clean:
rm -rf src/data_*
rm -rf obj
rm -rf bin
$(RM) -rf src/data_*
$(RM) -rf obj
$(RM) -rf bin
257 changes: 0 additions & 257 deletions ihx2gb/ihx2gb.js

This file was deleted.

Loading