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