Skip to content

Commit 86dd63d

Browse files
authored
Merge pull request #32 from gilzoide/feature/compilation-database
Add compilation-database Makefile target
2 parents ba5bae4 + 68c9264 commit 86dd63d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ZIP_URL ?=
1818
ZIP_URL_DOWNLOAD_OUTPUT ?= /tmp/godot-lua-pluginscript-unzip-to-build.zip
1919

2020

21-
CFLAGS += -std=c11 "-I$(CURDIR)/lib/godot-headers" "-I$(CURDIR)/lib/high-level-gdnative" "-I$(CURDIR)/lib/luajit/src"
21+
CFLAGS += -std=c11 -Ilib/godot-headers -Ilib/high-level-gdnative -Ilib/luajit/src
2222
ifeq ($(DEBUG), 1)
2323
CFLAGS += -g -O0 -DDEBUG
2424
else
@@ -133,8 +133,6 @@ $(BUILD_FOLDERS):
133133

134134
build/%/language_gdnative.o: src/language_gdnative.c lib/high-level-gdnative/hgdn.h
135135
$(_CC) -o $@ $< -c $(CFLAGS)
136-
build/%/language_in_editor_callbacks.o: src/language_in_editor_callbacks.c
137-
$(_CC) -o $@ $< -c $(CFLAGS)
138136

139137
$(MAKE_LUAJIT_OUTPUT): | build/%/luajit build/jit
140138
$(MAKE) -C $(firstword $|) $(and $(TARGET_SYS),TARGET_SYS=$(TARGET_SYS)) $(MAKE_LUAJIT_ARGS)
@@ -199,6 +197,11 @@ build/lua_pluginscript.zip: $(LUASRCDIET_DEST) $(DIST_DEST)
199197
build/project.godot: src/tools/project.godot | build
200198
cp $< $@
201199

200+
build/compile_commands.json: COMPILE_COMMAND = $(_CC) -o build/language_gdnative.o src/language_gdnative.c -c $(CFLAGS)
201+
build/compile_commands.json: Makefile
202+
echo '[{"directory":"$(CURDIR)","file":"src/language_gdnative.c","command":"$(subst ",\",$(COMPILE_COMMAND))"}]' > $@
203+
204+
202205
# Phony targets
203206
.PHONY: clean dist docs set-version unzip-to-build
204207
clean:
@@ -230,6 +233,9 @@ native-luajit: MACOSX_DEPLOYMENT_TARGET ?= 11.0
230233
native-luajit: MAKE_LUAJIT_ARGS = MACOSX_DEPLOYMENT_TARGET=$(MACOSX_DEPLOYMENT_TARGET)
231234
native-luajit: build/native/luajit/src/luajit.o
232235

236+
compilation-database: build/compile_commands.json
237+
compdb: compilation-database
238+
233239
# Targets by OS + arch
234240
linux32: MAKE_LUAJIT_ARGS += CC="$(CC) -m32 -fPIC"
235241
linux32: CFLAGS += -m32 -fPIC

0 commit comments

Comments
 (0)