SetupJavaCompilers.gmk revision 2565:ba5b16c9c6d8
1238438Sdteske# 2238438Sdteske# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 3238438Sdteske# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4263150Sdteske# 5238438Sdteske# This code is free software; you can redistribute it and/or modify it 6238438Sdteske# under the terms of the GNU General Public License version 2 only, as 7238438Sdteske# published by the Free Software Foundation. Oracle designates this 8238438Sdteske# particular file as subject to the "Classpath" exception as provided 9238438Sdteske# by Oracle in the LICENSE file that accompanied this code. 10238438Sdteske# 11238438Sdteske# This code is distributed in the hope that it will be useful, but WITHOUT 12238438Sdteske# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13238438Sdteske# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14238438Sdteske# version 2 for more details (a copy is included in the LICENSE file that 15238438Sdteske# accompanied this code). 16238438Sdteske# 17238438Sdteske# You should have received a copy of the GNU General Public License version 18238438Sdteske# 2 along with this work; if not, write to the Free Software Foundation, 19238438Sdteske# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20238438Sdteske# 21238438Sdteske# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22238438Sdteske# or visit www.oracle.com if you need additional information or have any 23238438Sdteske# questions. 24238438Sdteske# 25238438Sdteske 26238438Sdteskeifndef _SETUP_GMK 27238438Sdteske_SETUP_GMK := 1 28238438Sdteske 29238438Sdteskeinclude JavaCompilation.gmk 30238438Sdteske 31238438SdteskeDISABLE_WARNINGS := -Xlint:all,-deprecation,-removal,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally 32240684Sdteske 33240684Sdteske# If warnings needs to be non-fatal for testing purposes use a command like: 34244675Sdteske# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" 35240684SdteskeJAVAC_WARNINGS := -Xlint:all -Werror 36240684Sdteske 37263150Sdteske# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools 38240684Sdteske# and the interim javac, to be run by the boot jdk. 39238438Sdteske$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ 40240684Sdteske JAVAC := $(JAVAC), \ 41238438Sdteske FLAGS := \ 42238438Sdteske $(JAVA_TOOL_FLAGS_SMALL) \ 43259054Sdteske $(BOOT_JDK_SOURCETARGET) \ 44259054Sdteske -XDignore.symbol.file=true -g \ 45238438Sdteske -Xlint:all$(COMMA)-deprecation$(COMMA)-options -Werror, \ 46238438Sdteske DISABLE_SJAVAC := true, \ 47238438Sdteske)) 48238438Sdteske 49238438Sdteske# Any java code executed during a JDK build to build other parts of the JDK must be 50238438Sdteske# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 51238438Sdteske# purpose must be built with -target PREVIOUS for bootstrapping purposes, which 52238438Sdteske# requires restricting to language level and api of previous JDK. 53238438Sdteske# 54250633Sdteske# The generate old bytecode javac setup uses the new compiler to compile for the 55238438Sdteske# boot jdk to generate tools that need to be run with the boot jdk. 56252178Sdteske# Thus we force the target bytecode to the previous JDK version. 57238438Sdteske# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since 58238438Sdteske# it's running on the boot jdk, the default bootclasspath is correct. 59238438Sdteske$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \ 60238438Sdteske JVM := $(JAVA_SMALL), \ 61238438Sdteske JAVAC := $(NEW_JAVAC), \ 62238438Sdteske FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true -XDstringConcat=inline \ 63238438Sdteske $(DISABLE_WARNINGS) -Xlint:-options, \ 64238438Sdteske SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 65238438Sdteske SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 66238438Sdteske 67238438Sdteske# The generate new bytecode javac setup uses the new compiler to compile for the 68238438Sdteske# new jdk. This new bytecode might only be possible to run using the new jvm. 69263150Sdteske$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \ 70238438Sdteske JVM := $(JAVA_JAVAC), \ 71263150Sdteske JAVAC := $(NEW_JAVAC), \ 72263150Sdteske FLAGS := -source 9 -target 9 \ 73263150Sdteske -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \ 74263150Sdteske SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 75263150Sdteske SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 76263150Sdteske 77263150Sdteske# The generate new bytecode javac setup uses the new compiler to compile for the 78263150Sdteske# new jdk. This new bytecode might only be possible to run using the new jvm. 79263150Sdteske$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \ 80238438Sdteske JVM := $(JAVA_JAVAC), \ 81249751Sdteske JAVAC := $(NEW_JAVAC), \ 82238438Sdteske FLAGS := -source 9 -target 9 \ 83251236Sdteske -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \ 84244550Sdteske SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 85249751Sdteske SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 86238438Sdteske 87256181Sdteske# After the jdk is built, we want to build demos using only the recently 88238438Sdteske# generated jdk classes and nothing else, no jdk source, etc etc. 89252019Sdteske# I.e. the rt.jar, but since rt.jar has not yet been generated 90252019Sdteske# (it will be in "make images") therefore we use classes instead. 91252019Sdteske$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \ 92252019Sdteske JVM := $(JAVA_SMALL), \ 93263150Sdteske JAVAC := $(NEW_JAVAC), \ 94238438Sdteske FLAGS := --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none $(DISABLE_WARNINGS), \ 95238438Sdteske SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 96238438Sdteske SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 97238438Sdteske 98238438Sdteskeendif # _SETUP_GMK 99238438Sdteske