454de52c96
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)
(cherry-picked from AOSP 994c84fb40
)
Change-Id: Ide800c24f0c2ebbb1cfb358bd8f99ec8a9d41253
51 lines
1.4 KiB
Makefile
51 lines
1.4 KiB
Makefile
# Selects a Java compiler.
|
|
#
|
|
# Inputs:
|
|
# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
|
|
# default
|
|
# ALTERNATE_JAVAC -- the alternate java compiler to use
|
|
#
|
|
# Outputs:
|
|
# COMMON_JAVAC -- Java compiler command with common arguments
|
|
#
|
|
|
|
ifneq ($(LEGACY_USE_JAVA6),)
|
|
common_jdk_flags := -target 1.5 -Xmaxerrs 9999999
|
|
else
|
|
common_jdk_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
|
|
endif
|
|
|
|
# Use the indexer wrapper to index the codebase instead of the javac compiler
|
|
ifeq ($(ALTERNATE_JAVAC),)
|
|
JAVACC := javac
|
|
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 \
|
|
$(common_jdk_flags)
|
|
else
|
|
COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
|
|
endif
|
|
|
|
# Eclipse.
|
|
ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
|
|
COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
|
|
-maxProblems 9999999 -nowarn
|
|
$(info CUSTOM_JAVA_COMPILER=eclipse)
|
|
endif
|
|
|
|
HOST_JAVAC ?= $(COMMON_JAVAC)
|
|
TARGET_JAVAC ?= $(COMMON_JAVAC)
|
|
|
|
#$(info HOST_JAVAC=$(HOST_JAVAC))
|
|
#$(info TARGET_JAVAC=$(TARGET_JAVAC))
|