blob: fb43ea44e75373d9b1901e1f77ced889be1e14ad [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
Nick Reuterc43ab6e2014-05-08 21:36:05 -050012common_jdk_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
Ying Wangad690992013-09-20 17:11:43 -070013
Brian Carlstromb6dcef82014-01-09 15:33:06 -080014# Use the indexer wrapper to index the codebase instead of the javac compiler
15ifeq ($(ALTERNATE_JAVAC),)
16JAVACC := javac
17else
18JAVACC := $(ALTERNATE_JAVAC)
19endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080020
Primiano Tucci994c84f2014-06-02 17:37:38 +010021# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
22ifdef JAVAC_WRAPPER
23 ifneq ($(JAVAC_WRAPPER),$(firstword $(JAVACC)))
24 JAVACC := $(JAVAC_WRAPPER) $(JAVACC)
25 endif
26endif
27
The Android Open Source Project88b60792009-03-03 19:28:42 -080028# Whatever compiler is on this system.
Raphael63c8af92010-06-12 11:36:14 -070029ifeq ($(BUILD_OS), windows)
The Android Open Source Project88b60792009-03-03 19:28:42 -080030 COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
Nick Reuterc43ab6e2014-05-08 21:36:05 -050031 $(common_jdk_flags)
The Android Open Source Project88b60792009-03-03 19:28:42 -080032else
Nick Reuterc43ab6e2014-05-08 21:36:05 -050033 COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
The Android Open Source Project88b60792009-03-03 19:28:42 -080034endif
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
The Android Open Source Project88b60792009-03-03 19:28:42 -080043HOST_JAVAC ?= $(COMMON_JAVAC)
44TARGET_JAVAC ?= $(COMMON_JAVAC)
Brian Carlstromb6dcef82014-01-09 15:33:06 -080045
The Android Open Source Project88b60792009-03-03 19:28:42 -080046#$(info HOST_JAVAC=$(HOST_JAVAC))
47#$(info TARGET_JAVAC=$(TARGET_JAVAC))