javac.mk revision a96cc59ab508c1c803c15f4e5f22ab2415b6ac26
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 := -source 1.7 -target 1.7 -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.
34ifeq ($(BUILD_OS), windows)
35    COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
36        $(common_jdk_flags)
37else
38    COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
39endif
40
41# Eclipse.
42ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
43    COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
44        -maxProblems 9999999 -nowarn
45    $(info CUSTOM_JAVA_COMPILER=eclipse)
46endif
47
48HOST_JAVAC ?= $(COMMON_JAVAC)
49TARGET_JAVAC ?= $(COMMON_JAVAC)
50
51#$(info HOST_JAVAC=$(HOST_JAVAC))
52#$(info TARGET_JAVAC=$(TARGET_JAVAC))
53