1# Selects a Java compiler.
2#
3# Inputs:
4#	CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
5#                           default
6#	ALTERNATE_JAVAC -- the alternate java compiler to use
7#
8# Outputs:
9#   COMMON_JAVAC -- Java compiler command with common arguments
10#
11
12ifndef ANDROID_COMPILE_WITH_JACK
13# Defines if compilation with jack is enabled by default.
14ANDROID_COMPILE_WITH_JACK := true
15endif
16
17common_jdk_flags := -Xmaxerrs 9999999
18
19# Use the indexer wrapper to index the codebase instead of the javac compiler
20ifeq ($(ALTERNATE_JAVAC),)
21JAVACC := javac
22else
23JAVACC := $(ALTERNATE_JAVAC)
24endif
25
26# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
27ifdef JAVAC_WRAPPER
28    ifneq ($(JAVAC_WRAPPER),$(firstword $(JAVACC)))
29        JAVACC := $(JAVAC_WRAPPER) $(JAVACC)
30    endif
31endif
32
33# Whatever compiler is on this system.
34COMMON_JAVAC := $(JAVACC) -J-Xmx2048M $(common_jdk_flags)
35
36# Eclipse.
37ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
38    COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
39        -maxProblems 9999999 -nowarn
40    $(info CUSTOM_JAVA_COMPILER=eclipse)
41endif
42
43GLOBAL_JAVAC_DEBUG_FLAGS := -g
44
45HOST_JAVAC ?= $(COMMON_JAVAC)
46TARGET_JAVAC ?= $(COMMON_JAVAC)
47
48#$(info HOST_JAVAC=$(HOST_JAVAC))
49#$(info TARGET_JAVAC=$(TARGET_JAVAC))
50