summaryrefslogtreecommitdiff
path: root/solenv/gbuild
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-10-15 15:36:25 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-10-15 15:40:33 +0200
commit0349c738da5970d9f0fc10d7cf4d7b766ce10e13 (patch)
tree572fa7304614ae5cac51938d45823114655e145e /solenv/gbuild
parent41d6a0ea2d2d3c8daa758771bf956036d84cbe1a (diff)
support for compiler rewriters
Change-Id: I12e98ac9fc49ef2007914324006a396d183b778c
Diffstat (limited to 'solenv/gbuild')
-rw-r--r--solenv/gbuild/LinkTarget.mk25
-rw-r--r--solenv/gbuild/platform/com_GCC_class.mk32
-rw-r--r--solenv/gbuild/platform/com_GCC_defs.mk6
3 files changed, 62 insertions, 1 deletions
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 617fc562bb2e..00c218697c11 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -114,6 +114,9 @@ gb_Object__command_dep = \
$(call gb_Output_error,gb_Object__command_dep is only for gb_FULLDEPS)
endif
+# This one only exists to force .c/.cxx "rebuilds" when running a compiler tool.
+.PHONY: force_compiler_tool_run
+force_compiler_tool_run:
# CObject class
@@ -121,8 +124,13 @@ gb_CObject_get_source = $(1)/$(2).c
# defined by platform
# gb_CObject__command
+ifneq ($(COMPILER_PLUGIN_TOOL),)
+$(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%) force_compiler_tool_run
+ $(call gb_CObject__tool_command,$*,$<)
+else
$(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%)
$(call gb_CObject__command,$@,$*,$<,$(call gb_CObject_get_dep_target,$*))
+endif
ifeq ($(gb_FULLDEPS),$(true))
$(call gb_CObject_get_dep_target,%) :
@@ -138,8 +146,13 @@ gb_CxxObject_get_source = $(1)/$(2).cxx
# defined by platform
# gb_CxxObject__command
+ifneq ($(COMPILER_PLUGIN_TOOL),)
+$(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%) force_compiler_tool_run
+ $(call gb_CxxObject__tool_command,$*,$<)
+else
$(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%)
$(call gb_CxxObject__command,$@,$*,$<,$(call gb_CxxObject_get_dep_target,$*))
+endif
ifeq ($(gb_FULLDEPS),$(true))
$(call gb_CxxObject_get_dep_target,%) :
@@ -252,6 +265,11 @@ gb_ObjCxxObject_get_source = $(1)/$(2).mm
# defined by platform
# gb_ObjCxxObject__command
+ifneq ($(COMPILER_PLUGIN_TOOL),)
+$(call gb_ObjCxxObject_get_target,%) : $(call gb_ObjCxxObject_get_source,$(SRCDIR),%) force_compiler_tool_run
+ $(call gb_ObjCxxObject__tool_command,$*,$<)
+else
+
$(call gb_ObjCxxObject_get_target,%) : $(call gb_ObjCxxObject_get_source,$(SRCDIR),%)
$(call gb_ObjCxxObject__command,$@,$*,$<,$(call gb_ObjCxxObject_get_dep_target,$*))
@@ -261,6 +279,7 @@ $(call gb_ObjCxxObject_get_dep_target,%) :
$(call gb_Object__command_dep,$@,$(call gb_ObjCxxObject_get_target,$*)))
endif
+endif
# ObjCObject class
@@ -270,6 +289,11 @@ gb_ObjCObject_get_source = $(1)/$(2).m
# defined by platform
# gb_ObjCObject__command
+ifneq ($(COMPILER_PLUGIN_TOOL),)
+$(call gb_ObjCObject_get_target,%) : $(call gb_ObjCObject_get_source,$(SRCDIR),%) force_compiler_tool_run
+ $(call gb_ObjCObject__tool_command,$*,$<)
+else
+
$(call gb_ObjCObject_get_target,%) : $(call gb_ObjCObject_get_source,$(SRCDIR),%)
$(call gb_ObjCObject__command,$@,$*,$<,$(call gb_ObjCObject_get_dep_target,$*))
@@ -279,6 +303,7 @@ $(call gb_ObjCObject_get_dep_target,%) :
$(call gb_Object__command_dep,$@,$(call gb_ObjCObject_get_target,$*)))
endif
+endif
# AsmObject class
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index 761a4050e3cb..1a88a36c42f1 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -72,6 +72,22 @@ $(call gb_Helper_abbreviate_dirs,\
)
endef
+# Used to run a compiler plugin tool.
+# $(call gb_CObject__tool_command,relative-source,source)
+define gb_CObject__tool_command
+$(call gb_Output_announce,$(1).c,$(true),C ,3)
+$(call gb_Helper_abbreviate_dirs,\
+ ICECC=no \
+ $(gb_CC) \
+ $(DEFS) \
+ $(T_CFLAGS) \
+ -c $(2) \
+ -I$(dir $(2)) \
+ $(INCLUDE) \
+ $(gb_COMPILER_PLUGINS) \
+ )
+endef
+
# CxxObject class
# $(call gb_CxxObject__command,object,relative-source,source,dep-file)
@@ -96,6 +112,22 @@ $(call gb_Helper_abbreviate_dirs,\
)
endef
+# Used to run a compiler plugin tool.
+# $(call gb_CxxObject__tool_command,relative-source,source)
+define gb_CxxObject__tool_command
+$(call gb_Output_announce,$(1).cxx,$(true),CXX,3)
+$(call gb_Helper_abbreviate_dirs,\
+ ICECC=no \
+ $(gb_CXX) \
+ $(DEFS) \
+ $(T_CXXFLAGS) \
+ -c $(2) \
+ -I$(dir $(2)) \
+ $(INCLUDE_STL) $(INCLUDE) \
+ $(gb_COMPILER_PLUGINS) \
+ )
+endef
+
define gb_SrsPartTarget__command_dep
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(call gb_SrsPartTarget_get_dep_target,$(1))) && cd $(SRCDIR) && \
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index fd93af253bfc..a3d26722ef57 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -154,7 +154,11 @@ gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC)))
gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
ifeq ($(COM_GCC_IS_CLANG),TRUE)
-gb_COMPILER_PLUGINS :=-Xclang -load -Xclang $(SRCDIR)/compilerplugins/obj/compileplugin.so -Xclang -add-plugin -Xclang loplugin
+ifeq ($(COMPILER_PLUGIN_TOOL),)
+gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(SRCDIR)/compilerplugins/obj/plugin.so -Xclang -add-plugin -Xclang loplugin
+else
+gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(SRCDIR)/compilerplugins/obj/plugin.so -Xclang -plugin -Xclang loplugin -Xclang -plugin-arg-loplugin -Xclang $(COMPILER_PLUGIN_TOOL)
+endif
gb_COMPILER_PLUGINS_SETUP := ICECC_EXTRAFILES=$(SRCDIR)/sal/inc/sal/log-areas.dox
else
gb_COMPILER_PLUGINS :=