From 6f99e08a35a0a247bb292dc1a063d528c2fce2ab Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 25 Jul 2017 18:42:57 +0200 Subject: [PATCH] added new make target to build .clang_complete files for Clang-based Atom / Vim autocompletion support --- .gitignore | 1 + Makefile | 5 +++-- Makefile.complete | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 Makefile.complete diff --git a/.gitignore b/.gitignore index 7f1aabf66..f91392254 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /build/ *~ +.clang_complete diff --git a/Makefile b/Makefile index e43e2a5ca..ebbc86604 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,8 @@ CFLAGS += $(addprefix -DWITH_, $(call escape,$(PKGS))) install: $(addprefix install-,$(filter-out thirdparty doc clients,$(MODULES))) clean: $(addprefix clean-, $(filter-out thirdparty doc clients,$(MODULES))) -.PHONY: all everything clean install FORCE +.PHONY: all everything clean install +-include $(wildcard $(SRCDIR)/Makefile.*) -include $(wildcard $(BUILDDIR)/**/*.d) --include $(addsuffix /Makefile.inc,$(MODULES)) +-include $(patsubst %,$(SRCDIR)/%/Makefile.inc,$(MODULES)) diff --git a/Makefile.complete b/Makefile.complete new file mode 100644 index 000000000..5e518786c --- /dev/null +++ b/Makefile.complete @@ -0,0 +1,49 @@ +# Makefile for clang autocompletion +# +# This Makefile produces .clang_complete files containing compiler flags +# which are used by clang autocompletion tools such as: +# +# - https://atom.io/packages/autocomplete-clang +# - https://github.com/Rip-Rip/clang_complete +# +# @author Steffen Vogel +# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC +# @license GNU General Public License (version 3) +# +# VILLASnode +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################### + +SRCMODULES = src lib plugins tools tests/unit + +CLANG_COMPLETES = $(patsubst %,$(SRCDIR)/%/.clang_complete,$(SRCMODULES)) + +$(SRCDIR)/tests/unit/.clang_complete: FLAGS = $(TEST_CFLAGS) +$(SRCDIR)/src/.clang_complete: FLAGS = $(SRC_CFLAGS) +$(SRCDIR)/tools/.clang_complete: FLAGS = $(TOOLS_CFLAGS) +$(SRCDIR)/plugins/.clang_complete: FLAGS = $(PLUGIN_CFLAGS) +$(SRCDIR)/lib/.clang_complete: FLAGS = $(LIB_CFLAGS) + +%/.clang_complete: + echo "$(FLAGS)" > $@ + +clang-complete: $(CLANG_COMPLETES) + +clean: clean-clang-complete + +clean-clang-complete: + rm $(CLANG_COMPLETES) + +.PHONY: clang-complete