blob: 492cf544ab54e5194a4dce6b23dc8a19687c1087 [file] [log] [blame]
ohair92de5662012-04-10 08:22:03 -07001#
2# Copyright (c) 2011, 2012, 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 $(SPEC)
27include MakeBase.gmk
28include JavaCompilation.gmk
29include Setup.gmk
30
erikje78df742012-06-07 20:40:50 -070031default: images
ohair92de5662012-04-10 08:22:03 -070032
erikj754c7442012-12-27 20:18:42 +010033# Prepare the find cache. Only used if running on windows.
34$(eval $(call FillCacheFind,\
35 $(wildcard $(JDK_OUTPUTDIR)/bin \
36 $(JDK_OUTPUTDIR)/lib \
37 $(IMAGES_OUTPUTDIR)/lib \
38 $(JDK_OUTPUTDIR)/include \
39 $(JDK_OUTPUTDIR)/sample \
40 $(JDK_OUTPUTDIR)/demo)))
41
ohair92de5662012-04-10 08:22:03 -070042include Tools.gmk
43
dholmes85dd5c82013-01-21 23:17:58 -050044include Profiles.gmk
45
ohair46fcac92012-09-18 11:29:24 -070046# Note: This double-colon rule is intentional, to support
47# custom make file integration.
48images:: jre-image jdk-image
49
50overlay-images: jre-overlay-image jdk-overlay-image
51
52
ohair92de5662012-04-10 08:22:03 -070053
ohair46fcac92012-09-18 11:29:24 -070054# Processing license files from source area to image area
55# These will be modified to have the platform specific EOL chars.
56define process-doc-file
ohairb71409c2012-10-26 14:23:29 -070057 $(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
ohair46fcac92012-09-18 11:29:24 -070058 $(MKDIR) -p $(@D)
59 $(RM) $@
erikj30ba14d2013-02-21 14:14:59 +010060 LC_ALL=C $(SED) 's/$$//g' $< > $@
ohair46fcac92012-09-18 11:29:24 -070061 $(CHMOD) 444 $@
62endef
63
ohairb71409c2012-10-26 14:23:29 -070064define AddFileToCopy
65 # Param 1 - src root dir
66 # Param 2 - dest root dir
67 # Param 3 - src file
68 # Param 4 - variable to add targets to
69
70 # Remove src dir root from src file
71 $2_$3_FILE := $$(patsubst $1/%,%,$3)
72
73 $2/$$($2_$3_FILE): $3
74 $(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
75 $$(install-file)
76
77 $4 += $2/$$($2_$3_FILE)
78endef
ohair46fcac92012-09-18 11:29:24 -070079
erikje78df742012-06-07 20:40:50 -070080################################################################################
81#
82# JRE and JDK build rules
83#
84################################################################################
ohair46fcac92012-09-18 11:29:24 -070085#
86# Variable prefixes explained:
dholmes85dd5c82013-01-21 23:17:58 -050087# JRE_ refers to files in the j2re-*-image.
ohair46fcac92012-09-18 11:29:24 -070088# JDK_ refers to files in the j2sdk-image outside of the jre subdir.
89# JDKJRE_ refers to files in the j2sdk-image inside the jre subdir.
90#
erikje78df742012-06-07 20:40:50 -070091
92################################################################################
93# /bin dir
94
dholmes85dd5c82013-01-21 23:17:58 -050095ifeq ($(PROFILE),)
96 NOT_JRE_BIN_FILES := \
erikje78df742012-06-07 20:40:50 -070097 appletviewer$(EXE_SUFFIX) \
98 extcheck$(EXE_SUFFIX) \
99 idlj$(EXE_SUFFIX) \
100 jar$(EXE_SUFFIX) \
101 jarsigner$(EXE_SUFFIX) \
102 java-rmi.cgi \
103 javac$(EXE_SUFFIX) \
104 javadoc$(EXE_SUFFIX) \
105 javah$(EXE_SUFFIX) \
106 javap$(EXE_SUFFIX) \
mchung98b6e502012-12-28 22:21:40 -0800107 jdeps$(EXE_SUFFIX) \
erikje78df742012-06-07 20:40:50 -0700108 jcmd$(EXE_SUFFIX) \
109 jdb$(EXE_SUFFIX) \
110 jps$(EXE_SUFFIX) \
111 jrunscript$(EXE_SUFFIX) \
112 jstat$(EXE_SUFFIX) \
113 jstatd$(EXE_SUFFIX) \
114 jstack$(EXE_SUFFIX) \
115 packagebean$(SCRIPT_SUFFIX) \
116 rmic$(EXE_SUFFIX) \
117 serialver$(EXE_SUFFIX) \
118 unregbean$(EXE_SUFFIX) \
119 jconsole$(EXE_SUFFIX) \
120 jinfo$(EXE_SUFFIX) \
121 jmap$(EXE_SUFFIX) \
122 native2ascii$(EXE_SUFFIX) \
123 xjc$(EXE_SUFFIX) \
124 wsgen$(EXE_SUFFIX) \
125 wsimport$(EXE_SUFFIX) \
126 schemagen$(EXE_SUFFIX) \
127 jsadebugd$(EXE_SUFFIX) \
128 jhat$(EXE_SUFFIX)
dholmes85dd5c82013-01-21 23:17:58 -0500129endif
erikje78df742012-06-07 20:40:50 -0700130
131WINDOWS_JDK_BIN_FILES = \
132 $(EXE_SUFFIX) \
ohair46fcac92012-09-18 11:29:24 -0700133 $(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
ohairb71409c2012-10-26 14:23:29 -0700134 $(notdir $(MSVCR_DLL))
ohair46fcac92012-09-18 11:29:24 -0700135
136WINDOWS_JDKJRE_BIN_FILES := \
137 $(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
138 $(SALIB_NAME)
erikje78df742012-06-07 20:40:50 -0700139
140# Find all files in bin dir
erikj754c7442012-12-27 20:18:42 +0100141ALL_BIN_LIST := $(call CacheFind,$(JDK_OUTPUTDIR)/bin)
erikjaf85fc42012-07-03 16:10:44 -0700142
ohairb71409c2012-10-26 14:23:29 -0700143# Prevent sjavac from entering the images.
144ALL_BIN_LIST := $(filter-out %/sjavac,$(ALL_BIN_LIST))
145
ohair46fcac92012-09-18 11:29:24 -0700146# For unknown reason the debuginfo files for executables are not put into images
erikjaf85fc42012-07-03 16:10:44 -0700147# e.g filter them out
ohair46fcac92012-09-18 11:29:24 -0700148ifneq ($(OPENJDK_TARGET_OS),windows)
149 ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
150else
151# On windows, the libraries are in the bin dir, only filter out debuginfo files
152# for executables. "java" is both a library and executable.
erikj754c7442012-12-27 20:18:42 +0100153 ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(filter %.exe,$(ALL_BIN_LIST))))
ohair46fcac92012-09-18 11:29:24 -0700154 ALL_BIN_DEBUG_FILTER := $(addprefix %,$(patsubst %.exe,%.debuginfo,$(ALL_BIN_EXEC_FILES)) \
155 $(patsubst %.exe,%.diz,$(ALL_BIN_EXEC_FILES))) %.pdb
156 ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER),$(ALL_BIN_LIST))
157endif
erikjaf85fc42012-07-03 16:10:44 -0700158
ohairb71409c2012-10-26 14:23:29 -0700159JDKJRE_BIN_LIST := $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST))
160JRE_BIN_LIST := $(filter-out $(addprefix %,$(WINDOWS_JDKJRE_BIN_FILES)), $(JDKJRE_BIN_LIST))
161
erikjaf85fc42012-07-03 16:10:44 -0700162ifeq ($(OPENJDK_TARGET_OS),windows)
erikje78df742012-06-07 20:40:50 -0700163 JDK_BIN_LIST := $(filter $(addprefix %,$(WINDOWS_JDK_BIN_FILES)), $(ALL_BIN_LIST))
ohairb71409c2012-10-26 14:23:29 -0700164 # On windows x86, the server jvm is filtered out from the j2re image. This could possibly
165 # be handled by profiles in the future. If no client jvm is built, leave server in.
166 ifeq ($(OPENJDK_TARGET_CPU),x86)
167 ifeq ($(JVM_VARIANT_CLIENT),true)
168 JRE_BIN_LIST := $(filter-out $(JDK_OUTPUTDIR)/bin/server/%,$(JRE_BIN_LIST))
169 endif
170 endif
erikje78df742012-06-07 20:40:50 -0700171else
172 JDK_BIN_LIST := $(ALL_BIN_LIST)
173endif
erikje78df742012-06-07 20:40:50 -0700174
ohair46fcac92012-09-18 11:29:24 -0700175ifneq ($(OPENJDK_TARGET_CPU_ISADIR),)
176 OVERLAY_FILTER := $(JDK_OUTPUTDIR)/bin$(OPENJDK_TARGET_CPU_ISADIR)%
177endif
178
ohairb71409c2012-10-26 14:23:29 -0700179$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JRE_BIN_LIST)),\
180 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_BIN_TARGETS)))
181$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JDK_BIN_LIST)),\
182 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_BIN_TARGETS)))
183$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)),\
184 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
ohair46fcac92012-09-18 11:29:24 -0700185
ohairb71409c2012-10-26 14:23:29 -0700186$(foreach f,$(filter $(OVERLAY_FILTER),$(JRE_BIN_LIST)),\
187 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_OVERLAY_IMAGE_DIR),$f,JRE_BIN_TARGETS)))
188$(foreach f,$(filter $(OVERLAY_FILTER),$(JDK_BIN_LIST)),\
189 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),$f,JDK_BIN_TARGETS)))
190$(foreach f,$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)),\
191 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
erikje78df742012-06-07 20:40:50 -0700192
193################################################################################
194# /lib dir
ohair46fcac92012-09-18 11:29:24 -0700195ifneq ($(OPENJDK_TARGET_OS), macosx)
196 JDKJRE_LIB_FILES := \
197 $(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
erikje78df742012-06-07 20:40:50 -0700198 $(SALIB_NAME)
ohair46fcac92012-09-18 11:29:24 -0700199endif
erikje78df742012-06-07 20:40:50 -0700200
dholmes85dd5c82013-01-21 23:17:58 -0500201ifeq ($(PROFILE),)
202 NOT_JRE_LIB_FILES := \
erikje78df742012-06-07 20:40:50 -0700203 tools.jar \
204 jconsole.jar \
205 sa-jdi.jar \
206 dt.jar \
207 orb.idl \
208 ir.idl \
209 ct.sym
210
dholmes85dd5c82013-01-21 23:17:58 -0500211 ifeq ($(OPENJDK_TARGET_OS), windows)
212 NOT_JRE_LIB_FILES += jawt.lib jvm.lib
213 endif
ohair46fcac92012-09-18 11:29:24 -0700214endif
215
erikje78df742012-06-07 20:40:50 -0700216JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
erikjaf85fc42012-07-03 16:10:44 -0700217ifeq ($(OPENJDK_TARGET_OS), linux)
erikje78df742012-06-07 20:40:50 -0700218 JDK_LIB_FILES += jexec
219endif
220
erikjecca4942013-07-03 10:14:02 +0200221ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris),) # If Linux or Solaris
222 JDK_LIB_FILES += $(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
223 $(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX)
224endif
225
ohairb71409c2012-10-26 14:23:29 -0700226# Find all files to copy from $(JDK_OUTPUTDIR)/lib
erikj62187db2012-12-05 10:12:57 +0100227# Jar files are not expected to be here
erikj754c7442012-12-27 20:18:42 +0100228ALL_JDKOUT_LIB_LIST := $(call not-containing,_the.,$(filter-out %.jar,\
229 $(call CacheFind,$(JDK_OUTPUTDIR)/lib)))
ohairb71409c2012-10-26 14:23:29 -0700230# Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
erikj62187db2012-12-05 10:12:57 +0100231# This is were the jar files are and might not exist if building overlay-images
ohairb71409c2012-10-26 14:23:29 -0700232ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
erikj754c7442012-12-27 20:18:42 +0100233 ALL_IMAGES_LIB_LIST := $(call not-containing,_the.,\
234 $(call CacheFind,$(IMAGES_OUTPUTDIR)/lib))
ohairb71409c2012-10-26 14:23:29 -0700235endif
erikje78df742012-06-07 20:40:50 -0700236
ohairb71409c2012-10-26 14:23:29 -0700237# Filter files to copy for each destination
238JRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
239 $(ALL_JDKOUT_LIB_LIST))
240JDKJRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES)),$(ALL_JDKOUT_LIB_LIST))
241JDK_JDKOUT_LIB_LIST := $(filter $(addprefix %,$(JDK_LIB_FILES)),$(ALL_JDKOUT_LIB_LIST))
erikje78df742012-06-07 20:40:50 -0700242
ohairb71409c2012-10-26 14:23:29 -0700243JRE_IMAGES_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
244 $(ALL_IMAGES_LIB_LIST))
245JDKJRE_IMAGES_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES)),$(ALL_IMAGES_LIB_LIST))
246JDK_IMAGES_LIB_LIST := $(filter $(addprefix %,$(JDK_LIB_FILES)),$(ALL_IMAGES_LIB_LIST))
247
248# Iterate over files to copy to create rules for each one
249$(foreach f,$(JRE_JDKOUT_LIB_LIST),\
250 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_LIB_TARGETS)))
251$(foreach f,$(JDK_JDKOUT_LIB_LIST),\
252 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_LIB_TARGETS)))
253$(foreach f,$(JDKJRE_JDKOUT_LIB_LIST),\
254 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_LIB_TARGETS)))
255
256$(foreach f,$(JRE_IMAGES_LIB_LIST),\
257 $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_LIB_TARGETS)))
258$(foreach f,$(JDK_IMAGES_LIB_LIST),\
259 $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_LIB_TARGETS)))
260$(foreach f,$(JDKJRE_IMAGES_LIB_LIST),\
261 $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_LIB_TARGETS)))
262
263$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JRE_JDKOUT_LIB_LIST)),\
264 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_OVERLAY_IMAGE_DIR),$f,JRE_OVERLAY_LIB_TARGETS)))
265$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDK_JDKOUT_LIB_LIST)),\
266 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),$f,JDK_OVERLAY_LIB_TARGETS)))
267$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDKJRE_JDKOUT_LIB_LIST)),\
268 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_OVERLAY_LIB_TARGETS)))
ohair46fcac92012-09-18 11:29:24 -0700269
erikj0f09cdf2013-03-12 15:17:19 +0100270ifneq ($(PROFILE),)
271# Files in lib$(PROFILE) are excluded from the generic copying routines so
272# we have to add them back in here
273$(foreach f,$(CUSTOM_PROFILE_JARS),\
274 $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR)/lib$(PROFILE),$(JRE_IMAGE_DIR)/lib,$f,JRE_LIB_TARGETS)))
275endif
276
erikje78df742012-06-07 20:40:50 -0700277# CTE plugin security change require new empty directory lib/applet
278$(JRE_IMAGE_DIR)/lib/applet:
ohairb71409c2012-10-26 14:23:29 -0700279 $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700280 $(MKDIR) -p $@
281
282$(JDK_IMAGE_DIR)/jre/lib/applet:
ohairb71409c2012-10-26 14:23:29 -0700283 $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700284 $(MKDIR) -p $@
285
ohair46fcac92012-09-18 11:29:24 -0700286# In the old build, JObjC.jar is not part of the meta-index
erikje78df742012-06-07 20:40:50 -0700287$(JRE_IMAGE_DIR)/lib/meta-index: $(JRE_LIB_TARGETS)
ohairb71409c2012-10-26 14:23:29 -0700288 $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
ohair46fcac92012-09-18 11:29:24 -0700289 $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index `$(LS) *.jar | $(SED) 's/JObjC\.jar//g'`
erikje78df742012-06-07 20:40:50 -0700290
291$(JDK_IMAGE_DIR)/jre/lib/meta-index: $(JDKJRE_LIB_TARGETS)
ohairb71409c2012-10-26 14:23:29 -0700292 $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
ohair46fcac92012-09-18 11:29:24 -0700293 $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index `$(LS) *.jar | $(SED) 's/JObjC\.jar//g'`
erikje78df742012-06-07 20:40:50 -0700294
295$(JRE_IMAGE_DIR)/lib/ext/meta-index: $(JRE_LIB_TARGETS)
ohairb71409c2012-10-26 14:23:29 -0700296 $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700297 $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
298
ohair46fcac92012-09-18 11:29:24 -0700299$(JDK_IMAGE_DIR)/jre/lib/ext/meta-index: $(JDKJRE_LIB_TARGETS)
ohairb71409c2012-10-26 14:23:29 -0700300 $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700301 $(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
302
303################################################################################
304# /man dir
ohairb71409c2012-10-26 14:23:29 -0700305# Avoid evaluating this whole section on windows for speed and stability
306ifneq ($(OPENJDK_TARGET_OS),windows)
307 JRE_MAN_PAGES := \
erikje78df742012-06-07 20:40:50 -0700308 java.1 \
309 keytool.1 \
310 orbd.1 \
311 pack200.1 \
312 policytool.1 \
313 rmid.1 \
314 rmiregistry.1 \
315 servertool.1 \
316 tnameserv.1 \
317 unpack200.1
318
ohairb71409c2012-10-26 14:23:29 -0700319 ifndef OPENJDK
320 JRE_MAN_PAGES += javaws.1
321 endif
erikje78df742012-06-07 20:40:50 -0700322
ohairb71409c2012-10-26 14:23:29 -0700323 JDK_MAN_PAGES = \
erikje78df742012-06-07 20:40:50 -0700324 $(JRE_MAN_PAGES) \
325 appletviewer.1 \
326 extcheck.1 \
327 idlj.1 \
328 jar.1 \
329 jarsigner.1 \
330 javac.1 \
331 javadoc.1 \
332 javah.1 \
333 javap.1 \
334 jconsole.1 \
335 jcmd.1 \
336 jdb.1 \
337 jhat.1 \
338 jinfo.1 \
339 jmap.1 \
340 jps.1 \
341 jrunscript.1 \
342 jsadebugd.1 \
343 jstack.1 \
344 jstat.1 \
345 jstatd.1 \
erikje78df742012-06-07 20:40:50 -0700346 native2ascii.1 \
347 rmic.1 \
348 schemagen.1 \
349 serialver.1 \
350 wsgen.1 \
351 wsimport.1 \
352 xjc.1
353
ohairb71409c2012-10-26 14:23:29 -0700354 ifndef OPENJDK
355 JDK_MAN_PAGES += jvisualvm.1
356 endif
andrew5aaf3532012-08-23 15:42:23 +0100357
erikj2764f572013-05-22 10:31:39 +0200358 # This variable is potentially overridden in the closed makefile.
359 MAN_SRC_BASEDIR ?= $(JDK_TOPDIR)/src
erikjbbedad72013-05-02 15:59:32 +0200360
ohairb71409c2012-10-26 14:23:29 -0700361 ifeq ($(OPENJDK_TARGET_OS), linux)
erikjbbedad72013-05-02 15:59:32 +0200362 MAN_SRC_DIR:=$(MAN_SRC_BASEDIR)/linux/doc
ohairb71409c2012-10-26 14:23:29 -0700363 MAN1_SUBDIR:=man
364 endif
365 ifeq ($(OPENJDK_TARGET_OS), solaris)
erikjbbedad72013-05-02 15:59:32 +0200366 MAN_SRC_DIR:=$(MAN_SRC_BASEDIR)/solaris/doc
ohairb71409c2012-10-26 14:23:29 -0700367 MAN1_SUBDIR:=sun/man/man1
368 endif
369 ifeq ($(OPENJDK_TARGET_OS), macosx)
erikjbbedad72013-05-02 15:59:32 +0200370 MAN_SRC_DIR:=$(MAN_SRC_BASEDIR)/bsd/doc
ohairb71409c2012-10-26 14:23:29 -0700371 MAN1_SUBDIR:=man
372 JDK_MAN_PAGES := $(filter-out jcmd.1, $(JDK_MAN_PAGES))
373 JDK_MAN_PAGES := $(filter-out jvisualvm.1, $(JDK_MAN_PAGES))
374 endif
erikjaf85fc42012-07-03 16:10:44 -0700375
erikje78df742012-06-07 20:40:50 -0700376
ohairb71409c2012-10-26 14:23:29 -0700377 $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
378 $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700379 $(install-file)
380
ohairb71409c2012-10-26 14:23:29 -0700381 $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
382 $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700383 $(install-file)
384
ohairb71409c2012-10-26 14:23:29 -0700385 $(JRE_IMAGE_DIR)/man/man1/%: $(JDK_OUTPUTDIR)/impdoc/$(MAN1_SUBDIR)/%
386 $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700387 $(install-file)
388
ohairb71409c2012-10-26 14:23:29 -0700389 $(JDK_IMAGE_DIR)/man/man1/%: $(JDK_OUTPUTDIR)/impdoc/$(MAN1_SUBDIR)/%
390 $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700391 $(install-file)
392
ohairb71409c2012-10-26 14:23:29 -0700393 define install-ja-manpage
erikje78df742012-06-07 20:40:50 -0700394 $(MKDIR) -p $(@D)
395 $(CAT) $< \
396 | $(NATIVE2ASCII) -encoding eucJP \
397 | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
398 | $(NATIVE2ASCII) -reverse -encoding $1 \
399 > $@
ohairb71409c2012-10-26 14:23:29 -0700400 endef
erikje78df742012-06-07 20:40:50 -0700401
ohairb71409c2012-10-26 14:23:29 -0700402 $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
403 $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700404 $(call install-ja-manpage,UTF-8)
405
ohairb71409c2012-10-26 14:23:29 -0700406 $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
407 $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700408 $(call install-ja-manpage,UTF-8)
409
ohairb71409c2012-10-26 14:23:29 -0700410 $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
411 $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700412 $(call install-ja-manpage,PCK)
413
ohairb71409c2012-10-26 14:23:29 -0700414 $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
415 $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700416 $(call install-ja-manpage,PCK)
417
ohairb71409c2012-10-26 14:23:29 -0700418 ifeq ($(OPENJDK_TARGET_OS), solaris)
419 $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
420 $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
421 $(install-file)
erikje78df742012-06-07 20:40:50 -0700422
ohairb71409c2012-10-26 14:23:29 -0700423 $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
424 $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
425 $(install-file)
426 endif
erikje78df742012-06-07 20:40:50 -0700427
ohairb71409c2012-10-26 14:23:29 -0700428 # Old build creates empty man page for this, mimicing behaviour.
429 $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/jcmd.1 $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/jcmd.1 $(JDK_IMAGE_DIR)/man/ja/man1/jcmd.1:
430 $(ECHO) $(LOG_INFO) Creating dummy $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700431 $(MKDIR) -p $(@D)
ohair92de5662012-04-10 08:22:03 -0700432 $(TOUCH) $@
433
ohairb71409c2012-10-26 14:23:29 -0700434 ifeq ($(OPENJDK_TARGET_OS), linux)
435 $(JRE_IMAGE_DIR)/man/ja:
436 $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
437 $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
erikje78df742012-06-07 20:40:50 -0700438
ohairb71409c2012-10-26 14:23:29 -0700439 $(JDK_IMAGE_DIR)/man/ja:
440 $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
441 $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
442 endif
erikje78df742012-06-07 20:40:50 -0700443
ohairb71409c2012-10-26 14:23:29 -0700444 ifeq ($(OPENJDK_TARGET_OS), macosx)
445 $(JRE_IMAGE_DIR)/man/ja:
446 $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
447 $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
erikjaf85fc42012-07-03 16:10:44 -0700448
ohairb71409c2012-10-26 14:23:29 -0700449 $(JDK_IMAGE_DIR)/man/ja:
450 $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
451 $(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
452 endif
erikjaf85fc42012-07-03 16:10:44 -0700453
ohairb71409c2012-10-26 14:23:29 -0700454 ifeq ($(OPENJDK_TARGET_OS), linux)
455 JRE_MAN_PAGE_LIST := $(addprefix $(JRE_IMAGE_DIR)/man/man1/,$(JRE_MAN_PAGES)) \
456 $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/,$(JRE_MAN_PAGES)) \
457 $(JRE_IMAGE_DIR)/man/ja
erikje78df742012-06-07 20:40:50 -0700458
ohairb71409c2012-10-26 14:23:29 -0700459 JDK_MAN_PAGE_LIST := $(addprefix $(JDK_IMAGE_DIR)/man/man1/,$(JDK_MAN_PAGES)) \
460 $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/,$(JDK_MAN_PAGES)) \
461 $(JDK_IMAGE_DIR)/man/ja
462 endif
erikje78df742012-06-07 20:40:50 -0700463
ohairb71409c2012-10-26 14:23:29 -0700464 ifeq ($(OPENJDK_TARGET_OS), solaris)
465 JRE_MAN_PAGE_LIST := $(addprefix $(JRE_IMAGE_DIR)/man/man1/,$(JRE_MAN_PAGES)) \
466 $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/,$(JRE_MAN_PAGES)) \
467 $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/,$(JRE_MAN_PAGES)) \
468 $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/,$(JRE_MAN_PAGES))
erikje78df742012-06-07 20:40:50 -0700469
ohairb71409c2012-10-26 14:23:29 -0700470 JDK_MAN_PAGE_LIST := $(addprefix $(JDK_IMAGE_DIR)/man/man1/,$(JDK_MAN_PAGES)) \
471 $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/,$(JDK_MAN_PAGES)) \
472 $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/,$(JDK_MAN_PAGES)) \
473 $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/,$(JDK_MAN_PAGES))
474 endif
erikje78df742012-06-07 20:40:50 -0700475
ohairb71409c2012-10-26 14:23:29 -0700476 ifeq ($(OPENJDK_TARGET_OS), macosx)
477 JRE_MAN_PAGE_LIST := $(addprefix $(JRE_IMAGE_DIR)/man/man1/,$(JRE_MAN_PAGES)) \
478 $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/,$(JRE_MAN_PAGES)) \
479 $(JRE_IMAGE_DIR)/man/ja
erikjaf85fc42012-07-03 16:10:44 -0700480
ohairb71409c2012-10-26 14:23:29 -0700481 JDK_MAN_PAGE_LIST := $(addprefix $(JDK_IMAGE_DIR)/man/man1/,$(JDK_MAN_PAGES)) \
482 $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/,$(JDK_MAN_PAGES)) \
483 $(JDK_IMAGE_DIR)/man/ja
484 endif
485
486endif # Windows
erikjaf85fc42012-07-03 16:10:44 -0700487
erikje78df742012-06-07 20:40:50 -0700488################################################################################
489# /demo dir
490
ohair46fcac92012-09-18 11:29:24 -0700491# FIXME: demo/applets/GraphLayout/GraphPanel$2.class is sometimes not copied.
erikje78df742012-06-07 20:40:50 -0700492
493# The db demo contains an empty dir that needs to be copied. The other
494# directories will always trigger the rule for recompile since
495# _the.list_of_packages files are touched.
ohairb71409c2012-10-26 14:23:29 -0700496$(JDK_IMAGE_DIR)/demo/%: $(JDK_OUTPUTDIR)/demo/%
erikje78df742012-06-07 20:40:50 -0700497 if [ ! -d "$@" ]; then \
ohairb71409c2012-10-26 14:23:29 -0700498 $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
erikje78df742012-06-07 20:40:50 -0700499 $(MKDIR) -p $(@D); \
500 if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
501 fi
502
503# Find all files including directories
ohairb71409c2012-10-26 14:23:29 -0700504JDK_DEMO_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/demo/%,$(JDK_IMAGE_DIR)/demo/%,\
ohair46fcac92012-09-18 11:29:24 -0700505 $(shell $(FIND) $(JDK_OUTPUTDIR)/demo ! \( -name "_the*" -o -name "javac_state" \) ))
506
507
508
ohairb71409c2012-10-26 14:23:29 -0700509# Param 1 is source file
510define CreateOverlayDemoRule
511 $1_TARGET:=$$(subst $(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),\
ohair46fcac92012-09-18 11:29:24 -0700512 $$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1))
ohairb71409c2012-10-26 14:23:29 -0700513 $$($1_TARGET): $1
514 $(ECHO) $(LOG_INFO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
515 $$(call install-file)
ohair46fcac92012-09-18 11:29:24 -0700516
ohairb71409c2012-10-26 14:23:29 -0700517 JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
518endef
erikj754c7442012-12-27 20:18:42 +0100519JDK_OVERLAY_DEMO_SOURCES := $(filter %$(SHARED_LIBRARY_SUFFIX),$(call CacheFind,$(JDK_OUTPUTDIR)/demo))
ohairb71409c2012-10-26 14:23:29 -0700520$(foreach lib,$(JDK_OVERLAY_DEMO_SOURCES),$(eval $(call CreateOverlayDemoRule,$(lib))))
erikje78df742012-06-07 20:40:50 -0700521
522################################################################################
523# /sample dir
524
erikj754c7442012-12-27 20:18:42 +0100525$(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/sample),\
ohairb71409c2012-10-26 14:23:29 -0700526 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_SAMPLE_TARGETS)))
erikje78df742012-06-07 20:40:50 -0700527
528################################################################################
529# /db dir
530
531ifndef OPENJDK
532 $(IMAGES_OUTPUTDIR)/_unzip/%.unzipped: $(JDK_TOPDIR)/src/closed/share/db/%
533 $(ECHO) Unzipping $(patsubst $(SRC_ROOT)/%,%,$<)
534 $(MKDIR) -p $(JDK_IMAGE_DIR)/db
dwanvik6c8f5992013-05-06 05:51:01 +0200535 cd $(JDK_IMAGE_DIR)/db && $(UNZIP) -q -o $< -x */index.html */KEYS */test/* *javadoc/* */docs/* */demo/* 2> /dev/null
536 cd $(JDK_IMAGE_DIR)/db && $(MV) db-derby-*-bin/* . && $(RM) -r db-derby-*-bin
erikje78df742012-06-07 20:40:50 -0700537 $(MKDIR) -p $(@D)
538 $(TOUCH) $@
539
540 $(JDK_IMAGE_DIR)/db/README-JDK.html: $(JDK_TOPDIR)/src/closed/share/db/README-JDK.html
ohairb71409c2012-10-26 14:23:29 -0700541 $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
dwanvik6c8f5992013-05-06 05:51:01 +0200542 $(CAT) $< | $(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > $@
543
544 $(JDK_IMAGE_DIR)/db/3RDPARTY: $(JDK_TOPDIR)/src/closed/share/db/3RDPARTY
545 $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
546 $(CAT) $< | $(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > $@
erikje78df742012-06-07 20:40:50 -0700547
548 JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%,$(IMAGES_OUTPUTDIR)/_unzip/%.unzipped,\
dwanvik6c8f5992013-05-06 05:51:01 +0200549 $(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip)) \
550 $(JDK_IMAGE_DIR)/db/README-JDK.html $(JDK_IMAGE_DIR)/db/3RDPARTY
erikje78df742012-06-07 20:40:50 -0700551
552endif
553
554################################################################################
555# /include dir
556
erikj754c7442012-12-27 20:18:42 +0100557$(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/include),\
ohairb71409c2012-10-26 14:23:29 -0700558 $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_INCLUDE_TARGETS)))
erikje78df742012-06-07 20:40:50 -0700559
560################################################################################
561# doc files
562
563ifdef OPENJDK
564 JRE_DOC_FILES := LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
565 JDK_DOC_FILES := LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
566 JRE_DOC_LOCATION := $(JDK_TOPDIR)
567 JDK_DOC_LOCATION := $(JDK_TOPDIR)
568else
569 JRE_DOC_FILES := COPYRIGHT Welcome.html LICENSE THIRDPARTYLICENSEREADME.txt
570 JDK_DOC_FILES := COPYRIGHT README.html LICENSE THIRDPARTYLICENSEREADME.txt
erikjaf85fc42012-07-03 16:10:44 -0700571 ifeq ($(OPENJDK_TARGET_OS), windows)
erikje78df742012-06-07 20:40:50 -0700572 JRE_DOC_FILES += README.txt
573 else
574 JRE_DOC_FILES += README
575 endif
ohairb71409c2012-10-26 14:23:29 -0700576 JDK_DOC_FILES += demo/DEMOS_LICENSE sample/SAMPLES_LICENSE
erikje78df742012-06-07 20:40:50 -0700577 JRE_DOC_LOCATION := $(JDK_TOPDIR)/src/closed/share/doc/jre
578 JDK_DOC_LOCATION := $(JDK_TOPDIR)/src/closed/share/doc/jdk
579endif
580JRE_DOC_TARGETS := $(addprefix $(JRE_IMAGE_DIR)/,$(JRE_DOC_FILES))
581JDKJRE_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/jre/,$(JRE_DOC_FILES))
582JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/,$(JDK_DOC_FILES))
583
584$(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
ohair46fcac92012-09-18 11:29:24 -0700585 $(process-doc-file)
erikje78df742012-06-07 20:40:50 -0700586
587$(JDK_IMAGE_DIR)/jre/%: $(JRE_DOC_LOCATION)/%
ohair46fcac92012-09-18 11:29:24 -0700588 $(process-doc-file)
erikje78df742012-06-07 20:40:50 -0700589
590$(JRE_IMAGE_DIR)/README.txt: $(JRE_DOC_LOCATION)/README
ohair46fcac92012-09-18 11:29:24 -0700591 $(process-doc-file)
erikje78df742012-06-07 20:40:50 -0700592
593$(JDK_IMAGE_DIR)/jre/README.txt: $(JRE_DOC_LOCATION)/README
ohair46fcac92012-09-18 11:29:24 -0700594 $(process-doc-file)
erikje78df742012-06-07 20:40:50 -0700595
596$(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
ohair46fcac92012-09-18 11:29:24 -0700597 $(process-doc-file)
erikje78df742012-06-07 20:40:50 -0700598
599$(JDK_IMAGE_DIR)/demo/%: $(JDK_DOC_LOCATION)/%
ohair46fcac92012-09-18 11:29:24 -0700600 $(process-doc-file)
erikje78df742012-06-07 20:40:50 -0700601
602$(JDK_IMAGE_DIR)/sample/%: $(JDK_DOC_LOCATION)/%
ohair46fcac92012-09-18 11:29:24 -0700603 $(process-doc-file)
erikje78df742012-06-07 20:40:50 -0700604
605JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
606JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
607
ohair46fcac92012-09-18 11:29:24 -0700608JRE_OVERLAY_INFO_FILE := $(JRE_OVERLAY_IMAGE_DIR)/release
609JDK_OVERLAY_INFO_FILE := $(JDK_OVERLAY_IMAGE_DIR)/release
610
erikje78df742012-06-07 20:40:50 -0700611# Common way to emit a line into the release or info file
612define info-file-item # name value
613$(PRINTF) '%s="%s"\n' $1 $2 >> $@
614endef
615
ohair46fcac92012-09-18 11:29:24 -0700616define create-info-file
617 $(MKDIR) -p $(@D)
618 $(RM) $@
619 $(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
620 $(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
621 $(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
622 $(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
vladidanea7d6a42013-02-22 17:12:35 -0500623 if [ -n "$(JDK_ARCH_ABI_PROP_NAME)" ]; then $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"); fi
ohair46fcac92012-09-18 11:29:24 -0700624 $(call info-file-item, "SOURCE", "$(ALL_SOURCE_TIPS)")
625endef
626
erikje78df742012-06-07 20:40:50 -0700627ALL_SOURCE_TIPS = $(shell \
628 if [ -f $(OUTPUT_ROOT)/source_tips ] ; then \
629 $(CAT) $(OUTPUT_ROOT)/source_tips ; \
630 fi)
631
632$(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
ohairb71409c2012-10-26 14:23:29 -0700633 $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
ohair46fcac92012-09-18 11:29:24 -0700634 $(call create-info-file)
dholmes85dd5c82013-01-21 23:17:58 -0500635ifneq ($(PROFILE),)
636 $(call info-file-item, "JAVA_PROFILE", "$(call profile_name, $(call profile_number, $(PROFILE)))")
637endif
erikje78df742012-06-07 20:40:50 -0700638
639$(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
ohairb71409c2012-10-26 14:23:29 -0700640 $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
ohair46fcac92012-09-18 11:29:24 -0700641 $(call create-info-file)
642
643$(JRE_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
ohairb71409c2012-10-26 14:23:29 -0700644 $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
ohair46fcac92012-09-18 11:29:24 -0700645 $(call create-info-file)
646
647$(JDK_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
ohairb71409c2012-10-26 14:23:29 -0700648 $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
ohair46fcac92012-09-18 11:29:24 -0700649 $(call create-info-file)
erikje78df742012-06-07 20:40:50 -0700650
651$(JDK_IMAGE_DIR)/src.zip: $(IMAGES_OUTPUTDIR)/src.zip
ohairb71409c2012-10-26 14:23:29 -0700652 $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
erikje78df742012-06-07 20:40:50 -0700653 $(install-file)
654
655################################################################################
656# Post processing (strip etc)
657
658ifneq ($(POST_STRIP_CMD),)
erikjaf85fc42012-07-03 16:10:44 -0700659 ifeq ($(OPENJDK_TARGET_OS), windows)
erikj754c7442012-12-27 20:18:42 +0100660 EXEC_LIST_BIN:=$(filter-out %$(notdir $(MSVCR_DLL)),$(filter %.exe %.dll,$(ALL_BIN_LIST)))
erikje78df742012-06-07 20:40:50 -0700661 else
662 # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
erikj317dc4e2013-03-28 09:36:43 +0100663 EXEC_LIST_BIN:=$(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX) ! -name \*.debuginfo` \
erikje78df742012-06-07 20:40:50 -0700664 | $(EGREP) 'ELF' | $(CUT) -d':' -f1)
ohair46fcac92012-09-18 11:29:24 -0700665 # On mac, the old build searches for static libraries for stripping instead of shared.
666 # Not clear if it's intentional.
667 ifneq ($(OPENJDK_TARGET_OS), macosx)
668 EXEC_LIST_LIB:=$(shell $(FIND) $(JDK_OUTPUTDIR)/lib -type f -name \*$(SHARED_LIBRARY_SUFFIX))
669 endif
erikje78df742012-06-07 20:40:50 -0700670 endif
ohairb71409c2012-10-26 14:23:29 -0700671 # Filter out sjavac
672 EXEC_LIST_BIN:=$(filter-out %sjavac$(EXE_SUFFIX),$(EXEC_LIST_BIN))
erikje78df742012-06-07 20:40:50 -0700673
ohair46fcac92012-09-18 11:29:24 -0700674 # Filter out the overlay specific bin files
675 EXEC_LIST:=$(filter-out $(OVERLAY_FILTER),$(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
676 EXEC_LIST_OVERLAY:=$(filter $(OVERLAY_FILTER),$(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
677
678 # Filter out non JRE files and convert to unique touch files to depend on
dholmes85dd5c82013-01-21 23:17:58 -0500679 JRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped,\
ohair46fcac92012-09-18 11:29:24 -0700680 $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
681 $(EXEC_LIST)))
682
683 JDKJRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
erikjaf85fc42012-07-03 16:10:44 -0700684 $(IMAGES_OUTPUTDIR)/_strip_jdk/jre/%.stripped, \
685 $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST)))
686
ohair46fcac92012-09-18 11:29:24 -0700687 JDK_BIN_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
erikjaf85fc42012-07-03 16:10:44 -0700688 $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped, \
689 $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST)))
690
ohair46fcac92012-09-18 11:29:24 -0700691 # Do the same for overlay image
692 JRE_OVERLAY_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped,\
693 $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
694 $(EXEC_LIST_OVERLAY)))
695
696 JDKJRE_OVERLAY_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
697 $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/jre/%.stripped, \
698 $(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST_OVERLAY)))
699
700 JDK_OVERLAY_BIN_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%, \
701 $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped, \
702 $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST_OVERLAY)))
703
704 define mcs-file
705 $(if $(POST_MCS_CMD),$(POST_MCS_CMD) $<)
706 endef
707
708 define strip-file
ohairb71409c2012-10-26 14:23:29 -0700709 $(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
ohair46fcac92012-09-18 11:29:24 -0700710 $(CHMOD) u+w $<
711 $(POST_STRIP_CMD) $<
712 $(call mcs-file)
713 $(CHMOD) go-w $<
714 $(MKDIR) -p $(@D)
715 $(TOUCH) $@
716 endef
717
erikje78df742012-06-07 20:40:50 -0700718 # Setup a rule for stripping files based on touch files
dholmes85dd5c82013-01-21 23:17:58 -0500719 $(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped: $(JRE_IMAGE_DIR)/%
ohair46fcac92012-09-18 11:29:24 -0700720 $(call strip-file)
erikjaf85fc42012-07-03 16:10:44 -0700721
ohair46fcac92012-09-18 11:29:24 -0700722 $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped: $(JDK_IMAGE_DIR)/%
723 $(call strip-file)
erikjaf85fc42012-07-03 16:10:44 -0700724
ohair46fcac92012-09-18 11:29:24 -0700725 $(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped: $(JRE_OVERLAY_IMAGE_DIR)/%
726 $(call strip-file)
727
728 $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped: $(JDK_OVERLAY_IMAGE_DIR)/%
729 $(call strip-file)
erikjaf85fc42012-07-03 16:10:44 -0700730
erikje78df742012-06-07 20:40:50 -0700731endif
732
733################################################################################
734# Main targets
735
736jre-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) $(JRE_IMAGE_DIR)/lib/applet \
737 $(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
ohair46fcac92012-09-18 11:29:24 -0700738 $(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST)
erikje78df742012-06-07 20:40:50 -0700739
740jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \
741 $(JDK_LIB_TARGETS) $(JDKJRE_LIB_TARGETS) \
742 $(JDK_IMAGE_DIR)/jre/lib/applet \
743 $(JDK_DEMO_TARGETS) \
744 $(JDK_IMAGE_DIR)/jre/lib/meta-index $(JDK_IMAGE_DIR)/jre/lib/ext/meta-index \
745 $(JDK_MAN_PAGE_LIST) $(JDK_SAMPLE_TARGETS) \
746 $(JDK_DB_TARGETS) $(JDK_INCLUDE_TARGETS) \
747 $(JDKJRE_DOC_TARGETS) $(JDK_DOC_TARGETS) \
ohair46fcac92012-09-18 11:29:24 -0700748 $(JDK_INFO_FILE) $(JDKJRE_STRIP_LIST) $(JDK_BIN_STRIP_LIST) \
erikjaf85fc42012-07-03 16:10:44 -0700749 $(JDK_IMAGE_DIR)/src.zip
erikje78df742012-06-07 20:40:50 -0700750
ohair46fcac92012-09-18 11:29:24 -0700751jre-overlay-image: $(JRE_OVERLAY_BIN_TARGETS) $(JRE_OVERLAY_LIB_TARGETS) \
752 $(JRE_OVERLAY_INFO_FILE) $(JRE_OVERLAY_STRIP_LIST)
753
754jdk-overlay-image: $(JDK_OVERLAY_BIN_TARGETS) $(JDKJRE_OVERLAY_BIN_TARGETS) \
755 $(JDK_OVERLAY_LIB_TARGETS) $(JDKJRE_OVERLAY_LIB_TARGETS) \
756 $(JDK_OVERLAY_DEMO_TARGETS) $(JDK_OVERLAY_INFO_FILE) \
757 $(JDKJRE_OVERLAY_STRIP_LIST) $(JDK_OVERLAY_BIN_STRIP_LIST)
758
dholmes85dd5c82013-01-21 23:17:58 -0500759ifneq ($(PROFILE),)
alanb95225a52013-02-19 11:08:43 +0000760PROFILE_IMAGE_JARS := $(filter %.jar, $(JRE_LIB_TARGETS))
761
762PROFILE_IMAGE_JARS_CHECKED := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_jars_checked
763
764$(PROFILE_IMAGE_JARS_CHECKED) : $(PROFILE_IMAGE_JARS)
765 $(TOOL_CHECKDEPS) $(JRE_IMAGE_DIR) \
766 $(call profile_name, $(call profile_number, $(PROFILE)))
767 $(TOUCH) $@
768
dholmes85dd5c82013-01-21 23:17:58 -0500769profile-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) \
770 $(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
alanb95225a52013-02-19 11:08:43 +0000771 $(JRE_INFO_FILE) $(JRE_STRIP_LIST) $(PROFILE_IMAGE_JARS_CHECKED)
dholmes85dd5c82013-01-21 23:17:58 -0500772
773.PHONY: profile-image
774
775endif # Profile
776
erikje78df742012-06-07 20:40:50 -0700777################################################################################
778
779.PHONY: default images jre-image jdk-image
katleman153d5452013-06-04 14:11:50 -0700780
781-include $(CUSTOM_MAKE_DIR)/Images.gmk