author | darcy |
Tue, 12 Nov 2019 10:45:23 -0800 | |
changeset 59037 | 3d2575331a41 |
parent 58908 | 73bb9c4002cc |
permissions | -rw-r--r-- |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
1 |
# |
58908
73bb9c4002cc
8233381: Update copyright year in build system files
ihse
parents:
55243
diff
changeset
|
2 |
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
4 |
# |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
10 |
# |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
15 |
# accompanied this code). |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
16 |
# |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
20 |
# |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
23 |
# questions. |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
24 |
# |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
25 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
26 |
################################################################################ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
27 |
# Generate classlist |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
28 |
################################################################################ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
29 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
30 |
default: all |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
31 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
32 |
include $(SPEC) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
33 |
include MakeBase.gmk |
52175
c2672a0f233a
8212201: Classlist build tool should be built for the target JDK version
redestad
parents:
49931
diff
changeset
|
34 |
include SetupJavaCompilers.gmk |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
35 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
36 |
################################################################################ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
37 |
# Create a jar with our generator class. Using a jar is intentional since it |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
38 |
# will load more classes |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
39 |
|
52175
c2672a0f233a
8212201: Classlist build tool should be built for the target JDK version
redestad
parents:
49931
diff
changeset
|
40 |
$(eval $(call SetupJavaCompilation, CLASSLIST_JAR, \ |
c2672a0f233a
8212201: Classlist build tool should be built for the target JDK version
redestad
parents:
49931
diff
changeset
|
41 |
SETUP := GENERATE_JDKBYTECODE, \ |
c2672a0f233a
8212201: Classlist build tool should be built for the target JDK version
redestad
parents:
49931
diff
changeset
|
42 |
SRC := $(TOPDIR)/make/jdk/src/classes, \ |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
43 |
INCLUDES := build/tools/classlist, \ |
52175
c2672a0f233a
8212201: Classlist build tool should be built for the target JDK version
redestad
parents:
49931
diff
changeset
|
44 |
BIN := $(BUILDTOOLS_OUTPUTDIR)/classlist_classes, \ |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
45 |
JAR := $(SUPPORT_OUTPUTDIR)/classlist.jar, \ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
46 |
)) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
47 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
48 |
TARGETS += $(CLASSLIST_JAR) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
49 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
50 |
################################################################################ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
51 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
52 |
LINK_OPT_DIR := $(SUPPORT_OUTPUTDIR)/link_opt |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
53 |
CLASSLIST_FILE := $(LINK_OPT_DIR)/classlist |
43783
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
54 |
JLI_TRACE_FILE := $(LINK_OPT_DIR)/default_jli_trace.txt |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
55 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
56 |
# If an external buildjdk has been supplied, we don't build a separate interim |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
57 |
# image, so just use the external build jdk instead. |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
58 |
ifeq ($(EXTERNAL_BUILDJDK), true) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
59 |
INTERIM_IMAGE_DIR := $(BUILD_JDK) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
60 |
endif |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
61 |
|
53589
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
62 |
# Save the stderr output of the command and print it along with stdout in case |
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
63 |
# something goes wrong. |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
64 |
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
65 |
$(call MakeDir, $(LINK_OPT_DIR)) |
47253
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
43917
diff
changeset
|
66 |
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@)) |
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
43917
diff
changeset
|
67 |
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE))) |
49931 | 68 |
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw \ |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
69 |
-Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \ |
55243
647593fdea53
8209381: Default CDS classlist generation should run with an explicit locale setting
erikj
parents:
53589
diff
changeset
|
70 |
-Duser.language=en -Duser.country=US \ |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
71 |
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
72 |
build.tools.classlist.HelloClasslist \ |
53589
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
73 |
2> $(LINK_OPT_DIR)/stderr > $(JLI_TRACE_FILE) \ |
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
74 |
|| ( \ |
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
75 |
exitcode=$$? ; \ |
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
76 |
$(ECHO) "ERROR: Failed to generate link optimization data." \ |
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
77 |
"This is likely a problem with the newly built JVM/JDK." ; \ |
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
78 |
$(CAT) $(LINK_OPT_DIR)/stderr $(JLI_TRACE_FILE) ; \ |
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
79 |
exit $$exitcode \ |
9ee67f08fdaa
8204564: Need better error output when GenerateLinkOptData fails
erikj
parents:
52175
diff
changeset
|
80 |
) |
49931 | 81 |
$(GREP) -v HelloClasslist $@.raw > $@ |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
82 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
83 |
# The jli trace is created by the same recipe as classlist. By declaring these |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
84 |
# dependencies, make will correctly rebuild both jli trace and classlist |
43917 | 85 |
# incrementally using the single recipe above. |
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
86 |
$(CLASSLIST_FILE): $(JLI_TRACE_FILE) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
87 |
$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
88 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
89 |
TARGETS += $(CLASSLIST_FILE) $(JLI_TRACE_FILE) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
90 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
91 |
# Copy the classlist file into java.base libs |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
92 |
$(eval $(call SetupCopyFiles, COPY_CLASSLIST, \ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
93 |
FILES := $(CLASSLIST_FILE), \ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
94 |
DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
95 |
)) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
96 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
97 |
TARGETS += $(COPY_CLASSLIST) |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
98 |
|
43783
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
99 |
# Copy the default_jli_trace.txt file into jdk.jlink |
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
100 |
$(eval $(call SetupCopyFiles, COPY_JLI_TRACE, \ |
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
101 |
FILES := $(JLI_TRACE_FILE), \ |
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
102 |
DEST := $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jlink/internal/plugins, \ |
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
103 |
)) |
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
104 |
|
43917 | 105 |
# Because of the single recipe for jli trace and classlist above, the |
106 |
# COPY_JLI_TRACE rule needs to explicitly add the classlist file as a |
|
107 |
# prerequisite. |
|
108 |
$(COPY_JLI_TRACE): $(CLASSLIST_FILE) |
|
109 |
||
43783
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
110 |
TARGETS += $(COPY_JLI_TRACE) |
35fe9d6f5075
8175026: Capture build-time parameters to --generate-jli-classes
redestad
parents:
41874
diff
changeset
|
111 |
|
41874
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
112 |
################################################################################ |
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
113 |
|
07c3c4f1eb63
8168108: lib/classlist should be packaged in java.base.jmod
erikj
parents:
diff
changeset
|
114 |
all: $(TARGETS) |