From 5071a55ddecc6614ec3a5fac38cba0bf9a417b82 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 18 Sep 2014 01:22:01 +0200 Subject: [PATCH] Add Makefile rule to generate .dir-locals.el file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is good for company-mode, so it won’t die due to unknown include directories. --- .gitignore | 1 + src/Makefile.am | 6 ++++++ src/gen-dir-locals-el.sh | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100755 src/gen-dir-locals-el.sh diff --git a/.gitignore b/.gitignore index 22d9325..9651482 100644 --- a/.gitignore +++ b/.gitignore @@ -100,3 +100,4 @@ Makefile.in /docs/reference/*/xml/ /docs/reference/*/html/ /gtk-doc.make +.dir-locals.el \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am index f7438cf..bf17202 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,3 +36,9 @@ astrognome_LDADD = $(SWE_GLIB_LIBS) $(GTK_LIBS) $(LIBXML_LIBS) $(LIBXSLT_LIBS) $ astrognome_LDFLAGS = -rdynamic astrognome_CFLAGS = $(SWE_GLIB_CFLAGS) $(CFLAGS) $(GTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS) $(WEBKIT_CFLAGS) $(GDA_CFLAGS) $(PIXBUF_CFLAGS) $(RSVG_CFLAGS) -Wall +# The following two lines generate a .dir-locals.el file, so +# company-mode won’t die due to unknown includes +.dir-locals.el: + @echo $(astrognome_CFLAGS) | ./gen-dir-locals-el.sh + +.PHONY: .dir-locals.el diff --git a/src/gen-dir-locals-el.sh b/src/gen-dir-locals-el.sh new file mode 100755 index 0000000..507fa35 --- /dev/null +++ b/src/gen-dir-locals-el.sh @@ -0,0 +1,8 @@ +#! /bin/sh + +(echo -n "((nil . ((company-clang-arguments . (" +for line in `cat - | sed -e 's/\s\+/\n/g' | grep '^-I' | sort | uniq` +do + echo '"'$line'"' +done +echo ")))))") > .dir-locals.el