From 8f57c9a2de0efdf0dd5f8c48a8c0196a45d398e3 Mon Sep 17 00:00:00 2001 From: Dan McArdle Date: Tue, 21 Nov 2023 19:37:15 -0500 Subject: [PATCH] Add target for compile_commands.json to Makefile --- Makefile | 10 +++++++++- setup.sh | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b340654..470fdc1 100644 --- a/Makefile +++ b/Makefile @@ -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. @@ -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 $< @@ -32,6 +39,7 @@ format: .PHONY: clean clean: + # Intentionally omitting compile_commands.json for convenience. -rm *.gb -rm *.map -rm *.noi diff --git a/setup.sh b/setup.sh index 1ca844c..07c6d8d 100755 --- a/setup.sh +++ b/setup.sh @@ -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