Add Makefile rule to generate .dir-locals.el file

It is good for company-mode, so it won’t die due to unknown include
directories.
This commit is contained in:
Gergely Polonkai 2014-09-18 01:22:01 +02:00
parent 8e828e582c
commit 5071a55dde
3 changed files with 15 additions and 0 deletions

1
.gitignore vendored
View File

@ -100,3 +100,4 @@ Makefile.in
/docs/reference/*/xml/ /docs/reference/*/xml/
/docs/reference/*/html/ /docs/reference/*/html/
/gtk-doc.make /gtk-doc.make
.dir-locals.el

View File

@ -36,3 +36,9 @@ astrognome_LDADD = $(SWE_GLIB_LIBS) $(GTK_LIBS) $(LIBXML_LIBS) $(LIBXSLT_LIBS) $
astrognome_LDFLAGS = -rdynamic astrognome_LDFLAGS = -rdynamic
astrognome_CFLAGS = $(SWE_GLIB_CFLAGS) $(CFLAGS) $(GTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS) $(WEBKIT_CFLAGS) $(GDA_CFLAGS) $(PIXBUF_CFLAGS) $(RSVG_CFLAGS) -Wall 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 wont die due to unknown includes
.dir-locals.el:
@echo $(astrognome_CFLAGS) | ./gen-dir-locals-el.sh
.PHONY: .dir-locals.el

8
src/gen-dir-locals-el.sh Executable file
View File

@ -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