SetupJavaCompilers.gmk revision 2212:8b1d348ad6a2
1321369Sdim# 2254721Semaste# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. 3353358Sdim# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4353358Sdim# 5353358Sdim# This code is free software; you can redistribute it and/or modify it 6254721Semaste# under the terms of the GNU General Public License version 2 only, as 7254721Semaste# published by the Free Software Foundation. Oracle designates this 8254721Semaste# particular file as subject to the "Classpath" exception as provided 9254721Semaste# by Oracle in the LICENSE file that accompanied this code. 10353358Sdim# 11353358Sdim# This code is distributed in the hope that it will be useful, but WITHOUT 12254721Semaste# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13321369Sdim# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14254721Semaste# version 2 for more details (a copy is included in the LICENSE file that 15321369Sdim# accompanied this code). 16254721Semaste# 17254721Semaste# You should have received a copy of the GNU General Public License version 18254721Semaste# 2 along with this work; if not, write to the Free Software Foundation, 19254721Semaste# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20254721Semaste# 21254721Semaste# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22353358Sdim# or visit www.oracle.com if you need additional information or have any 23353358Sdim# questions. 24353358Sdim# 25254721Semaste 26353358Sdimifndef _SETUP_GMK 27353358Sdim_SETUP_GMK := 1 28353358Sdim 29353358Sdiminclude JavaCompilation.gmk 30254721Semaste 31254721SemasteDISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally 32314564Sdim 33353358Sdim# If warnings needs to be non-fatal for testing purposes use a command like: 34314564Sdim# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" 35360784SdimJAVAC_WARNINGS := -Xlint:all -Werror 36254721Semaste 37254721Semaste# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools 38314564Sdim# and the interim javac, to be run by the boot jdk. 39353358Sdim$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \ 40353358Sdim JAVAC := $(JAVAC), \ 41353358Sdim FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true -g \ 42353358Sdim -Xlint:all$(COMMA)-deprecation$(COMMA)-options -Werror, \ 43353358Sdim DISABLE_SJAVAC := true, \ 44353358Sdim)) 45353358Sdim 46254721Semaste# Any java code executed during a JDK build to build other parts of the JDK must be 47254721Semaste# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 48314564Sdim# purpose must be built with -target PREVIOUS for bootstrapping purposes, which 49314564Sdim# requires restricting to language level and api of previous JDK. 50314564Sdim# 51254721Semaste# The generate old bytecode javac setup uses the new compiler to compile for the 52254721Semaste# boot jdk to generate tools that need to be run with the boot jdk. 53314564Sdim# Thus we force the target bytecode to the previous JDK version. 54314564Sdim# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since 55314564Sdim# it's running on the boot jdk, the default bootclasspath is correct. 56353358Sdim$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \ 57353358Sdim JVM := $(JAVA_SMALL), \ 58254721Semaste JAVAC := $(NEW_JAVAC), \ 59353358Sdim FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true -XDstringConcat=inline \ 60353358Sdim $(DISABLE_WARNINGS) -Xlint:-options, \ 61254721Semaste SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 62353358Sdim SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 63353358Sdim 64353358Sdim# The generate new bytecode javac setup uses the new compiler to compile for the 65314564Sdim# new jdk. This new bytecode might only be possible to run using the new jvm. 66353358Sdim$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \ 67353358Sdim JVM := $(JAVA_JAVAC), \ 68254721Semaste JAVAC := $(NEW_JAVAC), \ 69353358Sdim FLAGS := -source 9 -target 9 \ 70314564Sdim -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \ 71353358Sdim SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 72353358Sdim SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 73254721Semaste 74254721Semaste# The generate new bytecode javac setup uses the new compiler to compile for the 75353358Sdim# new jdk. This new bytecode might only be possible to run using the new jvm. 76254721Semaste$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \ 77254721Semaste JVM := $(JAVA_JAVAC), \ 78314564Sdim JAVAC := $(NEW_JAVAC), \ 79353358Sdim FLAGS := -source 9 -target 9 \ 80254721Semaste -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \ 81353358Sdim SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 82314564Sdim SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 83353358Sdim 84353358Sdim# After the jdk is built, we want to build demos using only the recently 85276479Sdim# generated jdk classes and nothing else, no jdk source, etc etc. 86276479Sdim# I.e. the rt.jar, but since rt.jar has not yet been generated 87314564Sdim# (it will be in "make images") therefore we use classes instead. 88314564Sdim$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \ 89276479Sdim JVM := $(JAVA_SMALL), \ 90314564Sdim JAVAC := $(NEW_JAVAC), \ 91353358Sdim FLAGS := --upgrade-module-path $(JDK_OUTPUTDIR)/modules -system none $(DISABLE_WARNINGS), \ 92353358Sdim SERVER_DIR := $(SJAVAC_SERVER_DIR), \ 93353358Sdim SERVER_JVM := $(SJAVAC_SERVER_JAVA))) 94353358Sdim 95314564Sdimendif # _SETUP_GMK 96254721Semaste