Setup.gmk 3.4 KB
Newer Older
1
#
2
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

26
DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally
27

28
# To build with all warnings enabled, do the following:
29
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
30
JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,classfile,dep-ann,divzero,empty,try,varargs -Werror
31

32 33 34 35 36
# Any java code executed during a JDK build to build other parts of the JDK must be 
# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 
# purpose must be built with -target PREVIOUS for bootstrapping purposes, which 
# requires restricting to language level and api of previous JDK.
#
37 38
# The generate old bytecode javac setup uses the new compiler to compile for the
# boot jdk to generate tools that need to be run with the boot jdk.
39
# Thus we force the target bytecode to the previous JDK version.
40 41 42
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
    JVM := $(JAVA), \
    JAVAC := $(NEW_JAVAC), \
43
    FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
44 45
    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
    SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
46 47 48

# The generate new bytecode javac setup uses the new compiler to compile for the
# new jdk. This new bytecode might only be possible to run using the new jvm.
49 50 51 52 53 54 55 56
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
    JVM := $(JAVA), \
    JAVAC := $(NEW_JAVAC), \
    FLAGS := -bootclasspath $(JDK_OUTPUTDIR)/classes -source 8 -target 8 \
        -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS) \
        $(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
    SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
57 58 59 60 61

# After the jdk is built, we want to build demos using only the recently
# generated jdk classes and nothing else, no jdk source, etc etc.
# I.e. the rt.jar, but since rt.jar has not yet been generated
# (it will be in "make images") therefore we use classes instead.
62 63 64 65 66 67
$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
    JVM := $(JAVA), \
    JAVAC := $(NEW_JAVAC), \
    FLAGS := -bootclasspath $(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS), \
    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
    SERVER_JVM := $(SJAVAC_SERVER_JAVA)))