From 2596308a09c2b87a24165d0f98bc673e30b729d1 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Wed, 17 May 2023 22:26:49 -0400 Subject: [PATCH] doc: configure: add configure option to generate .ccls file `ccls` needs information from FRR build configuration to work, so allow creation of a custom ccls config during autoconf. Paraphrasing the doc entry: ccls is a very powerful tool that allows dev environments to provide sophisticated IDE functionality, e.g., semantically aware jumps and code refactoring... Signed-off-by: Christian Hopps --- .gitignore | 1 + configure.ac | 39 +++++++++++++++++++++++++++++++++++++++ doc/user/installation.rst | 12 ++++++++++++ 3 files changed, 52 insertions(+) diff --git a/.gitignore b/.gitignore index 3dd6a44409..a66e3ccd3c 100644 --- a/.gitignore +++ b/.gitignore @@ -106,6 +106,7 @@ GSYMS GRTAGS GPATH compile_commands.json +.ccls .ccls-cache .dirstamp refix diff --git a/configure.ac b/configure.ac index b9af768641..0120c517c6 100644 --- a/configure.ac +++ b/configure.ac @@ -794,6 +794,9 @@ if test "$ac_cv_lib_json_c_json_object_get" = "no"; then fi ]) +AC_ARG_ENABLE([ccls], +AS_HELP_STRING([--enable-ccls], [Write .ccls config for this build])) + AC_ARG_ENABLE([dev_build], AS_HELP_STRING([--enable-dev-build], [build for development])) @@ -2820,6 +2823,42 @@ AC_CONFIG_FILES([tools/frrcommon.sh]) AC_CONFIG_FILES([tools/frr.service]) AC_CONFIG_FILES([tools/frr@.service]) +# dnl write out a ccls file with our compile configuration +# dnl have to add -Wno-unused-function otherwise foobar_cmd_magic causes +# dnl all DEFPY(), et al., macros to flag as errors. +AS_IF([test "$enable_ccls" = "yes"], [ + AC_CONFIG_COMMANDS([gen-dot-ccls], [ + cat > "${srcdir}/.ccls" <> "${srcdir}/.ccls" + fi + if test -n "$FRR_ALL_CCLS_FLAGS"; then + echo ${FRR_ALL_CCLS_FLAGS} | tr ' ' '\n' >> "${srcdir}/.ccls" + fi + if test -n "$FRR_ALL_CCLS_CFLAGS"; then + cat >> "${srcdir}/.ccls" < Install architecture-independent files in `prefix` [/usr/local].