SetupJavaCompilers.gmk revision 2567:03fe61bb7670
138494Sobrien# 2174294Sobrien# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 338494Sobrien# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 438494Sobrien# 538494Sobrien# This code is free software; you can redistribute it and/or modify it 638494Sobrien# under the terms of the GNU General Public License version 2 only, as 738494Sobrien# published by the Free Software Foundation. Oracle designates this 838494Sobrien# particular file as subject to the "Classpath" exception as provided 938494Sobrien# by Oracle in the LICENSE file that accompanied this code. 1038494Sobrien# 1138494Sobrien# This code is distributed in the hope that it will be useful, but WITHOUT 1238494Sobrien# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1338494Sobrien# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1438494Sobrien# version 2 for more details (a copy is included in the LICENSE file that 1538494Sobrien# accompanied this code). 1638494Sobrien# 1738494Sobrien# You should have received a copy of the GNU General Public License version 1838494Sobrien# 2 along with this work; if not, write to the Free Software Foundation, 1938494Sobrien# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2042629Sobrien# 2138494Sobrien# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2238494Sobrien# or visit www.oracle.com if you need additional information or have any 2338494Sobrien# questions. 2438494Sobrien# 2538494Sobrien 2638494Sobrienifndef _SETUP_GMK 2738494Sobrien_SETUP_GMK := 1 2838494Sobrien 2938494Sobrieninclude JavaCompilation.gmk 3038494Sobrien 3138494SobrienDISABLE_WARNINGS := -Xlint:all,-deprecation,-removal,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally 3238494Sobrien 3338494Sobrien# If warnings needs to be non-fatal for testing purposes use a command like: 3438494Sobrien# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" 3538494SobrienJAVAC_WARNINGS := -Xlint:all -Werror 3638494Sobrien 3738494Sobrien# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools 3838494Sobrien# and the interim javac, to be run by the boot jdk. 3938494Sobrien$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ 40174294Sobrien JAVAC := $(JAVAC), \ 4138494Sobrien FLAGS := \ 4238494Sobrien $(JAVA_TOOL_FLAGS_SMALL) \ 4338494Sobrien $(BOOT_JDK_SOURCETARGET) \ 4438494Sobrien -XDignore.symbol.file=true -g \ 4538494Sobrien -Xlint:all$(COMMA)-deprecation$(COMMA)-options -Werror, \ 4638494Sobrien DISABLE_SJAVAC := true, \ 4738494Sobrien)) 4838494Sobrien 4938494Sobrien# Any java code executed during a JDK build to build other parts of the JDK must be 5038494Sobrien# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 5138494Sobrien# purpose must be built with -target PREVIOUS for bootstrapping purposes, which 5238494Sobrien# requires restricting to language level and api of previous JDK. 5338494Sobrien# 5438494Sobrien# The generate old bytecode javac setup uses the new compiler to compile for the 5538494Sobrien# boot jdk to generate tools that need to be run with the boot jdk. 5638494Sobrien# Thus we force the target bytecode to the previous JDK version. 5738494Sobrien# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since 5838494Sobrien# it's running on the boot jdk, the default bootclasspath is correct. 5938494Sobrien$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \ 6038494Sobrien JVM := $(JAVA_SMALL), \ 6138494Sobrien JAVAC := $(NEW_JAVAC), \ 6238494Sobrien FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true -XDstringConcat=inline \ 6338494Sobrien $(DISABLE_WARNINGS) -Xlint:-options, \ 6438494Sobrien SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 6538494Sobrien SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 6638494Sobrien 6738494Sobrien# The generate new bytecode javac setup uses the new compiler to compile for the 6838494Sobrien# new jdk. This new bytecode might only be possible to run using the new jvm. 6938494Sobrien$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \ 7038494Sobrien JVM := $(JAVA_JAVAC), \ 7138494Sobrien JAVAC := $(NEW_JAVAC), \ 7238494Sobrien FLAGS := -source 10 -target 10 \ 7338494Sobrien -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \ 7438494Sobrien SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 7538494Sobrien SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 7638494Sobrien 7738494Sobrien# The generate new bytecode javac setup uses the new compiler to compile for the 7838494Sobrien# new jdk. This new bytecode might only be possible to run using the new jvm. 7938494Sobrien$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \ 8038494Sobrien JVM := $(JAVA_JAVAC), \ 8138494Sobrien JAVAC := $(NEW_JAVAC), \ 8238494Sobrien FLAGS := -source 10 -target 10 \ 8338494Sobrien -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \ 8438494Sobrien SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 8538494Sobrien SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 8638494Sobrien 8738494Sobrien# After the jdk is built, we want to build demos using only the recently 8838494Sobrien# generated jdk classes and nothing else, no jdk source, etc etc. 8938494Sobrien# I.e. the rt.jar, but since rt.jar has not yet been generated 9038494Sobrien# (it will be in "make images") therefore we use classes instead. 9138494Sobrien$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \ 9238494Sobrien JVM := $(JAVA_SMALL), \ 9342629Sobrien JAVAC := $(NEW_JAVAC), \ 9438494Sobrien FLAGS := --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none $(DISABLE_WARNINGS), \ 9538494Sobrien SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 96174294Sobrien SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 9738494Sobrien 9851292Sobrienendif # _SETUP_GMK 9938494Sobrien