SetupJavaCompilers.gmk revision 2567:03fe61bb7670
1227825Stheraven# 2227825Stheraven# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 3227825Stheraven# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4227825Stheraven# 5227825Stheraven# This code is free software; you can redistribute it and/or modify it 6227825Stheraven# under the terms of the GNU General Public License version 2 only, as 7227825Stheraven# published by the Free Software Foundation. Oracle designates this 8227825Stheraven# particular file as subject to the "Classpath" exception as provided 9227825Stheraven# by Oracle in the LICENSE file that accompanied this code. 10227825Stheraven# 11227825Stheraven# This code is distributed in the hope that it will be useful, but WITHOUT 12227825Stheraven# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13227825Stheraven# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14227825Stheraven# version 2 for more details (a copy is included in the LICENSE file that 15227825Stheraven# accompanied this code). 16227825Stheraven# 17227825Stheraven# You should have received a copy of the GNU General Public License version 18227825Stheraven# 2 along with this work; if not, write to the Free Software Foundation, 19227825Stheraven# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20227825Stheraven# 21227825Stheraven# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22227825Stheraven# or visit www.oracle.com if you need additional information or have any 23227825Stheraven# questions. 24227825Stheraven# 25227825Stheraven 26227825Stheravenifndef _SETUP_GMK 27227825Stheraven_SETUP_GMK := 1 28227825Stheraven 29227825Stheraveninclude JavaCompilation.gmk 30262801Sdim 31262801SdimDISABLE_WARNINGS := -Xlint:all,-deprecation,-removal,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally 32262801Sdim 33262801Sdim# If warnings needs to be non-fatal for testing purposes use a command like: 34262801Sdim# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" 35262801SdimJAVAC_WARNINGS := -Xlint:all -Werror 36262801Sdim 37262801Sdim# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools 38262801Sdim# and the interim javac, to be run by the boot jdk. 39262801Sdim$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ 40262801Sdim JAVAC := $(JAVAC), \ 41262801Sdim FLAGS := \ 42227825Stheraven $(JAVA_TOOL_FLAGS_SMALL) \ 43227825Stheraven $(BOOT_JDK_SOURCETARGET) \ 44227825Stheraven -XDignore.symbol.file=true -g \ 45227825Stheraven -Xlint:all$(COMMA)-deprecation$(COMMA)-options -Werror, \ 46227825Stheraven DISABLE_SJAVAC := true, \ 47227825Stheraven)) 48227825Stheraven 49227825Stheraven# Any java code executed during a JDK build to build other parts of the JDK must be 50227825Stheraven# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 51227825Stheraven# purpose must be built with -target PREVIOUS for bootstrapping purposes, which 52227825Stheraven# requires restricting to language level and api of previous JDK. 53321222Sdim# 54227825Stheraven# The generate old bytecode javac setup uses the new compiler to compile for the 55321222Sdim# boot jdk to generate tools that need to be run with the boot jdk. 56321222Sdim# Thus we force the target bytecode to the previous JDK version. 57227825Stheraven# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since 58227825Stheraven# it's running on the boot jdk, the default bootclasspath is correct. 59227825Stheraven$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \ 60227825Stheraven JVM := $(JAVA_SMALL), \ 61321222Sdim JAVAC := $(NEW_JAVAC), \ 62227825Stheraven FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true -XDstringConcat=inline \ 63321222Sdim $(DISABLE_WARNINGS) -Xlint:-options, \ 64321222Sdim SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 65227825Stheraven SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 66227825Stheraven 67227825Stheraven# The generate new bytecode javac setup uses the new compiler to compile for the 68227825Stheraven# new jdk. This new bytecode might only be possible to run using the new jvm. 69227825Stheraven$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \ 70227825Stheraven JVM := $(JAVA_JAVAC), \ 71227825Stheraven JAVAC := $(NEW_JAVAC), \ 72227825Stheraven FLAGS := -source 10 -target 10 \ 73227825Stheraven -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \ 74227825Stheraven SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 75227825Stheraven SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 76227825Stheraven 77227825Stheraven# The generate new bytecode javac setup uses the new compiler to compile for the 78227825Stheraven# new jdk. This new bytecode might only be possible to run using the new jvm. 79227825Stheraven$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \ 80227825Stheraven JVM := $(JAVA_JAVAC), \ 81227825Stheraven JAVAC := $(NEW_JAVAC), \ 82227825Stheraven FLAGS := -source 10 -target 10 \ 83227825Stheraven -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \ 84227825Stheraven SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 85227825Stheraven SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 86227825Stheraven 87227825Stheraven# After the jdk is built, we want to build demos using only the recently 88227825Stheraven# generated jdk classes and nothing else, no jdk source, etc etc. 89227825Stheraven# I.e. the rt.jar, but since rt.jar has not yet been generated 90227825Stheraven# (it will be in "make images") therefore we use classes instead. 91227825Stheraven$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \ 92227825Stheraven JVM := $(JAVA_SMALL), \ 93227825Stheraven JAVAC := $(NEW_JAVAC), \ 94227825Stheraven FLAGS := --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none $(DISABLE_WARNINGS), \ 95227825Stheraven SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 96227825Stheraven SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 97227825Stheraven 98227825Stheravenendif # _SETUP_GMK 99227825Stheraven