From 4e964da1ae95c75eac4f1c1a3835d13367fbe273 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 30 Nov 2017 16:44:26 +0100 Subject: [PATCH] LOCAL ONLY! Add Makefile rule to generate a .dir-locals.el file --- .gitignore | 1 + Makefile.am | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 18bca68..da55882 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ Makefile.in /GTAGS /INSTALL /ChangeLog +/.dir-locals.el /src/matrix-version.h /src/matrix-enumtypes.[ch] /src/matrix-marshalers.[ch] diff --git a/Makefile.am b/Makefile.am index 5f55bde..b68c985 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,4 +63,22 @@ ChangeLog: echo A git checkout and git-log is required to generate this file >> $@); \ fi -.PHONY: ChangeLog +.PHONY: ChangeLog .dir-locals.el + +.dir-locals.el: + @echo -n ""; \ + includes=`echo -I$(top_srcdir) $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(VALA_CFLAGS) | tr " " "\n" | grep '^-I' | sed 's/^-I//'`; \ + flycheck_path='('; \ + company_path='('; \ + for incl in $$includes; \ + do \ + if [ "$$incl" == "." ]; \ + then \ + incl="$(abs_top_srcdir)"; \ + fi; \ + flycheck_path="$$flycheck_path \"$$incl\""; \ + company_path="$$company_path \"-I$$incl\""; \ + done; \ + flycheck_path="$$flycheck_path)"; \ + company_path="$$company_path)"; \ + echo "((c-mode . ((flycheck-clang-include-path . $$flycheck_path) (company-clang-arguments . $$company_path))))" > $@