@@ -18,7 +18,7 @@ ZIP_URL ?=
1818ZIP_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
2222ifeq ($(DEBUG ) , 1)
2323 CFLAGS += -g -O0 -DDEBUG
2424else
@@ -133,8 +133,6 @@ $(BUILD_FOLDERS):
133133
134134build/% /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)
199197build/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
204207clean :
@@ -230,6 +233,9 @@ native-luajit: MACOSX_DEPLOYMENT_TARGET ?= 11.0
230233native-luajit : MAKE_LUAJIT_ARGS = MACOSX_DEPLOYMENT_TARGET=$(MACOSX_DEPLOYMENT_TARGET )
231234native-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
234240linux32 : MAKE_LUAJIT_ARGS += CC="$(CC ) -m32 -fPIC"
235241linux32 : CFLAGS += -m32 -fPIC
0 commit comments