javac.mk revision 454de52c9651321ad922974737923886e2bb148d
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
12ifneq ($(LEGACY_USE_JAVA6),)
13common_jdk_flags := -target 1.5 -Xmaxerrs 9999999
14else
15common_jdk_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
16endif
17
18# Use the indexer wrapper to index the codebase instead of the javac compiler
19ifeq ($(ALTERNATE_JAVAC),)
20JAVACC := javac
21else
22JAVACC := $(ALTERNATE_JAVAC)
23endif
24
25# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
26ifdef JAVAC_WRAPPER
27    ifneq ($(JAVAC_WRAPPER),$(firstword $(JAVACC)))
28        JAVACC := $(JAVAC_WRAPPER) $(JAVACC)
29    endif
30endif
31
32# Whatever compiler is on this system.
33ifeq ($(BUILD_OS), windows)
34    COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
35        $(common_jdk_flags)
36else
37    COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
38endif
39
40# Eclipse.
41ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
42    COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
43        -maxProblems 9999999 -nowarn
44    $(info CUSTOM_JAVA_COMPILER=eclipse)
45endif
46
47HOST_JAVAC ?= $(COMMON_JAVAC)
48TARGET_JAVAC ?= $(COMMON_JAVAC)
49
50#$(info HOST_JAVAC=$(HOST_JAVAC))
51#$(info TARGET_JAVAC=$(TARGET_JAVAC))
52