From c6ffe17631cccf11fbe00479d2169116d494a7da Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Sat, 2 Feb 2013 18:26:03 +0100 Subject: automatically link all .cxx files in clang/ into the plugin This means that just moving sources to the dir will enable the plugin action in that source, without modifying any sources, so those changes would not be accidentally committed when using a rewriter to change LO sources. Change-Id: Ic5a9c52dbf1939a1e78ad39ed6691ce3a1f399df --- compilerplugins/Makefile-clang.mk | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'compilerplugins/Makefile-clang.mk') diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk index ea5d961ff1d5..619e11d57b2b 100644 --- a/compilerplugins/Makefile-clang.mk +++ b/compilerplugins/Makefile-clang.mk @@ -8,18 +8,6 @@ # Make sure variables in this Makefile do not conflict with other variables (e.g. from gbuild). -# The list of source files. -CLANGSRC= \ - plugin.cxx \ - pluginhandler.cxx \ - bodynotinblock.cxx \ - lclstaticfix.cxx \ - postfixincrementfix.cxx \ - removeforwardstringdecl.cxx \ - sallogareas.cxx \ - unusedvariablecheck.cxx \ - - # You may occassionally want to override some of these # Compile flags ('make CLANGCXXFLAGS=-g' if you need to debug the plugin) @@ -41,6 +29,24 @@ CLANGINDIR=$(SRCDIR)/compilerplugins/clang # plugin will cause cache misses with ccache. CLANGOUTDIR=$(BUILDDIR)/compilerplugins/obj +# The list of source files, generated automatically (all files in clang/, but not subdirs). +CLANGSRC=$(foreach src,$(wildcard $(CLANGINDIR)/*.cxx), $(notdir $(src))) +# Remember the sources and if they have changed, force plugin relinking. +CLANGSRCCHANGED= \ + $(shell echo $(CLANGSRC) | sort > $(CLANGOUTDIR)/sources-new.txt; \ + if diff $(CLANGOUTDIR)/sources.txt $(CLANGOUTDIR)/sources-new.txt >/dev/null 2>/dev/null; then \ + echo 0; \ + else \ + mv $(CLANGOUTDIR)/sources-new.txt $(CLANGOUTDIR)/sources.txt; \ + echo 1; \ + fi; \ + ) +ifeq ($(CLANGSRCCHANGED),1) +.PHONY: CLANGFORCE +CLANGFORCE: +$(CLANGOUTDIR)/plugin.so: CLANGFORCE +endif + compilerplugins: $(CLANGOUTDIR) $(CLANGOUTDIR)/plugin.so compilerplugins-clean: -- cgit