blob: 4248af0a035f2e5a42423872c659f96fdb8f1b7e [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Selects a Java compiler.
2#
3# Inputs:
4# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
5# 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
Narayan Kamathc84889b2014-04-01 14:16:26 +010012ifneq ($(LEGACY_USE_JAVA6),)
Nick Reuterc43ab6e2014-05-08 21:36:05 -050013common_jdk_flags := -target 1.5 -Xmaxerrs 9999999
Ying Wangad690992013-09-20 17:11:43 -070014else
Nick Reuterc43ab6e2014-05-08 21:36:05 -050015common_jdk_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
Ying Wangad690992013-09-20 17:11:43 -070016endif
17
Brian Carlstromb6dcef82014-01-09 15:33:06 -080018# Use the indexer wrapper to index the codebase instead of the javac compiler
19ifeq ($(ALTERNATE_JAVAC),)
20JAVACC := javac
21else
22JAVACC := $(ALTERNATE_JAVAC)
23endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080024
25# Whatever compiler is on this system.
Raphael63c8af92010-06-12 11:36:14 -070026ifeq ($(BUILD_OS), windows)
The Android Open Source Project88b60792009-03-03 19:28:42 -080027 COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
Nick Reuterc43ab6e2014-05-08 21:36:05 -050028 $(common_jdk_flags)
The Android Open Source Project88b60792009-03-03 19:28:42 -080029else
Nick Reuterc43ab6e2014-05-08 21:36:05 -050030 COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
The Android Open Source Project88b60792009-03-03 19:28:42 -080031endif
32
33# Eclipse.
34ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
35 COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
36 -maxProblems 9999999 -nowarn
37 $(info CUSTOM_JAVA_COMPILER=eclipse)
38endif
39
The Android Open Source Project88b60792009-03-03 19:28:42 -080040HOST_JAVAC ?= $(COMMON_JAVAC)
41TARGET_JAVAC ?= $(COMMON_JAVAC)
Brian Carlstromb6dcef82014-01-09 15:33:06 -080042
The Android Open Source Project88b60792009-03-03 19:28:42 -080043#$(info HOST_JAVAC=$(HOST_JAVAC))
44#$(info TARGET_JAVAC=$(TARGET_JAVAC))