< prev index next >

make/Images.gmk

Print this page

  1 #
  2 # Copyright (c) 2014, 2026, 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

120     DEPS := $(JRE_JMODS) $(BASE_RELEASE_FILE) \
121         $(call DependOnVariable, JRE_MODULES_LIST, $(JRE_IMAGE_SUPPORT_DIR)/_jlink_jre.vardeps), \
122     OUTPUT_DIR := $(JRE_IMAGE_DIR), \
123     SUPPORT_DIR := $(JRE_IMAGE_SUPPORT_DIR), \
124     PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
125     COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
126         $(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
127 ))
128 
129 JLINK_JRE_TARGETS := $(jlink_jre)
130 
131 # Optimize CDS shared heap for small heap sizes, which are typically used
132 # for small cloud-based apps that have the most critical start-up requirement.
133 # The trade-off is that when larger heap sizes are used, the shared heap
134 # may need to be relocated at runtime.
135 CDS_DUMP_FLAGS = -Xmx128M -Xms128M
136 
137 # Helper function for creating the CDS archives for the JDK and JRE
138 #
139 # Param1 - VM variant (e.g., server, client, zero, ...)
140 # Param2 - _nocoops, _nocoh, _nocoops_nocoh, or empty
141 define CreateCDSArchive
142   $1_$2_COOPS_OPTION := $(if $(findstring _nocoops, $2),-XX:-UseCompressedOops)
143   # enable and also explicitly disable coh as needed.
144   ifeq ($(call isTargetCpuBits, 64), true)
145     $1_$2_NOCOH_OPTION := -XX:+UnlockExperimentalVMOptions \
146                         $(if $(findstring _nocoh, $2),-XX:-UseCompactObjectHeaders,-XX:+UseCompactObjectHeaders)
147   endif
148   $1_$2_DUMP_EXTRA_ARG := $$($1_$2_COOPS_OPTION) $$($1_$2_NOCOH_OPTION)
149   $1_$2_DUMP_TYPE      := $(if $(findstring _nocoops, $2),-NOCOOPS,)$(if $(findstring _nocoh, $2),-NOCOH,)
150 
151   $1_$2_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)), -XX:+UseG1GC)
152 
153   ifeq ($(OPENJDK_TARGET_OS), windows)
154     $1_$2_CDS_ARCHIVE := bin/$1/classes$2.jsa
155   else
156     $1_$2_CDS_ARCHIVE := lib/$1/classes$2.jsa
157   endif
158 
159   ifneq ($(COMPARE_BUILD), )
160     DEBUG_CDS_ARCHIVE := true
161   endif
162 
163   ifeq ($(DEBUG_CDS_ARCHIVE), true)
164     $1_$2_CDS_DUMP_FLAGS += -Xlog:aot+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE).cdsmap:none:filesize=0
165   endif
166 
167   $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jdk, \
168       WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jdk image for $1, \
169       INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \

183       DEPS := $$(jlink_jre), \
184       OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
185       SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
186       COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
187           -XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
188           -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
189   ))
190 
191   JRE_TARGETS += $$($1_$2_gen_cds_archive_jre)
192 endef
193 
194 ifeq ($(BUILD_CDS_ARCHIVE), true)
195   $(foreach v, $(JVM_VARIANTS), \
196     $(eval $(call CreateCDSArchive,$v,)) \
197   )
198 
199   ifeq ($(call isTargetCpuBits, 64), true)
200     $(foreach v, $(JVM_VARIANTS), \
201       $(eval $(call CreateCDSArchive,$v,_nocoops)) \
202     )
203     ifeq ($(BUILD_CDS_ARCHIVE_NOCOH), true)
204       $(foreach v, $(JVM_VARIANTS), \
205         $(eval $(call CreateCDSArchive,$v,_nocoh)) \
206       )
207       $(foreach v, $(JVM_VARIANTS), \
208         $(eval $(call CreateCDSArchive,$v,_nocoops_nocoh)) \
209       )
210     endif
211   endif
212 endif
213 
214 ################################################################################
215 # src.zip
216 
217 $(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
218 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
219 	$(install-file)
220 
221 JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
222 
223 ################################################################################
224 # /demo dir
225 # Avoid doing the expensive find unless called with "jdk" as target.
226 ifneq ($(filter jdk, $(MAKECMDGOALS)), )
227 
228   DEMO_FILES := \

  1 #
  2 # Copyright (c) 2014, 2025, 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

120     DEPS := $(JRE_JMODS) $(BASE_RELEASE_FILE) \
121         $(call DependOnVariable, JRE_MODULES_LIST, $(JRE_IMAGE_SUPPORT_DIR)/_jlink_jre.vardeps), \
122     OUTPUT_DIR := $(JRE_IMAGE_DIR), \
123     SUPPORT_DIR := $(JRE_IMAGE_SUPPORT_DIR), \
124     PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
125     COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
126         $(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
127 ))
128 
129 JLINK_JRE_TARGETS := $(jlink_jre)
130 
131 # Optimize CDS shared heap for small heap sizes, which are typically used
132 # for small cloud-based apps that have the most critical start-up requirement.
133 # The trade-off is that when larger heap sizes are used, the shared heap
134 # may need to be relocated at runtime.
135 CDS_DUMP_FLAGS = -Xmx128M -Xms128M
136 
137 # Helper function for creating the CDS archives for the JDK and JRE
138 #
139 # Param1 - VM variant (e.g., server, client, zero, ...)
140 # Param2 - _nocoops, _coh, _nocoops_coh, or empty
141 define CreateCDSArchive
142   $1_$2_COOPS_OPTION := $(if $(findstring _nocoops, $2),-XX:-UseCompressedOops)
143   # enable and also explicitly disable coh as needed.
144   ifeq ($(call isTargetCpuBits, 64), true)
145     $1_$2_COH_OPTION := -XX:+UnlockExperimentalVMOptions \
146                         $(if $(findstring _coh, $2),-XX:+UseCompactObjectHeaders,-XX:-UseCompactObjectHeaders)
147   endif
148   $1_$2_DUMP_EXTRA_ARG := $$($1_$2_COOPS_OPTION) $$($1_$2_COH_OPTION)
149   $1_$2_DUMP_TYPE      := $(if $(findstring _nocoops, $2),-NOCOOPS,)$(if $(findstring _coh, $2),-COH,)
150 
151   $1_$2_CDS_DUMP_FLAGS := $(CDS_DUMP_FLAGS) $(if $(filter g1gc, $(JVM_FEATURES_$1)), -XX:+UseG1GC)
152 
153   ifeq ($(OPENJDK_TARGET_OS), windows)
154     $1_$2_CDS_ARCHIVE := bin/$1/classes$2.jsa
155   else
156     $1_$2_CDS_ARCHIVE := lib/$1/classes$2.jsa
157   endif
158 
159   ifneq ($(COMPARE_BUILD), )
160     DEBUG_CDS_ARCHIVE := true
161   endif
162 
163   ifeq ($(DEBUG_CDS_ARCHIVE), true)
164     $1_$2_CDS_DUMP_FLAGS += -Xlog:aot+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE).cdsmap:none:filesize=0
165   endif
166 
167   $$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jdk, \
168       WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jdk image for $1, \
169       INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \

183       DEPS := $$(jlink_jre), \
184       OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
185       SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
186       COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
187           -XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
188           -$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
189   ))
190 
191   JRE_TARGETS += $$($1_$2_gen_cds_archive_jre)
192 endef
193 
194 ifeq ($(BUILD_CDS_ARCHIVE), true)
195   $(foreach v, $(JVM_VARIANTS), \
196     $(eval $(call CreateCDSArchive,$v,)) \
197   )
198 
199   ifeq ($(call isTargetCpuBits, 64), true)
200     $(foreach v, $(JVM_VARIANTS), \
201       $(eval $(call CreateCDSArchive,$v,_nocoops)) \
202     )
203     ifeq ($(BUILD_CDS_ARCHIVE_COH), true)
204       $(foreach v, $(JVM_VARIANTS), \
205         $(eval $(call CreateCDSArchive,$v,_coh)) \
206       )
207       $(foreach v, $(JVM_VARIANTS), \
208         $(eval $(call CreateCDSArchive,$v,_nocoops_coh)) \
209       )
210     endif
211   endif
212 endif
213 
214 ################################################################################
215 # src.zip
216 
217 $(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
218 	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
219 	$(install-file)
220 
221 JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
222 
223 ################################################################################
224 # /demo dir
225 # Avoid doing the expensive find unless called with "jdk" as target.
226 ifneq ($(filter jdk, $(MAKECMDGOALS)), )
227 
228   DEMO_FILES := \
< prev index next >