blob: dc4ea590fdbe1cabfc37d1fb770c8fabc3af5815 [file] [log] [blame]
dholmes85dd5c82013-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
mduigou645aeab2013-09-27 10:21:04 -070043# 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
dholmes85dd5c82013-01-21 23:17:58 -050045# $(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
ihsea29e6222013-10-10 15:06:21 +020061PROFILE_1_JARS := \
dholmes85dd5c82013-01-21 23:17:58 -050062 $(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
dholmes85dd5c82013-01-21 23:17:58 -050068PROFILE_3_JARS := \
69 $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_3_JRE_JAR_FILES)) \
70 $(PROFILE_2_JARS)
71
dholmes86487282013-08-21 05:56:46 -040072ifneq ($(ENABLE_JFR), true)
ihsea29e6222013-10-10 15:06:21 +020073 FULL_JRE_JAR_FILES := $(filter-out jfr.jar, $(FULL_JRE_JAR_FILES))
dholmes86487282013-08-21 05:56:46 -040074endif
75
dholmes8127a4f2013-03-14 01:47:59 -040076FULL_JRE_JARS := \
77 $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(FULL_JRE_JAR_FILES)) \
dholmes85dd5c82013-01-21 23:17:58 -050078 $(PROFILE_3_JARS)
79
80# The full set of "jar" files needed for a complete JDK (ct.sym and src.zip
81# are also included.)
82# Note we need to add back the regular form of all the custom profile jars e.g.
dholmes3215a6c2013-03-19 06:01:14 -040083# rt.jar and resources.jar that we filtered out above
dholmes85dd5c82013-01-21 23:17:58 -050084
dholmes8127a4f2013-03-14 01:47:59 -040085ALL_JARS := $(FULL_JRE_JARS) \
ihsea29e6222013-10-10 15:06:21 +020086 $(IMAGES_OUTPUTDIR)/lib/rt.jar \
87 $(IMAGES_OUTPUTDIR)/lib/resources.jar \
88 $(IMAGES_OUTPUTDIR)/lib/jconsole.jar \
89 $(IMAGES_OUTPUTDIR)/lib/dt.jar \
90 $(IMAGES_OUTPUTDIR)/lib/tools.jar \
91 $(IMAGES_OUTPUTDIR)/lib/ct.sym \
92 $(IMAGES_OUTPUTDIR)/src.zip
omajida0e66e82013-04-08 14:09:01 -040093
ihsea29e6222013-10-10 15:06:21 +020094ifeq ($(INCLUDE_SA), true)
95 ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
omajida0e66e82013-04-08 14:09:01 -040096endif
dholmes85dd5c82013-01-21 23:17:58 -050097
ihsea29e6222013-10-10 15:06:21 +020098ifeq ($(OPENJDK_TARGET_OS), solaris)
99 ifndef OPENJDK
100 ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar
101 endif
dholmes85dd5c82013-01-21 23:17:58 -0500102endif
103
ihsea29e6222013-10-10 15:06:21 +0200104ifeq ($(OPENJDK_TARGET_OS), windows)
105 ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar
mduigou645aeab2013-09-27 10:21:04 -0700106endif
dholmes85dd5c82013-01-21 23:17:58 -0500107
dholmes85dd5c82013-01-21 23:17:58 -0500108ifeq ($(PROFILE), profile_1)
ihsea29e6222013-10-10 15:06:21 +0200109 PROFILE_JARS := $(PROFILE_1_JARS)
dholmes85dd5c82013-01-21 23:17:58 -0500110else ifeq ($(PROFILE), profile_2)
ihsea29e6222013-10-10 15:06:21 +0200111 PROFILE_JARS := $(PROFILE_2_JARS)
dholmes85dd5c82013-01-21 23:17:58 -0500112else ifeq ($(PROFILE), profile_3)
ihsea29e6222013-10-10 15:06:21 +0200113 PROFILE_JARS := $(PROFILE_3_JARS)
dholmes85dd5c82013-01-21 23:17:58 -0500114endif
ihsea29e6222013-10-10 15:06:21 +0200115ifneq ($(PROFILE), )
116 JARS := $(CUSTOM_PROFILE_JARS) $(PROFILE_JARS)
dholmes85dd5c82013-01-21 23:17:58 -0500117else
ihsea29e6222013-10-10 15:06:21 +0200118 JARS := $(ALL_JARS)
dholmes85dd5c82013-01-21 23:17:58 -0500119endif
120
121###############################################################################
122# JRE contents
123###############################################################################
124
125
126# we don't need to do anything if not building a profile
ihsea29e6222013-10-10 15:06:21 +0200127ifneq ($(PROFILE), )
dholmes85dd5c82013-01-21 23:17:58 -0500128
129
130# Need all files to generate the exclude lists
131NEW_ALL_BIN_LIST := $(patsubst $(JDK_OUTPUTDIR)/bin/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/bin \( -type f -o -type l \) ! -name "sjavac"))
132
133ALL_JRE_BIN_FILES := \
ihsea29e6222013-10-10 15:06:21 +0200134 $(PROFILE_1_JRE_BIN_FILES) \
135 $(PROFILE_2_JRE_BIN_FILES) \
136 $(PROFILE_3_JRE_BIN_FILES) \
137 $(FULL_JRE_BIN_FILES)
dholmes85dd5c82013-01-21 23:17:58 -0500138
139NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST))
140
141# Additional exclusions for profile JRE
142ifeq ($(PROFILE), profile_1)
ihsea29e6222013-10-10 15:06:21 +0200143 NOT_JRE_BIN_FILES += \
144 $(PROFILE_2_JRE_BIN_FILES) \
145 $(PROFILE_3_JRE_BIN_FILES) \
146 $(FULL_JRE_BIN_FILES)
dholmes85dd5c82013-01-21 23:17:58 -0500147endif
148
149ifeq ($(PROFILE), profile_2)
ihsea29e6222013-10-10 15:06:21 +0200150 NOT_JRE_BIN_FILES += \
151 $(PROFILE_3_JRE_BIN_FILES) \
152 $(FULL_JRE_BIN_FILES)
dholmes85dd5c82013-01-21 23:17:58 -0500153endif
154
155ifeq ($(PROFILE), profile_3)
ihsea29e6222013-10-10 15:06:21 +0200156 NOT_JRE_BIN_FILES += \
157 $(FULL_JRE_BIN_FILES)
dholmes85dd5c82013-01-21 23:17:58 -0500158endif
159
160NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES))
161
162# Need all files to generate the exclude lists
163NEW_ALL_LIB_LIST := $(patsubst $(JDK_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
164NEW_ALL_LIB_LIST += $(patsubst $(IMAGES_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
165
166ALL_JRE_LIB_FILES := \
ihsea29e6222013-10-10 15:06:21 +0200167 $(PROFILE_1_JRE_LIB_FILES) \
168 $(PROFILE_2_JRE_LIB_FILES) \
169 $(PROFILE_3_JRE_LIB_FILES) \
170 $(FULL_JRE_LIB_FILES)
dholmes85dd5c82013-01-21 23:17:58 -0500171
172NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST))
173
174# Although these are NOT JRE lib files we have to filter them from the list
175# (ie cause them to be added them back in here) because the logic in
176# Images.gmk expects them to be there and handles them differently.
177# If we don't, they end up in the wrong place in the JDK image.
178# This needs fixing.
179NOT_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))
180
181# Additional exclusions for profile JREs
182ifeq ($(PROFILE), profile_1)
ihsea29e6222013-10-10 15:06:21 +0200183 NOT_JRE_LIB_FILES += \
184 $(PROFILE_2_JRE_LIB_FILES) \
185 $(PROFILE_3_JRE_LIB_FILES) \
186 $(FULL_JRE_LIB_FILES)
dholmes85dd5c82013-01-21 23:17:58 -0500187endif
188
189ifeq ($(PROFILE), profile_2)
ihsea29e6222013-10-10 15:06:21 +0200190 NOT_JRE_LIB_FILES += \
191 $(PROFILE_3_JRE_LIB_FILES) \
192 $(FULL_JRE_LIB_FILES)
dholmes85dd5c82013-01-21 23:17:58 -0500193endif
194
195ifeq ($(PROFILE), profile_3)
ihsea29e6222013-10-10 15:06:21 +0200196 NOT_JRE_LIB_FILES += \
197 $(FULL_JRE_LIB_FILES)
dholmes85dd5c82013-01-21 23:17:58 -0500198endif
199
200# Exclude the custom jar files as these will be added back via a special rule
201NOT_JRE_LIB_FILES += $(CUSTOM_JARS)
202
203###############################################################################
204# Customization of rt.jar file contents
mduigou645aeab2013-09-27 10:21:04 -0700205# These are expressed as exclusions from everything found in the
dholmes85dd5c82013-01-21 23:17:58 -0500206# JDK_OUTPUTDIR/classes directory
207###############################################################################
208
209# The main set of excluded types/packages (ie everything not destined to be
210# part of rt.jar or resources.jar is captured in the CreateJars.gmk RT_JAR_EXCLUDES
211# variable. We add to that for the per-profile exclusion lists
212
213# For each profile we have four variables:
214#
215# - PROFILE_n_RTJAR_INCLUDE_PACKAGES
216#
217# This is a package prefix indicating that all classes in that package
218# and conditionally its subpackages are included in rt.jar for this profile.
219# The subpackages will be included as long as they do not appear in the
220# include list of a higher profile
221#
222# - PROFILE_n_RTJAR_INCLUDE_TYPES
223#
224# These are specific types that must be included within a package.
225# There are two cases:
mduigou645aeab2013-09-27 10:21:04 -0700226# - individual types in a package that is otherwise excluded at this
227# profile level. The only arises if there are split packages.
dholmes85dd5c82013-01-21 23:17:58 -0500228#
229# - A higher-level package is included in a high profile where a subpackage
230# is included in a lower profile. Including the package in the high profile
231# would exclude it and all subpackages from the lower profile, so instead
232# the classes in the package are listed for that higher profile (as *.class)
233#
234# These types are explicitly added back into the rt.jar content lists.
235#
236# - PROFILE_n_RTJAR_EXCLUDE_TYPES
237#
238# These are specific types that must be excluded even though most of the
239# containing package is include. Again this occurs with split packges.
240#
241# So the exclude list for each profile consists of the include lists
mduigou645aeab2013-09-27 10:21:04 -0700242# for all profiles above it, together with any explicitly excluded types.
dholmes85dd5c82013-01-21 23:17:58 -0500243# This is then combined with the overall RT_JAR_EXCLUDES list (which covers
244# things that go into other jar files).
245#
246# We also have to define the types to be explicitly included. This
247# accumulates up the profiles ie profile 3 has to include the types
248# that profiles 1 and 2 had to include. This is unnecessary if, for example,
249# profile 3 includes the entire package, but it is harmless to add them
250# explicitly, and complex to determine if we still need to include them.
251#
mduigou645aeab2013-09-27 10:21:04 -0700252# Need a way to express:
dholmes85dd5c82013-01-21 23:17:58 -0500253# for (int i = profile+1; i < 4; i++)
254# RT_JAR_EXCLUDES += PROFILE_$i_RTJAR_INCLUDE_PACKAGES
255#
256# Do it the long way for now
257#
258# - PROFILE_n_INCLUDE_METAINF_SERVICES
259#
260# These are META-INF/services/ entries found in resources.jar. Together
261# resources.jar and rt.jar hold the contents of the classes directory, (the
mduigou645aeab2013-09-27 10:21:04 -0700262# classes in rt.jar and everything else in resources.jar).Hence the
dholmes85dd5c82013-01-21 23:17:58 -0500263# include/exclude information for resources.jar is tied to that of rt.jar
264
265include profile-rtjar-includes.txt
266
267# Function to expand foo/*.class into the set of classes
268# NOTE: Classfiles with $ in their name are problematic as that is the
269# meta-character for both make and the shell! Hence the \$$$$ substitution.
270# But note that if you echo these values they will NOT display as expected.
ihsea29e6222013-10-10 15:06:21 +0200271class_list = $(patsubst $(JDK_OUTPUTDIR)/classes/%,%, \
272 $(foreach i, $(1), $(subst $$,\$$$$, $(wildcard $(JDK_OUTPUTDIR)/classes/$i))))
dholmes85dd5c82013-01-21 23:17:58 -0500273
274ifeq ($(PROFILE), profile_1)
275 RT_JAR_EXCLUDES += \
ihsea29e6222013-10-10 15:06:21 +0200276 $(call class_list, $(PROFILE_1_RTJAR_EXCLUDE_TYPES)) \
277 $(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \
278 $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
279 $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
280 $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
281 $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
282 $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
dholmes85dd5c82013-01-21 23:17:58 -0500283 RT_JAR_INCLUDE_TYPES := \
ihsea29e6222013-10-10 15:06:21 +0200284 $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES))
dholmes85dd5c82013-01-21 23:17:58 -0500285 PROFILE_INCLUDE_METAINF_SERVICES := \
ihsea29e6222013-10-10 15:06:21 +0200286 $(PROFILE_1_INCLUDE_METAINF_SERVICES)
dholmes85dd5c82013-01-21 23:17:58 -0500287endif
288ifeq ($(PROFILE), profile_2)
289 RT_JAR_EXCLUDES += \
ihsea29e6222013-10-10 15:06:21 +0200290 $(call class_list, $(PROFILE_2_RTJAR_EXCLUDE_TYPES)) \
291 $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
292 $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
293 $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
294 $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
dholmes85dd5c82013-01-21 23:17:58 -0500295 RT_JAR_INCLUDE_TYPES := \
ihsea29e6222013-10-10 15:06:21 +0200296 $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
297 $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES))
dholmes85dd5c82013-01-21 23:17:58 -0500298 PROFILE_INCLUDE_METAINF_SERVICES := \
ihsea29e6222013-10-10 15:06:21 +0200299 $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
300 $(PROFILE_2_INCLUDE_METAINF_SERVICES)
dholmes85dd5c82013-01-21 23:17:58 -0500301endif
302ifeq ($(PROFILE), profile_3)
303 RT_JAR_EXCLUDES += \
ihsea29e6222013-10-10 15:06:21 +0200304 $(call class_list, $(PROFILE_3_RTJAR_EXCLUDE_TYPES)) \
305 $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
306 $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
dholmes85dd5c82013-01-21 23:17:58 -0500307 RT_JAR_INCLUDE_TYPES := \
ihsea29e6222013-10-10 15:06:21 +0200308 $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
309 $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
310 $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES))
dholmes85dd5c82013-01-21 23:17:58 -0500311 PROFILE_INCLUDE_METAINF_SERVICES := \
ihsea29e6222013-10-10 15:06:21 +0200312 $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
313 $(PROFILE_2_INCLUDE_METAINF_SERVICES) \
314 $(PROFILE_3_INCLUDE_METAINF_SERVICES)
dholmes85dd5c82013-01-21 23:17:58 -0500315endif
316
317# Filter out non-OpenJDK services
318ifdef OPENJDK
mduigou645aeab2013-09-27 10:21:04 -0700319 EXCLUDED_SERVICES := META-INF/services/javax.script.ScriptEngineFactory
ihsea29e6222013-10-10 15:06:21 +0200320 PROFILE_INCLUDE_METAINF_SERVICES := $(filter-out $(EXCLUDED_SERVICES), $(PROFILE_INCLUDE_METAINF_SERVICES))
dholmes85dd5c82013-01-21 23:17:58 -0500321endif
322
323
324endif # profile