GenerateLinkOptData.gmk revision 2493:a4087bc10a88
194742Sobrien#
294742Sobrien# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3146890Speter# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4146890Speter#
5179626Speter# This code is free software; you can redistribute it and/or modify it
6240316Seadler# under the terms of the GNU General Public License version 2 only, as
7146890Speter# published by the Free Software Foundation.  Oracle designates this
8146890Speter# particular file as subject to the "Classpath" exception as provided
9146890Speter# by Oracle in the LICENSE file that accompanied this code.
10146890Speter#
11146890Speter# This code is distributed in the hope that it will be useful, but WITHOUT
12146890Speter# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13146890Speter# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14146890Speter# version 2 for more details (a copy is included in the LICENSE file that
15146890Speter# accompanied this code).
16146890Speter#
17146890Speter# You should have received a copy of the GNU General Public License version
18146890Speter# 2 along with this work; if not, write to the Free Software Foundation,
19146890Speter# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20146890Speter#
2194742Sobrien# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2295253Sru# or visit www.oracle.com if you need additional information or have any
23159014Sjmg# questions.
2496991Srwatson#
2596991Srwatson
2696991Srwatson################################################################################
27102773Srwatson# Generate classlist
28102773Srwatson################################################################################
29156279Srwatson
30156279Srwatsondefault: all
31250778Sadrian
3294917Simpinclude $(SPEC)
33126445Sobrieninclude MakeBase.gmk
34248805Simpinclude JarArchive.gmk
35248805Simp
36146933Simp################################################################################
3794847Sjhb# Create a jar with our generator class. Using a jar is intentional since it
3894847Sjhb# will load more classes
3994847Sjhb
4094915Sken$(eval $(call SetupJarArchive, CLASSLIST_JAR, \
4199607Smjacob    SRCS := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
4294915Sken    INCLUDES := build/tools/classlist, \
4394915Sken    JAR := $(SUPPORT_OUTPUTDIR)/classlist.jar, \
4494915Sken))
4594915Sken
4694915SkenTARGETS += $(CLASSLIST_JAR)
4794915Sken
4894915Sken################################################################################
4994915Sken
50169922SjfvLINK_OPT_DIR := $(SUPPORT_OUTPUTDIR)/link_opt
51219647SdavidchCLASSLIST_FILE := $(LINK_OPT_DIR)/classlist
5297611SbillfJLI_TRACE_FILE := $(LINK_OPT_DIR)/default_jli_trace.txt
5394918Sgshapiro
5494918Sgshapiro# If an external buildjdk has been supplied, we don't build a separate interim
5594918Sgshapiro# image, so just use the external build jdk instead.
5694918Sgshapiroifeq ($(EXTERNAL_BUILDJDK), true)
5794918Sgshapiro  INTERIM_IMAGE_DIR := $(BUILD_JDK)
58106187Sdesendif
59106187Sdes
6095455Sdes$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
6198750Sdes	$(call MakeDir, $(LINK_OPT_DIR))
62205686Sdes	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
63205686Sdes	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $(JLI_TRACE_FILE)))
64205686Sdes	$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@ \
6596268Sgad	    -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \
6696268Sgad	    -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
67250778Sadrian	    build.tools.classlist.HelloClasslist \
6896332Speter	    $(LOG_DEBUG) 2>&1 > $(JLI_TRACE_FILE)
6996332Speter
70100314Sru# The jli trace is created by the same recipe as classlist. By declaring these
71146921Sru# dependencies, make will correctly rebuild both jli trace and classlist
72146921Sru# incrementally using the single recpie above.
7397611Sbillf$(CLASSLIST_FILE): $(JLI_TRACE_FILE)
74190171Srnoland$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
75115825Sfanf
76126445SobrienTARGETS += $(CLASSLIST_FILE) $(JLI_TRACE_FILE)
77117645Sdwmalone
78118204Sbp# Copy the classlist file into java.base libs
79118204Sbp$(eval $(call SetupCopyFiles, COPY_CLASSLIST, \
80263419Sglebius    FILES := $(CLASSLIST_FILE), \
81126445Sobrien    DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
82146837Sobrien))
83146837Sobrien
84146837SobrienTARGETS += $(COPY_CLASSLIST)
85133182Spjd
86148779Spjd# Copy the default_jli_trace.txt file into jdk.jlink
87133182Spjd$(eval $(call SetupCopyFiles, COPY_JLI_TRACE, \
88133182Spjd    FILES := $(JLI_TRACE_FILE), \
89133182Spjd    DEST := $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jlink/internal/plugins, \
90133182Spjd))
91133841Spjd
92143521SpjdTARGETS += $(COPY_JLI_TRACE)
93133182Spjd
94148779Spjd################################################################################
95133182Spjd
96168419Spjdall: $(TARGETS)
97132311Salfred