compilerplugins/README.md                             |   11 ++
 compilerplugins/clang/changetoolsgen.cxx              |    4 -
 compilerplugins/clang/constantparam.cxx               |    2 
 compilerplugins/clang/constfields.cxx                 |    4 -
 compilerplugins/clang/countusersofdefaultparams.cxx   |    2 
 compilerplugins/clang/finalclasses.cxx                |    2 
 compilerplugins/clang/inlinefields.cxx                |    4 -
 compilerplugins/clang/mergeclasses.cxx                |    2 
 compilerplugins/clang/methodcycles.cxx                |    2 
 compilerplugins/clang/singlevalfields.cxx             |    2 
 compilerplugins/clang/store/paintmethodconversion.cxx |    2 
 compilerplugins/clang/unnecessaryvirtual.cxx          |    4 -
 compilerplugins/clang/unusedenumconstants.cxx         |    2 
 compilerplugins/clang/unusedfields.cxx                |    4 -
 compilerplugins/clang/unusedmethods.cxx               |    4 -
 compilerplugins/clang/virtualdead.cxx                 |    4 -
 compilerplugins/clang/virtualdown.cxx                 |    2 
 solenv/gbuild/LinkTarget.mk                           |   72 ++++++++++++------
 solenv/gbuild/Module.mk                               |    5 +
 19 files changed, 84 insertions(+), 50 deletions(-)

New commits:
commit 8d8d25f5ddbe42fc5a3647ff0ad31e93311b9ed5
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Fri Sep 17 14:19:47 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Sat Sep 18 19:24:46 2021 +0200

    make FORCE_COMPILE_ALL more flexible than all or nothing
    
    Rename it to FORCE_COMPILE and it takes the --enable-symbols
    specification of what to include, for example
    FORCE_COMPILE="all -sw/ -Library_sc".
    
    Change-Id: I92afd8e0abc75d3566285c197d6640c26c03db36
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122248
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/compilerplugins/README.md b/compilerplugins/README.md
index 9dbea95a56c7..8f8a51bd6f02 100644
--- a/compilerplugins/README.md
+++ b/compilerplugins/README.md
@@ -34,8 +34,13 @@ Rewriters analyse and possibly modify given source files.
 Usage: `make COMPILER_PLUGIN_TOOL=<rewriter_name>`
 Additional optional make arguments:
 
-- it is possible to also pass `FORCE_COMPILE_ALL=1` to make to trigger rebuild 
of all source files,
-    even those that are up to date.
+- it is possible to also pass `FORCE_COMPILE=all` to make to trigger rebuild 
of all source files,
+    even those that are up to date. FORCE_COMPILE takes a list of gbuild 
targets specifying
+    where to run the rewriter ('all' means everything, '-' prepended means to 
not enable, '/' appended means
+    everything in the directory; there is no ordering, more specific overrides
+    more general, and disabling takes precedence).
+    Example: FORCE_COMPILE="all -sw/ -Library_sc"
+
 - `UPDATE_FILES=<scope>` - limits which modified files will be actually 
written back with the changes
     - `mainfile` - only the main `.cxx` file will be modified (default)
     - `all` - all source files involved will be modified (possibly even header 
files from other LO modules),
@@ -54,7 +59,7 @@ all non-rewriter plugins; and all non--dual-mode plugins are 
disabled).  The
 typical process to use such a dual-mode rewriter X in rewriting mode is
 
     make COMPILER_PLUGIN_WARNINGS_ONLY=X \
-    && make COMPILER_PLUGIN_TOOL=X FORCE_COMPILE_ALL=1 UPDATE_FILES=all
+    && make COMPILER_PLUGIN_TOOL=X FORCE_COMPILE=all UPDATE_FILES=all
 
 which first generates a full build without failing due to warnings from plugin
 X in non-rewriting mode (in case of `--enable-werror`) and then repeats the 
build
diff --git a/compilerplugins/clang/changetoolsgen.cxx 
b/compilerplugins/clang/changetoolsgen.cxx
index b5eda7dbb826..a8e9faf74014 100644
--- a/compilerplugins/clang/changetoolsgen.cxx
+++ b/compilerplugins/clang/changetoolsgen.cxx
@@ -17,9 +17,9 @@
  * Changes calls to tools::Rectangle/Point/Size methods that return a ref to 
instead call the setter methods.
  *
  * run as:
- *   make COMPILER_PLUGIN_TOOL=changetoolsgen UPDATE_FILES=all 
FORCE_COMPILE_ALL=1
+ *   make COMPILER_PLUGIN_TOOL=changetoolsgen UPDATE_FILES=all 
FORCE_COMPILE=all
  * or
- *   make <module> COMPILER_PLUGIN_TOOL=changetoolsgen FORCE_COMPILE_ALL=1
+ *   make <module> COMPILER_PLUGIN_TOOL=changetoolsgen FORCE_COMPILE=all
  */
 
 namespace
diff --git a/compilerplugins/clang/constantparam.cxx 
b/compilerplugins/clang/constantparam.cxx
index 7cebb1b67efb..b176309539a4 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.cxx
@@ -22,7 +22,7 @@
 
  The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='constantparam' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='constantparam' check
   $ ./compilerplugins/clang/constantparam.py
 
   TODO look for OUString and OString params and check for call-params that are 
always either "" or default constructed
diff --git a/compilerplugins/clang/constfields.cxx 
b/compilerplugins/clang/constfields.cxx
index 635774810717..1833fd056d6c 100644
--- a/compilerplugins/clang/constfields.cxx
+++ b/compilerplugins/clang/constfields.cxx
@@ -34,11 +34,11 @@ Look for fields that are only assigned to in the 
constructor using field-init, a
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='constfields' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='constfields' check
   $ ./compilerplugins/clang/constfields.py
 
 and then
-  $ for dir in *; do make $dir FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='constfieldsrewrite' $dir; done
+  $ for dir in *; do make $dir FORCE_COMPILE=all UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='constfieldsrewrite' $dir; done
 to auto-remove the method declarations
 
 */
diff --git a/compilerplugins/clang/countusersofdefaultparams.cxx 
b/compilerplugins/clang/countusersofdefaultparams.cxx
index 0f689058197a..073c58e104f7 100644
--- a/compilerplugins/clang/countusersofdefaultparams.cxx
+++ b/compilerplugins/clang/countusersofdefaultparams.cxx
@@ -22,7 +22,7 @@
 
   The process goes something like this:
     $ make check
-    $ make FORCE_COMPILE_ALL=1 
COMPILER_PLUGIN_TOOL='countusersofdefaultparams' check
+    $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='countusersofdefaultparams' 
check
     $ ./compilerplugins/clang/countusersofdefaultparams.py
 */
 
diff --git a/compilerplugins/clang/finalclasses.cxx 
b/compilerplugins/clang/finalclasses.cxx
index ff7b34925630..447e3406e5e6 100644
--- a/compilerplugins/clang/finalclasses.cxx
+++ b/compilerplugins/clang/finalclasses.cxx
@@ -26,7 +26,7 @@ some method calls
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='finalclasses' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='finalclasses' check
   $ ./compilerplugins/clang/finalclasses.py
 
 */
diff --git a/compilerplugins/clang/inlinefields.cxx 
b/compilerplugins/clang/inlinefields.cxx
index abc665de6959..1573e8d5217b 100644
--- a/compilerplugins/clang/inlinefields.cxx
+++ b/compilerplugins/clang/inlinefields.cxx
@@ -28,11 +28,11 @@ Be warned that it produces around 5G of log file.
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='inlinefields' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='inlinefields' check
   $ ./compilerplugins/clang/inlinefields.py
 
 and then
-  $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='inlinefieldsremove' $dir; done
+  $ for dir in *; do make FORCE_COMPILE=all UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='inlinefieldsremove' $dir; done
 to auto-remove the method declarations
 
 Note that the actual process may involve a fair amount of undoing, hand 
editing, and general messing around
diff --git a/compilerplugins/clang/mergeclasses.cxx 
b/compilerplugins/clang/mergeclasses.cxx
index 0f0d73d709c2..017f66680ffb 100644
--- a/compilerplugins/clang/mergeclasses.cxx
+++ b/compilerplugins/clang/mergeclasses.cxx
@@ -32,7 +32,7 @@ Then
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='mergeclasses' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='mergeclasses' check
   $ ./compilerplugins/clang/mergeclasses.py
 
 FIXME exclude 'static-only' classes, which some people may use/have used 
instead of a namespace to tie together a bunch of functions
diff --git a/compilerplugins/clang/methodcycles.cxx 
b/compilerplugins/clang/methodcycles.cxx
index 7fd74b10d9ea..d495f425ba6b 100644
--- a/compilerplugins/clang/methodcycles.cxx
+++ b/compilerplugins/clang/methodcycles.cxx
@@ -35,7 +35,7 @@ Then we will post-process the log file with a python script, 
which takes about
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='methodcycles' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='methodcycles' check
   $ ./compilerplugins/clang/methodcycles.py
 
 Note that the actual process may involve a fair amount of undoing, hand 
editing, and general messing around
diff --git a/compilerplugins/clang/singlevalfields.cxx 
b/compilerplugins/clang/singlevalfields.cxx
index 228e7ddcb211..3f5b00a7c66b 100644
--- a/compilerplugins/clang/singlevalfields.cxx
+++ b/compilerplugins/clang/singlevalfields.cxx
@@ -32,7 +32,7 @@ Be warned that it produces around 5G of log file.
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='singlevalfields' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='singlevalfields' check
   $ ./compilerplugins/clang/singlevalfields.py
 
 Note that the actual process may involve a fair amount of undoing, hand 
editing, and general messing around
diff --git a/compilerplugins/clang/store/paintmethodconversion.cxx 
b/compilerplugins/clang/store/paintmethodconversion.cxx
index f8c63d4b98ce..7a394ae25382 100644
--- a/compilerplugins/clang/store/paintmethodconversion.cxx
+++ b/compilerplugins/clang/store/paintmethodconversion.cxx
@@ -16,7 +16,7 @@
 /**
  * Rewrites all Paint method on subclasses of vcl::Window to include 
RenderContext& as parameter.
  *
- * run as: make COMPILER_PLUGIN_TOOL=paintmethodconversion UPDATE_FILES=all 
FORCE_COMPILE_ALL=1
+ * run as: make COMPILER_PLUGIN_TOOL=paintmethodconversion UPDATE_FILES=all 
FORCE_COMPILE=all
  */
 
 namespace
diff --git a/compilerplugins/clang/unnecessaryvirtual.cxx 
b/compilerplugins/clang/unnecessaryvirtual.cxx
index 7556217f29ce..9f3a3eecf444 100644
--- a/compilerplugins/clang/unnecessaryvirtual.cxx
+++ b/compilerplugins/clang/unnecessaryvirtual.cxx
@@ -24,9 +24,9 @@ that no longer has a purpose.
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unnecessaryvirtual' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='unnecessaryvirtual' check
   $ ./compilerplugins/clang/unnecessaryvirtual.py
-  $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='removevirtuals' $dir; done
+  $ for dir in *; do make FORCE_COMPILE=all UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='removevirtuals' $dir; done
 
 Note that the actual process may involve a fair amount of undoing, hand 
editing, and general messing around
 to get it to work :-)
diff --git a/compilerplugins/clang/unusedenumconstants.cxx 
b/compilerplugins/clang/unusedenumconstants.cxx
index 4ae1f52f2713..0c56314af888 100644
--- a/compilerplugins/clang/unusedenumconstants.cxx
+++ b/compilerplugins/clang/unusedenumconstants.cxx
@@ -29,7 +29,7 @@ Be warned that it produces around 5G of log file.
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unusedenumconstants' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='unusedenumconstants' check
   $ ./compilerplugins/clang/unusedenumconstants.py
 
 Note that the actual process may involve a fair amount of undoing, hand 
editing, and general messing around
diff --git a/compilerplugins/clang/unusedfields.cxx 
b/compilerplugins/clang/unusedfields.cxx
index 0c2bdbc77410..ca4dca108dd6 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -41,11 +41,11 @@ Be warned that it produces around 5G of log file.
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unusedfields' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='unusedfields' check
   $ ./compilerplugins/clang/unusedfields.py
 
 and then
-  $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='unusedfieldsremove' $dir; done
+  $ for dir in *; do make FORCE_COMPILE=all UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='unusedfieldsremove' $dir; done
 to auto-remove the method declarations
 
 Note that the actual process may involve a fair amount of undoing, hand 
editing, and general messing around
diff --git a/compilerplugins/clang/unusedmethods.cxx 
b/compilerplugins/clang/unusedmethods.cxx
index 5d39020ad538..ccad7e3375d7 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -33,11 +33,11 @@ Be warned that it produces around 15G of log file.
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unusedmethods' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='unusedmethods' check
   $ ./compilerplugins/clang/unusedmethods.py
 
 and then
-  $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='unusedmethodsremove' $dir; done
+  $ for dir in *; do make FORCE_COMPILE=all UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='unusedmethodsremove' $dir; done
 to auto-remove the method declarations
 
 Note that the actual process may involve a fair amount of undoing, hand 
editing, and general messing around
diff --git a/compilerplugins/clang/virtualdead.cxx 
b/compilerplugins/clang/virtualdead.cxx
index 210a3e2f778f..53df3533b537 100644
--- a/compilerplugins/clang/virtualdead.cxx
+++ b/compilerplugins/clang/virtualdead.cxx
@@ -24,9 +24,9 @@ Look for virtual methods where all of the overrides either
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='VirtualDead' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='VirtualDead' check
   $ ./compilerplugins/clang/VirtualDead.py
-  $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='removevirtuals' $dir; done
+  $ for dir in *; do make FORCE_COMPILE=all UPDATE_FILES=$dir 
COMPILER_PLUGIN_TOOL='removevirtuals' $dir; done
 
 Note that the actual process may involve a fair amount of undoing, hand 
editing, and general messing around
 to get it to work :-)
diff --git a/compilerplugins/clang/virtualdown.cxx 
b/compilerplugins/clang/virtualdown.cxx
index ff5fc373a1dd..96984b19dcfd 100644
--- a/compilerplugins/clang/virtualdown.cxx
+++ b/compilerplugins/clang/virtualdown.cxx
@@ -20,7 +20,7 @@ methods, which indicates a places where the virtual-ness is 
unwarranted, normall
 
 The process goes something like this:
   $ make check
-  $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='VirtualDown' check
+  $ make FORCE_COMPILE=all COMPILER_PLUGIN_TOOL='VirtualDown' check
   $ ./compilerplugins/clang/VirtualDown.py
 
 @TODO for some reason, we get false+ for operator== methods
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index f7ecface2b89..1daf32174128 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -220,22 +220,45 @@ endef
 # dep file as a side effect.
 # In the dep file rule just touch it so it's newer than the object.
 
-ifneq ($(FORCE_COMPILE_ALL),)
+# Setting FORCE_COMPILE allows forcing compilation for specific sources,
+# usually used to force running a tool on the sources (see 
compilerplugins/README).
+# If set, it'll force all considered sources for rebuild. But it's possible
+# to explicitly specify gbuild build targets where running of the tool will be 
skipped
+# (where 'all' means everything, '-' prepended means to not enable, '/' 
appended means
+# everything in the directory; there is no ordering, more specific overrides
+# more general, and disabling takes precedence).
+# Example: FORCE_COMPILE="all -sw/ -Library_sc"
+
+# Detect whether forced compile should be used for the given gbuild target.
+# enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
+# call gb_LinkTarget__force_compile,linktargetmakefilename
+gb_LinkTarget__force_compile = \
+ $(and $(if $(filter -$(1),$(FORCE_COMPILE)),,$(true)),\
+       $(or $(gb_Module_CURRENTMODULE_FORCE_COMPILE),\
+            $(filter $(1),$(FORCE_COMPILE))))
+
 # This one only exists to force .c/.cxx "rebuilds" when running a compiler 
tool.
-.PHONY: force_compile_all_target
-force_compile_all_target:
-gb_FORCE_COMPILE_ALL_TARGET := force_compile_all_target
+.PHONY: force_compile_target
+force_compile_target:
+ifneq ($(FORCE_COMPILE),)
+gb_FORCE_COMPILE_TARGET := force_compile_target
 endif
 
+# A tool is run either if FORCE_COMPILE is not set (in that case it's always 
run,
+# because the target is not up to date), or if FORCE_COMPILE is set then
+# the tool is run only if the value of FORCE_COMPILE includes the target.
+gb_LinkTarget__tool_compile_enabled = \
+ $(if $(FORCE_COMPILE),$(T_FORCE_COMPILE),$(true))
+
 # CObject class
 
 gb_CObject_get_source = $(1)/$(2).c
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%) 
$(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%) 
$(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$*.c,$(true),C  ,3)
        $(call gb_Trace_StartRange,$*.c,C  )
-       $(call gb_CObject__tool_command,$*,$<,$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_CObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$*.c,C  )
 else
 $(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%)
@@ -294,10 +317,10 @@ endif
 endef
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_CxxObject_get_target,%) : $(call 
gb_CxxObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_CxxObject_get_target,%) : $(call 
gb_CxxObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$*.cxx,$(true),CXX,3)
        $(call gb_Trace_StartRange,$*.cxx,CXX)
-       $(call gb_CxxObject__tool_command,$*,$<,$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_CxxObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$*.cxx,CXX)
 else
 $(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%)
@@ -326,11 +349,11 @@ endif
 gb_GenCObject_get_source = $(WORKDIR)/$(1).c
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_GenCObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_GenCObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$*.c,$(true),C  ,3)
        $(call gb_Trace_StartRange,$*.c,C  )
        test -f $(call gb_GenCObject_get_source,$*) || (echo "Missing generated 
source file $(call gb_GenCObject_get_source,$*)" && false)
-       $(call gb_CObject__tool_command,$*,$(call 
gb_GenCObject_get_source,$*),$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_CObject__tool_command,$*,$(call 
gb_GenCObject_get_source,$*),$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$*.c,C  )
 else
 $(call gb_GenCObject_get_target,%) :
@@ -359,11 +382,11 @@ endif
 gb_GenCxxObject_get_source = $(WORKDIR)/$(1).$(gb_LinkTarget_CXX_SUFFIX_$(call 
gb_LinkTarget__get_workdir_linktargetname,$(2)))
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_GenCxxObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_GenCxxObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$(subst 
$(BUILDDIR)/,,$(GEN_CXX_SOURCE)),$(true),CXX,3)
        $(call gb_Trace_StartRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
        test -f $(GEN_CXX_SOURCE) || (echo "Missing generated source file 
$(GEN_CXX_SOURCE)" && false)
-       $(call 
gb_CxxObject__tool_command,$*,$(GEN_CXX_SOURCE),$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_CxxObject__tool_command,$*,$(GEN_CXX_SOURCE),$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
 else
 $(call gb_GenCxxObject_get_target,%) :
@@ -393,11 +416,11 @@ endif
 gb_GenCxxClrObject_get_source = 
$(WORKDIR)/$(1).$(gb_LinkTarget_CXX_SUFFIX_$(call 
gb_LinkTarget__get_workdir_linktargetname,$(2)))
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_GenCxxClrObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_GenCxxClrObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$(subst 
$(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),$(true),CLR,3)
        $(call gb_Trace_StartRange,$(subst 
$(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),CLR)
        test -f $(GEN_CXXCLR_SOURCE) || (echo "Missing generated source file 
$(GEN_CXXCLR_SOURCE)" && false)
-       $(call 
gb_CxxClrObject__tool_command,$*,$(GEN_CXXCLR_SOURCE),$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_CxxClrObject__tool_command,$*,$(GEN_CXXCLR_SOURCE),$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$(subst 
$(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),CLR)
 else
 $(call gb_GenCxxClrObject_get_target,%) :
@@ -485,10 +508,10 @@ endef
 gb_ObjCxxObject_get_source = $(1)/$(2).mm
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_ObjCxxObject_get_target,%) : $(call 
gb_ObjCxxObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_ObjCxxObject_get_target,%) : $(call 
gb_ObjCxxObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$*.mm,$(true),OCX,3)
        $(call gb_Trace_StartRange,$*.mm,OCX)
-       $(call gb_ObjCxxObject__tool_command,$*,$<,$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_ObjCxxObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$*.mm,OCX)
 else
 $(call gb_ObjCxxObject_get_target,%) : $(call 
gb_ObjCxxObject_get_source,$(SRCDIR),%)
@@ -517,10 +540,10 @@ endif
 gb_ObjCObject_get_source = $(1)/$(2).m
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_ObjCObject_get_target,%) : $(call 
gb_ObjCObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_ObjCObject_get_target,%) : $(call 
gb_ObjCObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$*.m,$(true),OCC,3)
        $(call gb_Trace_StartRange,$*.m,OCC)
-       $(call gb_ObjCObject__tool_command,$*,$<,$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_ObjCObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$*.m,OCC)
 else
 $(call gb_ObjCObject_get_target,%) : $(call 
gb_ObjCObject_get_source,$(SRCDIR),%)
@@ -548,11 +571,11 @@ endif
 gb_GenObjCObject_get_source = $(WORKDIR)/$(1).m
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_GenObjCObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_GenObjCObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$*.m,$(true),OCC,3)
        $(call gb_Trace_StartRange,$*.m,OCC)
        test -f $(call gb_GenObjCObject_get_source,$*) || (echo "Missing 
generated source file $(call gb_GenObjCObject_get_source,$*)" && false)
-       $(call gb_ObjCObject__tool_command,$*,$(call 
gb_GenObjCObject_get_source,$*),$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_ObjCObject__tool_command,$*,$(call 
gb_GenObjCObject_get_source,$*),$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$*.m,OCC)
 else
 $(call gb_GenObjCObject_get_target,%) :
@@ -581,11 +604,11 @@ endif
 gb_GenObjCxxObject_get_source = $(WORKDIR)/$(1).mm
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_GenObjCxxObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_GenObjCxxObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$*.mm,$(true),OCX,3)
        $(call gb_Trace_StartRange,$*.mm,OCX)
        test -f $(call gb_GenObjCxxObject_get_source,$*) || (echo "Missing 
generated source file $(call gb_GenObjCxxObject_get_source,$*)" && false)
-       $(call gb_ObjCxxObject__tool_command,$*,$(call 
gb_GenObjCxxObject_get_source,$*),$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_ObjCxxObject__tool_command,$*,$(call 
gb_GenObjCxxObject_get_source,$*),$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$*.mm,OCX)
 else
 $(call gb_GenObjCxxObject_get_target,%) :
@@ -615,10 +638,10 @@ endif
 gb_CxxClrObject_get_source = $(1)/$(2).cxx
 
 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
-$(call gb_CxxClrObject_get_target,%) : $(call 
gb_CxxClrObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
+$(call gb_CxxClrObject_get_target,%) : $(call 
gb_CxxClrObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
        $(call gb_Output_announce,$*.cxx,$(true),CLR,3)
        $(call gb_Trace_StartRange,$*.cxx,CLR)
-       $(call gb_CxxClrObject__tool_command,$*,$<,$(COMPILER_PLUGINS))
+       $(if $(call gb_LinkTarget__tool_compile_enabled),$(call 
gb_CxxClrObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
        $(call gb_Trace_EndRange,$*.cxx,CLR)
 else
 $(call gb_CxxClrObject_get_target,%) : $(call 
gb_CxxClrObject_get_source,$(SRCDIR),%)
@@ -944,6 +967,7 @@ $(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE :=
 $(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT :=
 $(call gb_LinkTarget_get_target,$(1)) : COMPILER_TEST :=
 $(call gb_LinkTarget_get_target,$(1)) : T_SYMBOLS := $(if $(call 
gb_LinkTarget__symbols_enabled,$(2)),$(true),$(false))
+$(call gb_LinkTarget_get_target,$(1)) : T_FORCE_COMPILE := $(if $(call 
gb_LinkTarget__force_compile,$(2)),$(true),$(false))
 $(call gb_LinkTarget_get_target,$(1)) : T_CC :=
 $(call gb_LinkTarget_get_target,$(1)) : T_CXX :=
 $(call gb_LinkTarget_get_target,$(1)) : T_USE_LD := $(USE_LD)
diff --git a/solenv/gbuild/Module.mk b/solenv/gbuild/Module.mk
index 2ed303b33284..9eddc41683a4 100644
--- a/solenv/gbuild/Module.mk
+++ b/solenv/gbuild/Module.mk
@@ -252,6 +252,10 @@ $(WORKDIR)/pot.done : $(foreach exec,cfgex helpex localize 
propex ulfex xrmex tr
 gb_Module__symbols_enabled = \
  $(and $(if $(filter -$(1)/,$(gb_ENABLE_SYMBOLS_FOR)),,$(true)),\
        $(filter all $(1)/,$(gb_ENABLE_SYMBOLS_FOR)))
+# enable if: no "-MODULE/" defined AND ["all" defined OR "MODULE/" defined]
+gb_Module__force_compile = \
+ $(and $(if $(filter -$(1)/,$(FORCE_COMPILE)),,$(true)),\
+       $(filter all $(1)/,$(FORCE_COMPILE)))
 
 define gb_Module_Module
 gb_Module_ALLMODULES += $(1)
@@ -267,6 +271,7 @@ gb_Module_STAGINGCHECKTARGETSTACK := $(call 
gb_Module_get_stagingcheck_target,$(
 gb_Module_PERFCHECKTARGETSTACK := $(call gb_Module_get_perfcheck_target,$(1)) 
$(gb_Module_PERFCHECKTARGETSTACK)
 gb_Module_CLEANTARGETSTACK := $(call gb_Module_get_clean_target,$(1)) 
$(gb_Module_CLEANTARGETSTACK)
 gb_Module_CURRENTMODULE_SYMBOLS_ENABLED := $(call 
gb_Module__symbols_enabled,$(1))
+gb_Module_CURRENTMODULE_FORCE_COMPILE := $(call gb_Module__force_compile,$(1))
 gb_Module_CURRENTMODULE_NAME := $(1)
 $(call gb_Helper_make_userfriendly_targets,$(1),Module)
 $(if $(filter-out libreoffice instsetoo_native android ios,$(1)),\

Reply via email to