Skip to content

Commit 42d1dde

Browse files
committed
Add debug build option
1 parent fccb10c commit 42d1dde

3 files changed

Lines changed: 35 additions & 15 deletions

File tree

.vscode/tasks.json

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@
1010
"problemMatcher": []
1111
},
1212
{
13-
"label": "Bananas: Build",
13+
"label": "Bananas: Build (Release)",
1414
"type": "shell",
1515
"command": "${workspaceFolder}/scripts/build.sh",
1616
"group": { "kind": "build", "isDefault": true },
1717
"presentation": { "reveal": "always", "panel": "shared" },
1818
"problemMatcher": []
1919
},
20+
{
21+
"label": "Bananas: Build (Debug)",
22+
"type": "shell",
23+
"command": "${workspaceFolder}/scripts/build.sh DEBUG=1",
24+
"group": "build",
25+
"presentation": { "reveal": "always", "panel": "shared" },
26+
"problemMatcher": []
27+
},
2028
{
2129
"label": "Bananas: Clean",
2230
"type": "shell",
@@ -34,9 +42,17 @@
3442
"problemMatcher": []
3543
},
3644
{
37-
"label": "Bananas: Build & Play",
45+
"label": "Bananas: Build (Release) & Play",
46+
"dependsOrder": "sequence",
47+
"dependsOn": ["Bananas: Build (Release)", "Bananas: Play"],
48+
"group": "test",
49+
"presentation": { "reveal": "always", "panel": "shared" },
50+
"problemMatcher": []
51+
},
52+
{
53+
"label": "Bananas: Build (Debug) & Play",
3854
"dependsOrder": "sequence",
39-
"dependsOn": ["Bananas: Build", "Bananas: Play"],
55+
"dependsOn": ["Bananas: Build (Debug)", "Bananas: Play"],
4056
"group": "test",
4157
"presentation": { "reveal": "always", "panel": "shared" },
4258
"problemMatcher": []

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ HDRS := $(shell find $(SRC_DIR) -name '*.h') $(ASSET_HDRS)
1717

1818
CPPFLAGS := -I$(BUILD_DIR)
1919

20+
ifeq ($(DEBUG),1)
21+
CFLAGS += -Wa-l -Wl-j -Wl-m -Wm-yS
22+
endif
23+
2024
PNG2ASSET_FLAGS := -keep_duplicate_tiles -no_palettes -map -bpp 2 -tiles_only -pack_mode gb -noflip -keep_palette_order
2125

2226
all: $(ROM)
@@ -31,7 +35,7 @@ $(GEN_DIR)/%.c: $(ASSET_DIR)/%.png Makefile | $(GEN_DIR)
3135
$(GEN_DIR)/%.h: $(GEN_DIR)/%.c ;
3236

3337
$(ROM): $(SRCS) $(HDRS) | $(BUILD_DIR)
34-
$(CC) $(CPPFLAGS) -o $@ $(SRCS)
38+
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(SRCS)
3539

3640
clean:
3741
rm -rf $(BUILD_DIR)

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,21 @@ A 2-player artillery game for the original Game Boy (DMG), inspired by the class
1414

1515
Download the latest release ROM [bananas.gb](https://github.com/mdeclerk/Bananas/releases/latest) and run with [SameBoy](https://sameboy.github.io/) or [mGBA](https://mgba.io/).
1616

17+
## Prerequisites
1718

18-
## Getting Started
19+
- Docker (containerized build environment)
20+
- [SameBoy](https://sameboy.github.io/) (GameBoy emulator)
21+
22+
## Build environment
1923

2024
```sh
21-
./scripts/init.sh # one-time Docker build env setup
22-
./scripts/build.sh # compile → build/bananas.gb
23-
./scripts/play.sh # launch SameBoy
25+
./scripts/init.sh # one-time Docker build env setup
26+
./scripts/build.sh # release build → build/bananas.gb
27+
./scripts/build.sh DEBUG=1 # debug build with .map + .sym/.noi symbols
28+
./scripts/play.sh # launch SameBoy with build/bananas.gb
2429
```
2530

26-
All scripts are also available as VS Code tasks via **Terminal → Run Task** (Init, Build, Clean, Play, Build & Play).
31+
All scripts are also available as VS Code tasks via **Terminal → Run Task**.
2732

2833
## How to play
2934

@@ -33,12 +38,7 @@ All scripts are also available as VS Code tasks via **Terminal → Run Task** (I
3338
<img src="docs/gameplay-subtitled.gif" alt="Gameplay demo" width="336">
3439
</p>
3540

36-
## Prerequisites
37-
38-
- Docker (containerized build environment)
39-
- [SameBoy](https://sameboy.github.io/) (GameBoy emulator)
40-
41-
## Project Structure
41+
## Project Layout
4242

4343
```
4444
src/ Source code — gameplay, physics, rendering, input, sfx

0 commit comments

Comments
 (0)