blob: 864d98b855c3209e141a3e8ff85af58f6fdf8271 [file] [log] [blame]
David Holmes945d6e82013-01-21 23:17:58 -05001#
2# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation. Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26include ProfileNames.gmk
27
28# This defines the include lists for each profile, categorized as lib, bin
29# and other. We can use these to define the file lists for each profile
30# directly, rather than constructing a set of files to exclude from the
31# set of all files. But initially we will stick with generating exclude lists
32# as that is how the main build process already works.
33
34include profile-includes.txt
35
36###############################################################################
37# Per profile Jar lists
38#
39# These are the jar files to be built. In some builds these have to be
40# imported (signed jars) rather than built.
41#
42# The incoming lists, eg PROFILE_1_JRE_JARS_FILES, are the jars to be
43# included in this profile. They have the jar name relative to the lib
44# directory. We have to turn these into targets by adding the
45# $(IMAGES_OUTPUTDIR)/lib prefix
46#
47# Note that some jars may be optional depending on the type of build (jdk vs.
48# openjdk) and the platform.
49#
50# WARNING: incoming lists are currently validated for linux only!
51###############################################################################
52
53# These are jar files for which the contents vary depending on the profile
54CUSTOM_JARS := rt.jar resources.jar
55# This is used in Images.gmk
56CUSTOM_PROFILE_JARS := $(addprefix $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/, $(CUSTOM_JARS))
57
58# These are the common jar files built for and included with this profile
59# Filter out the custom jars and turn them into targets.
60
61PROFILE_1_JARS := \
62 $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(filter-out $(CUSTOM_JARS), $(PROFILE_1_JRE_JAR_FILES)))
63
64PROFILE_2_JARS := \
65 $(if $(PROFILE_2_JRE_JAR_FILES), $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_2_JRE_JAR_FILES))) \
66 $(PROFILE_1_JARS)
67
68ifneq ($(ENABLE_JFR), true)
69 PROFILE_3_JRE_JAR_FILES := $(filter-out jfr.jar, $(PROFILE_3_JRE_JAR_FILES))
70endif
71
72PROFILE_3_JARS := \
73 $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_3_JRE_JAR_FILES)) \
74 $(PROFILE_2_JARS)
75
76ifdef OPENJDK
77 PROFILE_4_JRE_JAR_FILES := $(filter-out alt-rt.jar, $(PROFILE_4_JRE_JAR_FILES))
78endif
79
80PROFILE_4_JARS := \
81 $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_4_JRE_JAR_FILES)) \
82 $(PROFILE_3_JARS)
83
84# The full set of "jar" files needed for a complete JDK (ct.sym and src.zip
85# are also included.)
86# Note we need to add back the regular form of all the custom profile jars e.g.
87# rt.jar and resources.jar
88
89ALL_JARS := $(PROFILE_4_JARS) \
90 $(IMAGES_OUTPUTDIR)/lib/rt.jar \
91 $(IMAGES_OUTPUTDIR)/lib/resources.jar \
92 $(IMAGES_OUTPUTDIR)/lib/jconsole.jar \
93 $(IMAGES_OUTPUTDIR)/lib/dt.jar \
94 $(IMAGES_OUTPUTDIR)/lib/tools.jar \
95 $(IMAGES_OUTPUTDIR)/lib/ct.sym \
96 $(IMAGES_OUTPUTDIR)/src.zip \
97 $(IMAGES_OUTPUTDIR)/lib/ext/cldrdata.jar \
98 $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
99
100ifeq ($(OPENJDK_TARGET_OS),solaris)
101 ifndef OPENJDK
102 ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar
103 endif
104endif
105
106ifeq ($(OPENJDK_TARGET_OS),windows)
107 ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar
108endif
109
110ifeq ($(OPENJDK_TARGET_OS),macosx)
111 ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar
112endif
113
114ifeq ($(PROFILE), profile_1)
115 PROFILE_JARS := $(PROFILE_1_JARS)
116else ifeq ($(PROFILE), profile_2)
117 PROFILE_JARS := $(PROFILE_2_JARS)
118else ifeq ($(PROFILE), profile_3)
119 PROFILE_JARS := $(PROFILE_3_JARS)
120endif
121ifneq ($(PROFILE),)
122 JARS := $(CUSTOM_PROFILE_JARS) $(PROFILE_JARS)
123else
124 JARS := $(ALL_JARS)
125endif
126
127###############################################################################
128# JRE contents
129###############################################################################
130
131
132# we don't need to do anything if not building a profile
133ifneq ($(PROFILE),)
134
135
136# Need all files to generate the exclude lists
137NEW_ALL_BIN_LIST := $(patsubst $(JDK_OUTPUTDIR)/bin/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/bin \( -type f -o -type l \) ! -name "sjavac"))
138
139ALL_JRE_BIN_FILES := \
140 $(PROFILE_1_JRE_BIN_FILES) \
141 $(PROFILE_2_JRE_BIN_FILES) \
142 $(PROFILE_3_JRE_BIN_FILES) \
143 $(PROFILE_4_JRE_BIN_FILES)
144
145NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST))
146
147# Additional exclusions for profile JRE
148ifeq ($(PROFILE), profile_1)
149 NOT_JRE_BIN_FILES += \
150 $(PROFILE_2_JRE_BIN_FILES) \
151 $(PROFILE_3_JRE_BIN_FILES) \
152 $(PROFILE_4_JRE_BIN_FILES)
153endif
154
155ifeq ($(PROFILE), profile_2)
156 NOT_JRE_BIN_FILES += \
157 $(PROFILE_3_JRE_BIN_FILES) \
158 $(PROFILE_4_JRE_BIN_FILES)
159endif
160
161ifeq ($(PROFILE), profile_3)
162 NOT_JRE_BIN_FILES += \
163 $(PROFILE_4_JRE_BIN_FILES)
164endif
165
166NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES))
167
168# Need all files to generate the exclude lists
169NEW_ALL_LIB_LIST := $(patsubst $(JDK_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
170NEW_ALL_LIB_LIST += $(patsubst $(IMAGES_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
171
172ALL_JRE_LIB_FILES := \
173 $(PROFILE_1_JRE_LIB_FILES) \
174 $(PROFILE_2_JRE_LIB_FILES) \
175 $(PROFILE_3_JRE_LIB_FILES) \
176 $(PROFILE_4_JRE_LIB_FILES)
177
178NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST))
179
180# Although these are NOT JRE lib files we have to filter them from the list
181# (ie cause them to be added them back in here) because the logic in
182# Images.gmk expects them to be there and handles them differently.
183# If we don't, they end up in the wrong place in the JDK image.
184# This needs fixing.
185NOT_JRE_LIB_FILES := $(filter-out $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(SALIB_NAME), $(NOT_JRE_LIB_FILES))
186
187# Additional exclusions for profile JREs
188ifeq ($(PROFILE), profile_1)
189 NOT_JRE_LIB_FILES += \
190 $(PROFILE_2_JRE_LIB_FILES) \
191 $(PROFILE_3_JRE_LIB_FILES) \
192 $(PROFILE_4_JRE_LIB_FILES)
193endif
194
195ifeq ($(PROFILE), profile_2)
196 NOT_JRE_LIB_FILES += \
197 $(PROFILE_3_JRE_LIB_FILES) \
198 $(PROFILE_4_JRE_LIB_FILES)
199endif
200
201ifeq ($(PROFILE), profile_3)
202 NOT_JRE_LIB_FILES += \
203 $(PROFILE_4_JRE_LIB_FILES)
204endif
205
206# Exclude the custom jar files as these will be added back via a special rule
207NOT_JRE_LIB_FILES += $(CUSTOM_JARS)
208
209###############################################################################
210# Customization of rt.jar file contents
211# These are expressed as exclusions from everything found in the
212# JDK_OUTPUTDIR/classes directory
213###############################################################################
214
215# The main set of excluded types/packages (ie everything not destined to be
216# part of rt.jar or resources.jar is captured in the CreateJars.gmk RT_JAR_EXCLUDES
217# variable. We add to that for the per-profile exclusion lists
218
219# For each profile we have four variables:
220#
221# - PROFILE_n_RTJAR_INCLUDE_PACKAGES
222#
223# This is a package prefix indicating that all classes in that package
224# and conditionally its subpackages are included in rt.jar for this profile.
225# The subpackages will be included as long as they do not appear in the
226# include list of a higher profile
227#
228# - PROFILE_n_RTJAR_INCLUDE_TYPES
229#
230# These are specific types that must be included within a package.
231# There are two cases:
232# - individual types in a package that is otherwise excluded at this
233# profile level. The only arises if there are split packages.
234#
235# - A higher-level package is included in a high profile where a subpackage
236# is included in a lower profile. Including the package in the high profile
237# would exclude it and all subpackages from the lower profile, so instead
238# the classes in the package are listed for that higher profile (as *.class)
239#
240# These types are explicitly added back into the rt.jar content lists.
241#
242# - PROFILE_n_RTJAR_EXCLUDE_TYPES
243#
244# These are specific types that must be excluded even though most of the
245# containing package is include. Again this occurs with split packges.
246#
247# So the exclude list for each profile consists of the include lists
248# for all profiles above it, together with any explicitly excluded types.
249# This is then combined with the overall RT_JAR_EXCLUDES list (which covers
250# things that go into other jar files).
251#
252# We also have to define the types to be explicitly included. This
253# accumulates up the profiles ie profile 3 has to include the types
254# that profiles 1 and 2 had to include. This is unnecessary if, for example,
255# profile 3 includes the entire package, but it is harmless to add them
256# explicitly, and complex to determine if we still need to include them.
257#
258# Need a way to express:
259# for (int i = profile+1; i < 4; i++)
260# RT_JAR_EXCLUDES += PROFILE_$i_RTJAR_INCLUDE_PACKAGES
261#
262# Do it the long way for now
263#
264# - PROFILE_n_INCLUDE_METAINF_SERVICES
265#
266# These are META-INF/services/ entries found in resources.jar. Together
267# resources.jar and rt.jar hold the contents of the classes directory, (the
268# classes in rt.jar and everything else in resources.jar).Hence the
269# include/exclude information for resources.jar is tied to that of rt.jar
270
271include profile-rtjar-includes.txt
272
273# Function to expand foo/*.class into the set of classes
274# NOTE: Classfiles with $ in their name are problematic as that is the
275# meta-character for both make and the shell! Hence the \$$$$ substitution.
276# But note that if you echo these values they will NOT display as expected.
277class_list = $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\
278 $(foreach i,$(1), $(subst $$,\$$$$, $(wildcard $(JDK_OUTPUTDIR)/classes/$i))))
279
280ifeq ($(PROFILE), profile_1)
281 RT_JAR_EXCLUDES += \
282 $(PROFILE_1_RTJAR_EXCLUDE_TYPES) \
283 $(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \
284 $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
285 $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
286 $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
287 $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
288 $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
289 RT_JAR_INCLUDE_TYPES := \
290 $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES))
291 PROFILE_INCLUDE_METAINF_SERVICES := \
292 $(PROFILE_1_INCLUDE_METAINF_SERVICES)
293endif
294ifeq ($(PROFILE), profile_2)
295 RT_JAR_EXCLUDES += \
296 $(PROFILE_2_RTJAR_EXCLUDE_TYPES) \
297 $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
298 $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
299 $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
300 $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
301 RT_JAR_INCLUDE_TYPES := \
302 $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
303 $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES))
304 PROFILE_INCLUDE_METAINF_SERVICES := \
305 $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
306 $(PROFILE_2_INCLUDE_METAINF_SERVICES)
307endif
308ifeq ($(PROFILE), profile_3)
309 RT_JAR_EXCLUDES += \
310 $(PROFILE_3_RTJAR_EXCLUDE_TYPES) \
311 $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
312 $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
313 RT_JAR_INCLUDE_TYPES := \
314 $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
315 $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
316 $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES))
317 PROFILE_INCLUDE_METAINF_SERVICES := \
318 $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
319 $(PROFILE_2_INCLUDE_METAINF_SERVICES) \
320 $(PROFILE_3_INCLUDE_METAINF_SERVICES)
321endif
322
323# Filter out non-OpenJDK services
324ifdef OPENJDK
325 EXCLUDED_SERVICES := META-INF/services/javax.script.ScriptEngineFactory
326 PROFILE_INCLUDE_METAINF_SERVICES := $(filter-out $(EXCLUDED_SERVICES),$(PROFILE_INCLUDE_METAINF_SERVICES))
327endif
328
329
330endif # profile
331