diff options
author | Primiano Tucci <primiano@google.com> | 2014-06-02 17:37:38 +0100 |
---|---|---|
committer | Primiano Tucci <primiano@google.com> | 2014-06-02 20:12:57 +0100 |
commit | 994c84fb40fd74199feb1229e40acb538993c0f2 (patch) | |
tree | 5f25a39ebcd2a82a07b1531ed5c4f2a73122ae65 | |
parent | a8b65126cae5335d4c8b31fbf7700907fd2c48dd (diff) | |
download | build-994c84fb40fd74199feb1229e40acb538993c0f2.tar.gz |
Introduce CC/CXX/JAVAC_WRAPPER to wrap the calls to the compiler.
This is to make it possible to wrap the compiler invocations with
custom wrappers (e.g., distcc/goma) by setting the CC_WRAPPER,
CXX_WRAPPER, JAVAC_WRAPPER variables in the build environment (without
having to know in advance the path to the compiler)
Change-Id: Ide800c24f0c2ebbb1cfb358bd8f99ec8a9d41253
-rw-r--r-- | core/combo/javac.mk | 9 | ||||
-rw-r--r-- | core/combo/select.mk | 21 |
2 files changed, 22 insertions, 8 deletions
diff --git a/core/combo/javac.mk b/core/combo/javac.mk index 4248af0a03..7f91aa9dd6 100644 --- a/core/combo/javac.mk +++ b/core/combo/javac.mk @@ -1,7 +1,7 @@ # Selects a Java compiler. # # Inputs: -# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system +# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system # default # ALTERNATE_JAVAC -- the alternate java compiler to use # @@ -22,6 +22,13 @@ else JAVACC := $(ALTERNATE_JAVAC) endif +# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var. +ifdef JAVAC_WRAPPER + ifneq ($(JAVAC_WRAPPER),$(firstword $(JAVACC))) + JAVACC := $(JAVAC_WRAPPER) $(JAVACC) + endif +endif + # Whatever compiler is on this system. ifeq ($(BUILD_OS), windows) COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \ diff --git a/core/combo/select.mk b/core/combo/select.mk index 8234a8fcb1..98697e0266 100644 --- a/core/combo/select.mk +++ b/core/combo/select.mk @@ -92,13 +92,20 @@ ifneq ($(USE_CCACHE),) # Check that the executable is here. ccache := $(strip $(wildcard $(ccache))) ifdef ccache - # prepend ccache if necessary - ifneq ($(ccache),$(firstword $($(combo_var_prefix)CC))) - $(combo_var_prefix)CC := $(ccache) $($(combo_var_prefix)CC) - endif - ifneq ($(ccache),$(firstword $($(combo_var_prefix)CXX))) - $(combo_var_prefix)CXX := $(ccache) $($(combo_var_prefix)CXX) - endif + CC_WRAPPER ?= $(ccache) + CXX_WRAPPER ?= $(ccache) ccache = endif endif + +# The C/C++ compiler can be wrapped by setting the CC/CXX_WRAPPER vars. +ifdef CC_WRAPPER + ifneq ($(CC_WRAPPER),$(firstword $($(combo_var_prefix)CC))) + $(combo_var_prefix)CC := $(CC_WRAPPER) $($(combo_var_prefix)CC) + endif +endif +ifdef CXX_WRAPPER + ifneq ($(CXX_WRAPPER),$(firstword $($(combo_var_prefix)CXX))) + $(combo_var_prefix)CXX := $(CXX_WRAPPER) $($(combo_var_prefix)CXX) + endif +endif |