Skip to content

Commit

Permalink
Add target for compile_commands.json to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
dmcardle committed Nov 22, 2023
1 parent cfbfa3e commit 8f57c9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
CC := gbdk/bin/lcc -Wa-l -Wl-m -Wl-j

HOST_OBJS = game.clang.o

.PHONY: all
all: game.gb game.gen.asm game.clang.o
all: game.gb game.gen.asm $(HOST_OBJS)

# TODO: Compile with a specific C version (C11?). When I add `std-c89`, per GBDK
# documentation, the compiler hangs.
Expand All @@ -22,6 +24,11 @@ all: game.gb game.gen.asm game.clang.o
-Werror=all -Wno-implicit-int -Wno-unused-value \
-o $@ $^

.PHONY: compile_commands.json
compile_commands.json:
$(MAKE) clean
bear -- $(MAKE) $(HOST_OBJS)

.PHONY: run
run: game.gb
sdlgnuboy --fullscreen=0 --scale=3 $<
Expand All @@ -32,6 +39,7 @@ format:

.PHONY: clean
clean:
# Intentionally omitting compile_commands.json for convenience.
-rm *.gb
-rm *.map
-rm *.noi
Expand Down
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
set -ex

sudo apt install -y build-essential clang-format gnuboy-sdl
sudo apt install -y bear build-essential clang-format gnuboy-sdl
rm -rf gbdk*
wget 'https://github.com/gbdk-2020/gbdk-2020/releases/download/4.1.1/gbdk-linux64.tar.gz'
tar xzvf gbdk-linux64.tar.gz

0 comments on commit 8f57c9a

Please sign in to comment.