| # |
| # Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
| # 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. |
| # |
| |
| include ProfileNames.gmk |
| |
| # This defines the include lists for each profile, categorized as lib, bin |
| # and other. We can use these to define the file lists for each profile |
| # directly, rather than constructing a set of files to exclude from the |
| # set of all files. But initially we will stick with generating exclude lists |
| # as that is how the main build process already works. |
| |
| include profile-includes.txt |
| |
| ############################################################################### |
| # Per profile Jar lists |
| # |
| # These are the jar files to be built. In some builds these have to be |
| # imported (signed jars) rather than built. |
| # |
| # The incoming lists, eg PROFILE_1_JRE_JARS_FILES, are the jars to be |
| # included in this profile. They have the jar name relative to the lib |
| # directory. We have to turn these into targets by adding the |
| # $(IMAGES_OUTPUTDIR)/lib prefix |
| # |
| # Note that some jars may be optional depending on the type of build (jdk vs. |
| # openjdk) and the platform. |
| # |
| # WARNING: incoming lists are currently validated for linux only! |
| ############################################################################### |
| |
| # These are jar files for which the contents vary depending on the profile |
| CUSTOM_JARS := rt.jar resources.jar |
| # This is used in Images.gmk |
| CUSTOM_PROFILE_JARS := $(addprefix $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/, $(CUSTOM_JARS)) |
| |
| # These are the common jar files built for and included with this profile |
| # Filter out the custom jars and turn them into targets. |
| |
| PROFILE_1_JARS := \ |
| $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(filter-out $(CUSTOM_JARS), $(PROFILE_1_JRE_JAR_FILES))) |
| |
| PROFILE_2_JARS := \ |
| $(if $(PROFILE_2_JRE_JAR_FILES), $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_2_JRE_JAR_FILES))) \ |
| $(PROFILE_1_JARS) |
| |
| ifneq ($(ENABLE_JFR), true) |
| PROFILE_3_JRE_JAR_FILES := $(filter-out jfr.jar, $(PROFILE_3_JRE_JAR_FILES)) |
| endif |
| |
| PROFILE_3_JARS := \ |
| $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_3_JRE_JAR_FILES)) \ |
| $(PROFILE_2_JARS) |
| |
| ifdef OPENJDK |
| PROFILE_4_JRE_JAR_FILES := $(filter-out alt-rt.jar, $(PROFILE_4_JRE_JAR_FILES)) |
| endif |
| |
| PROFILE_4_JARS := \ |
| $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_4_JRE_JAR_FILES)) \ |
| $(PROFILE_3_JARS) |
| |
| # The full set of "jar" files needed for a complete JDK (ct.sym and src.zip |
| # are also included.) |
| # Note we need to add back the regular form of all the custom profile jars e.g. |
| # rt.jar and resources.jar |
| |
| ALL_JARS := $(PROFILE_4_JARS) \ |
| $(IMAGES_OUTPUTDIR)/lib/rt.jar \ |
| $(IMAGES_OUTPUTDIR)/lib/resources.jar \ |
| $(IMAGES_OUTPUTDIR)/lib/jconsole.jar \ |
| $(IMAGES_OUTPUTDIR)/lib/dt.jar \ |
| $(IMAGES_OUTPUTDIR)/lib/tools.jar \ |
| $(IMAGES_OUTPUTDIR)/lib/ct.sym \ |
| $(IMAGES_OUTPUTDIR)/src.zip \ |
| $(IMAGES_OUTPUTDIR)/lib/ext/cldrdata.jar \ |
| $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar |
| |
| ifeq ($(OPENJDK_TARGET_OS),solaris) |
| ifndef OPENJDK |
| ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar |
| endif |
| endif |
| |
| ifeq ($(OPENJDK_TARGET_OS),windows) |
| ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar |
| endif |
| |
| ifeq ($(OPENJDK_TARGET_OS),macosx) |
| ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar |
| endif |
| |
| ifeq ($(PROFILE), profile_1) |
| PROFILE_JARS := $(PROFILE_1_JARS) |
| else ifeq ($(PROFILE), profile_2) |
| PROFILE_JARS := $(PROFILE_2_JARS) |
| else ifeq ($(PROFILE), profile_3) |
| PROFILE_JARS := $(PROFILE_3_JARS) |
| endif |
| ifneq ($(PROFILE),) |
| JARS := $(CUSTOM_PROFILE_JARS) $(PROFILE_JARS) |
| else |
| JARS := $(ALL_JARS) |
| endif |
| |
| ############################################################################### |
| # JRE contents |
| ############################################################################### |
| |
| |
| # we don't need to do anything if not building a profile |
| ifneq ($(PROFILE),) |
| |
| |
| # Need all files to generate the exclude lists |
| NEW_ALL_BIN_LIST := $(patsubst $(JDK_OUTPUTDIR)/bin/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/bin \( -type f -o -type l \) ! -name "sjavac")) |
| |
| ALL_JRE_BIN_FILES := \ |
| $(PROFILE_1_JRE_BIN_FILES) \ |
| $(PROFILE_2_JRE_BIN_FILES) \ |
| $(PROFILE_3_JRE_BIN_FILES) \ |
| $(PROFILE_4_JRE_BIN_FILES) |
| |
| NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST)) |
| |
| # Additional exclusions for profile JRE |
| ifeq ($(PROFILE), profile_1) |
| NOT_JRE_BIN_FILES += \ |
| $(PROFILE_2_JRE_BIN_FILES) \ |
| $(PROFILE_3_JRE_BIN_FILES) \ |
| $(PROFILE_4_JRE_BIN_FILES) |
| endif |
| |
| ifeq ($(PROFILE), profile_2) |
| NOT_JRE_BIN_FILES += \ |
| $(PROFILE_3_JRE_BIN_FILES) \ |
| $(PROFILE_4_JRE_BIN_FILES) |
| endif |
| |
| ifeq ($(PROFILE), profile_3) |
| NOT_JRE_BIN_FILES += \ |
| $(PROFILE_4_JRE_BIN_FILES) |
| endif |
| |
| NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES)) |
| |
| # Need all files to generate the exclude lists |
| NEW_ALL_LIB_LIST := $(patsubst $(JDK_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) )) |
| NEW_ALL_LIB_LIST += $(patsubst $(IMAGES_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) )) |
| |
| ALL_JRE_LIB_FILES := \ |
| $(PROFILE_1_JRE_LIB_FILES) \ |
| $(PROFILE_2_JRE_LIB_FILES) \ |
| $(PROFILE_3_JRE_LIB_FILES) \ |
| $(PROFILE_4_JRE_LIB_FILES) |
| |
| NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST)) |
| |
| # Although these are NOT JRE lib files we have to filter them from the list |
| # (ie cause them to be added them back in here) because the logic in |
| # Images.gmk expects them to be there and handles them differently. |
| # If we don't, they end up in the wrong place in the JDK image. |
| # This needs fixing. |
| NOT_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)) |
| |
| # Additional exclusions for profile JREs |
| ifeq ($(PROFILE), profile_1) |
| NOT_JRE_LIB_FILES += \ |
| $(PROFILE_2_JRE_LIB_FILES) \ |
| $(PROFILE_3_JRE_LIB_FILES) \ |
| $(PROFILE_4_JRE_LIB_FILES) |
| endif |
| |
| ifeq ($(PROFILE), profile_2) |
| NOT_JRE_LIB_FILES += \ |
| $(PROFILE_3_JRE_LIB_FILES) \ |
| $(PROFILE_4_JRE_LIB_FILES) |
| endif |
| |
| ifeq ($(PROFILE), profile_3) |
| NOT_JRE_LIB_FILES += \ |
| $(PROFILE_4_JRE_LIB_FILES) |
| endif |
| |
| # Exclude the custom jar files as these will be added back via a special rule |
| NOT_JRE_LIB_FILES += $(CUSTOM_JARS) |
| |
| ############################################################################### |
| # Customization of rt.jar file contents |
| # These are expressed as exclusions from everything found in the |
| # JDK_OUTPUTDIR/classes directory |
| ############################################################################### |
| |
| # The main set of excluded types/packages (ie everything not destined to be |
| # part of rt.jar or resources.jar is captured in the CreateJars.gmk RT_JAR_EXCLUDES |
| # variable. We add to that for the per-profile exclusion lists |
| |
| # For each profile we have four variables: |
| # |
| # - PROFILE_n_RTJAR_INCLUDE_PACKAGES |
| # |
| # This is a package prefix indicating that all classes in that package |
| # and conditionally its subpackages are included in rt.jar for this profile. |
| # The subpackages will be included as long as they do not appear in the |
| # include list of a higher profile |
| # |
| # - PROFILE_n_RTJAR_INCLUDE_TYPES |
| # |
| # These are specific types that must be included within a package. |
| # There are two cases: |
| # - individual types in a package that is otherwise excluded at this |
| # profile level. The only arises if there are split packages. |
| # |
| # - A higher-level package is included in a high profile where a subpackage |
| # is included in a lower profile. Including the package in the high profile |
| # would exclude it and all subpackages from the lower profile, so instead |
| # the classes in the package are listed for that higher profile (as *.class) |
| # |
| # These types are explicitly added back into the rt.jar content lists. |
| # |
| # - PROFILE_n_RTJAR_EXCLUDE_TYPES |
| # |
| # These are specific types that must be excluded even though most of the |
| # containing package is include. Again this occurs with split packges. |
| # |
| # So the exclude list for each profile consists of the include lists |
| # for all profiles above it, together with any explicitly excluded types. |
| # This is then combined with the overall RT_JAR_EXCLUDES list (which covers |
| # things that go into other jar files). |
| # |
| # We also have to define the types to be explicitly included. This |
| # accumulates up the profiles ie profile 3 has to include the types |
| # that profiles 1 and 2 had to include. This is unnecessary if, for example, |
| # profile 3 includes the entire package, but it is harmless to add them |
| # explicitly, and complex to determine if we still need to include them. |
| # |
| # Need a way to express: |
| # for (int i = profile+1; i < 4; i++) |
| # RT_JAR_EXCLUDES += PROFILE_$i_RTJAR_INCLUDE_PACKAGES |
| # |
| # Do it the long way for now |
| # |
| # - PROFILE_n_INCLUDE_METAINF_SERVICES |
| # |
| # These are META-INF/services/ entries found in resources.jar. Together |
| # resources.jar and rt.jar hold the contents of the classes directory, (the |
| # classes in rt.jar and everything else in resources.jar).Hence the |
| # include/exclude information for resources.jar is tied to that of rt.jar |
| |
| include profile-rtjar-includes.txt |
| |
| # Function to expand foo/*.class into the set of classes |
| # NOTE: Classfiles with $ in their name are problematic as that is the |
| # meta-character for both make and the shell! Hence the \$$$$ substitution. |
| # But note that if you echo these values they will NOT display as expected. |
| class_list = $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\ |
| $(foreach i,$(1), $(subst $$,\$$$$, $(wildcard $(JDK_OUTPUTDIR)/classes/$i)))) |
| |
| ifeq ($(PROFILE), profile_1) |
| RT_JAR_EXCLUDES += \ |
| $(PROFILE_1_RTJAR_EXCLUDE_TYPES) \ |
| $(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \ |
| $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \ |
| $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \ |
| $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \ |
| $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \ |
| $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES)) |
| RT_JAR_INCLUDE_TYPES := \ |
| $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) |
| PROFILE_INCLUDE_METAINF_SERVICES := \ |
| $(PROFILE_1_INCLUDE_METAINF_SERVICES) |
| endif |
| ifeq ($(PROFILE), profile_2) |
| RT_JAR_EXCLUDES += \ |
| $(PROFILE_2_RTJAR_EXCLUDE_TYPES) \ |
| $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \ |
| $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \ |
| $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \ |
| $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES)) |
| RT_JAR_INCLUDE_TYPES := \ |
| $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \ |
| $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) |
| PROFILE_INCLUDE_METAINF_SERVICES := \ |
| $(PROFILE_1_INCLUDE_METAINF_SERVICES) \ |
| $(PROFILE_2_INCLUDE_METAINF_SERVICES) |
| endif |
| ifeq ($(PROFILE), profile_3) |
| RT_JAR_EXCLUDES += \ |
| $(PROFILE_3_RTJAR_EXCLUDE_TYPES) \ |
| $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \ |
| $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES)) |
| RT_JAR_INCLUDE_TYPES := \ |
| $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \ |
| $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \ |
| $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) |
| PROFILE_INCLUDE_METAINF_SERVICES := \ |
| $(PROFILE_1_INCLUDE_METAINF_SERVICES) \ |
| $(PROFILE_2_INCLUDE_METAINF_SERVICES) \ |
| $(PROFILE_3_INCLUDE_METAINF_SERVICES) |
| endif |
| |
| # Filter out non-OpenJDK services |
| ifdef OPENJDK |
| EXCLUDED_SERVICES := META-INF/services/javax.script.ScriptEngineFactory |
| PROFILE_INCLUDE_METAINF_SERVICES := $(filter-out $(EXCLUDED_SERVICES),$(PROFILE_INCLUDE_METAINF_SERVICES)) |
| endif |
| |
| |
| endif # profile |
| |