aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-09-23 00:24:23 +0200
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-09-23 00:24:23 +0200
commit207af96f4eb3220534ea06c2e107517372246544 (patch)
treee7e6ecf7811cb61475eec4afdbe6396108281e8a
parentf3ede03b6edec09f4f43560e59ad76cc4f2b0c90 (diff)
generate compile_flags.txtHEADmaster-fmsbw-cimaster
This can be read by clangd as an alternative to compile_commands.json (which would be trickier to generate with Autotools). However, since this is generated in the build directory, it may not always be picked up automatically -- a build/ directory should work, but otherwise you might have to pass --compile-commands-dir to clangd.
-rw-r--r--.gitignore1
-rw-r--r--src/Makefile.am8
2 files changed, 8 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 6447f82..2a08d12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,3 +53,4 @@ testsuite.dir
# Created e.g. by `bear -- gmake` for clangd.
# You may also have to create a symbolic link, so clangd finds it.
compile_commands.json
+compile_flags.txt
diff --git a/src/Makefile.am b/src/Makefile.am
index fa6c0e4..eb532e3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,7 @@ include $(top_srcdir)/bootstrap.am
include $(top_srcdir)/contrib/scintilla.am
# FIXME: Common flags should be in configure.ac
+# See also compile_flags.txt.
AM_CFLAGS = -std=gnu11 -Wall -Wno-initializer-overrides -Wno-unused-value
AM_CPPFLAGS += -I$(top_srcdir)/contrib/rb3ptr -I$(top_srcdir)/contrib/terex \
-I$(top_srcdir)/contrib/sj.h
@@ -22,7 +23,12 @@ if STATIC_EXECUTABLES
AM_LDFLAGS += -all-static
endif
-BUILT_SOURCES =
+BUILT_SOURCES = compile_flags.txt
+
+# for clangd
+compile_flags.txt : GNUmakefile
+ printf '%s\n' $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >$@
dist_noinst_SCRIPTS = symbols-extract.tes