SetupJavaCompilers.gmk revision 1789:11b31df300ae
138816Sdfr# 248205Sjdp# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. 338816Sdfr# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 438816Sdfr# 538816Sdfr# This code is free software; you can redistribute it and/or modify it 638816Sdfr# under the terms of the GNU General Public License version 2 only, as 738816Sdfr# published by the Free Software Foundation. Oracle designates this 838816Sdfr# particular file as subject to the "Classpath" exception as provided 938816Sdfr# by Oracle in the LICENSE file that accompanied this code. 1038816Sdfr# 1138816Sdfr# This code is distributed in the hope that it will be useful, but WITHOUT 1238816Sdfr# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1338816Sdfr# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1438816Sdfr# version 2 for more details (a copy is included in the LICENSE file that 1538816Sdfr# accompanied this code). 1638816Sdfr# 1738816Sdfr# You should have received a copy of the GNU General Public License version 1838816Sdfr# 2 along with this work; if not, write to the Free Software Foundation, 1938816Sdfr# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2038816Sdfr# 2138816Sdfr# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2238816Sdfr# or visit www.oracle.com if you need additional information or have any 2338816Sdfr# questions. 2438816Sdfr# 2550476Speter 2638816Sdfrifndef _SETUP_GMK 2738816Sdfr_SETUP_GMK := 1 2838816Sdfr 2938816Sdfrinclude JavaCompilation.gmk 3038816Sdfr 3138816SdfrDISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally 3238816Sdfr 3338816Sdfr# If warnings needs to be non-fatal for testing purposes use a command like: 3438816Sdfr# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" 3538816SdfrJAVAC_WARNINGS := -Xlint:all -Werror 36133063Sdfr 3738816Sdfr# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools 3838816Sdfr# and the interim javac, to be run by the boot jdk. 3938816Sdfr$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ 4038816Sdfr JAVAC := $(JAVAC), \ 4138816Sdfr FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror, \ 4238816Sdfr DISABLE_SJAVAC := true, \ 4338816Sdfr)) 4438816Sdfr 4538816Sdfr# Any java code executed during a JDK build to build other parts of the JDK must be 4638816Sdfr# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 4738816Sdfr# purpose must be built with -target PREVIOUS for bootstrapping purposes, which 4838816Sdfr# requires restricting to language level and api of previous JDK. 4938816Sdfr# 50280816Skib# The generate old bytecode javac setup uses the new compiler to compile for the 5138816Sdfr# boot jdk to generate tools that need to be run with the boot jdk. 5238816Sdfr# Thus we force the target bytecode to the previous JDK version. 53115280Speter# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since 5438816Sdfr# it's running on the boot jdk, the default bootclasspath is correct. 5538816Sdfr$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \ 5638816Sdfr JVM := $(JAVA_SMALL), \ 5738816Sdfr JAVAC := $(NEW_JAVAC), \ 5838816Sdfr FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true \ 5938816Sdfr $(DISABLE_WARNINGS) -Xlint:-options, \ 6038816Sdfr SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 6138816Sdfr SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 62115280Speter 63115280Speter# The generate new bytecode javac setup uses the new compiler to compile for the 6438816Sdfr# new jdk. This new bytecode might only be possible to run using the new jvm. 6538816Sdfr$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \ 6638816Sdfr JVM := $(JAVA_JAVAC), \ 67115280Speter JAVAC := $(NEW_JAVAC), \ 68115280Speter FLAGS := -source 9 -target 9 \ 69115280Speter -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \ 7038816Sdfr SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 7138816Sdfr SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 7238816Sdfr 7338816Sdfr# The generate new bytecode javac setup uses the new compiler to compile for the 7438816Sdfr# new jdk. This new bytecode might only be possible to run using the new jvm. 7538816Sdfr$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \ 76216695Skib JVM := $(JAVA_JAVAC), \ 77216695Skib JAVAC := $(NEW_JAVAC), \ 78216695Skib FLAGS := -source 9 -target 9 \ 7938816Sdfr -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \ 80115280Speter SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 81115280Speter SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 8238816Sdfr 8338816SdfrJDK_BOOTCLASSPATH := $(call PathList, \ 84216695Skib $(filter-out $(JDK_OUTPUTDIR)/modules/_%, $(wildcard $(JDK_OUTPUTDIR)/modules/*))) 85216695Skib 86233231Skib# After the jdk is built, we want to build demos using only the recently 8738816Sdfr# generated jdk classes and nothing else, no jdk source, etc etc. 88294373Skib# I.e. the rt.jar, but since rt.jar has not yet been generated 89294373Skib# (it will be in "make images") therefore we use classes instead. 90216695Skib$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \ 91216695Skib JVM := $(JAVA_SMALL), \ 92216695Skib JAVAC := $(NEW_JAVAC), \ 93216695Skib FLAGS := -bootclasspath $(JDK_BOOTCLASSPATH) $(DISABLE_WARNINGS), \ 9438816Sdfr SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 95216695Skib SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 96216695Skib 9738816Sdfrendif # _SETUP_GMK 9838816Sdfr