blob: 82cbb4343569342e4424a8f26a067c8a06a454dc [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Selects a Java compiler.
2#
3# Inputs:
Primiano Tucci994c84f2014-06-02 17:37:38 +01004# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
The Android Open Source Project88b60792009-03-03 19:28:42 -08005# default
Brian Carlstromb6dcef82014-01-09 15:33:06 -08006# ALTERNATE_JAVAC -- the alternate java compiler to use
The Android Open Source Project88b60792009-03-03 19:28:42 -08007#
8# Outputs:
9# COMMON_JAVAC -- Java compiler command with common arguments
Ying Wangad690992013-09-20 17:11:43 -070010#
11
Yohann Roussela96cc592015-01-05 16:10:59 +010012ifndef ANDROID_COMPILE_WITH_JACK
13# Defines if compilation with jack is enabled by default.
14ANDROID_COMPILE_WITH_JACK := true
15endif
16
Nick Reuterc43ab6e2014-05-08 21:36:05 -050017common_jdk_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
Ying Wangad690992013-09-20 17:11:43 -070018
Brian Carlstromb6dcef82014-01-09 15:33:06 -080019# Use the indexer wrapper to index the codebase instead of the javac compiler
20ifeq ($(ALTERNATE_JAVAC),)
21JAVACC := javac
22else
23JAVACC := $(ALTERNATE_JAVAC)
24endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080025
Primiano Tucci994c84f2014-06-02 17:37:38 +010026# 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
The Android Open Source Project88b60792009-03-03 19:28:42 -080033# Whatever compiler is on this system.
Raphael63c8af92010-06-12 11:36:14 -070034ifeq ($(BUILD_OS), windows)
The Android Open Source Project88b60792009-03-03 19:28:42 -080035 COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
Nick Reuterc43ab6e2014-05-08 21:36:05 -050036 $(common_jdk_flags)
The Android Open Source Project88b60792009-03-03 19:28:42 -080037else
Nick Reuterc43ab6e2014-05-08 21:36:05 -050038 COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
The Android Open Source Project88b60792009-03-03 19:28:42 -080039endif
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
The Android Open Source Project88b60792009-03-03 19:28:42 -080048HOST_JAVAC ?= $(COMMON_JAVAC)
49TARGET_JAVAC ?= $(COMMON_JAVAC)
Brian Carlstromb6dcef82014-01-09 15:33:06 -080050
The Android Open Source Project88b60792009-03-03 19:28:42 -080051#$(info HOST_JAVAC=$(HOST_JAVAC))
52#$(info TARGET_JAVAC=$(TARGET_JAVAC))