blob: 832cd62f1d6710c5f43442699e774d90169d5f8b [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001#
2# Copyright 1997-2007 Sun Microsystems, Inc. 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. Sun designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22# CA 95054 USA or visit www.sun.com if you need additional information or
23# have any questions.
24#
25
26#
27# Imports files exported by a hotspot build or provided from an external
28# location into the OUTPUTDIR, and also primes the OUTPUTDIR with files
29# that are provided inside this workspace.
30#
31# IMPORT_LIST contains the list of destination files that are copied
32# from external places (outside this workspace).
33#
34# INTERNAL_IMPORT_LIST is the list of destination files from BUILDDIR.
35#
36
37BUILDDIR = ../..
38PRODUCT = java
39include $(BUILDDIR)/common/Defs.gmk
40
41SERVER_LOCATION = server
42CLIENT_LOCATION = client
43
44DB_SUFFIX = _db
45
46ifeq ($(PLATFORM), windows)
47 LIB_LOCATION = $(BINDIR)
48else
49 LIB_LOCATION = $(LIBDIR)/$(LIBARCH)
50endif
51
52JVM_NAME = $(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX)
53JVMLIB_NAME = $(LIB_PREFIX)jvm.$(LIB_SUFFIX)
54JVMMAP_NAME = $(LIB_PREFIX)jvm.map
55JVMPDB_NAME = $(LIB_PREFIX)jvm.pdb
56LIBJSIG_NAME = $(LIB_PREFIX)jsig.$(LIBRARY_SUFFIX)
57JVMDB_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).$(LIBRARY_SUFFIX)
58
59CLASSSHARINGDATA_DIR = $(BUILDDIR)/tools/sharing
60
61# Needed to do file copy
62ABS_BUILDDIR :=$(call FullPath,$(BUILDDIR))
63
64all: build
65
66# List of files created here or coming from BUILDDIR area (this workspace)
67INTERNAL_IMPORT_LIST = $(LIBDIR)/classlist
68
69# List of files coming from outside this workspace
70IMPORT_LIST = $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME) \
71 $(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt
72
73# INCLUDE_SA is false on platforms where SA is not supported.
74# On platforms where it is supported, we want to allow it to
75# not be present, at least temporarily. So,
76# if the SA files (well, just sa-jdi.jar) do not exist
77# in the HOTSPOT_IMPORT_PATH, then we won't build SA.
78SA_EXISTS := $(shell if [ -r $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \
79 $(ECHO) true; \
80 else \
81 $(ECHO) false; \
82 fi)
83
84ifeq ($(SA_EXISTS), false)
85 INCLUDE_SA := false
86endif
87
88ifeq ($(INCLUDE_SA), true)
89 IMPORT_LIST += $(LIBDIR)/sa-jdi.jar \
90 $(LIB_LOCATION)/$(SALIB_NAME)
91 ifeq ($(PLATFORM), windows)
92 IMPORT_LIST += $(LIB_LOCATION)/$(SAMAP_NAME) \
93 $(LIB_LOCATION)/$(SAPDB_NAME)
94 endif
95endif # INCLUDE_SA
96
97# Hotspot client is only available on 32-bit builds
98ifeq ($(ARCH_DATA_MODEL), 32)
99 IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME) \
100 $(LIB_LOCATION)/$(CLIENT_LOCATION)/Xusage.txt
101endif
102
103ifeq ($(PLATFORM), windows)
104# Windows vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Windows
105
106IMPORT_LIST += $(MS_RUNTIME_LIBRARIES:%=$(BINDIR)/%)
107
108# NOTE: These might actually come from BUILDDIR, depends on the settings.
109$(BINDIR)/msvcrt.dll: $(MSVCRT_DLL_PATH)/msvcrt.dll
110 $(install-import-file)
111 $(CHMOD) a+x $@
112$(BINDIR)/msvcr71.dll: $(MSVCR71_DLL_PATH)/msvcr71.dll
113 $(install-import-file)
114 $(CHMOD) a+x $@
115
116# Get the hotspot .map and .pdb files for client and server
117IMPORT_LIST += \
118 $(LIBDIR)/$(JVMLIB_NAME) \
119 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME) \
120 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME)
121
122# Hotspot client is only available on 32-bit builds
123ifeq ($(ARCH_DATA_MODEL), 32)
124 IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME) \
125 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME)
126endif
127
128$(LIBDIR)/$(JVMLIB_NAME): $(HOTSPOT_LIB_PATH)/$(JVMLIB_NAME)
129 $(install-import-file)
130
131# it is OK for the .map and .pdb files to not exist, so do not force a
132# dependency on them from the bootstrap location, and allow the copy to fail.
133$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME):
134 @$(prep-target)
135 -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMMAP_NAME) $@
136
137$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME):
138 @$(prep-target)
139 -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMMAP_NAME) $@
140
141$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME):
142 @$(prep-target)
143 -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMPDB_NAME) $@
144
145$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME):
146 @$(prep-target)
147 -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMPDB_NAME) $@
148
149# Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Windows
150else # PLATFORM
151# NOT Windows vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv NOT Windows
152
153IMPORT_LIST += \
154 $(LIB_LOCATION)/$(LIBJSIG_NAME) \
155 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME)
156
157ifeq ($(PLATFORM), solaris)
158 IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDB_NAME)
159endif
160
161ifeq ($(ARCH_DATA_MODEL), 32)
162
163IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME)
164
165ifeq ($(PLATFORM), solaris)
166# solaris vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv solaris
167
168ifeq ($(ARCH), sparc)
169 IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_NAME)
170endif
171
172IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME)
173
174ifeq ($(ARCH), sparc)
175 IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_NAME)
176endif
177
178# For backwards compatability, make a link of the 32-bit client JVM to $(LIBDIR)
179IMPORT_LIST += $(LIB_LOCATION)/$(JVM_NAME)
180
181# create a link from lib/libjvm.so to client/libjvm.so
182$(LIB_LOCATION)/$(JVM_NAME): $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME)
183 @$(prep-target)
184 $(LN) -s $(CLIENT_LOCATION)/$(JVM_NAME) $@
185
186# solaris ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ solaris
187endif # 32bit solaris
188
189endif # 32bit
190
191# NOT Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NOT Windows
192
193endif # PLATFORM
194
195$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVM_NAME)
196 $(install-import-file)
197
198$(LIB_LOCATION)/$(LIBJSIG_NAME): $(HOTSPOT_SERVER_PATH)/$(LIBJSIG_NAME)
199 $(install-import-file)
200
201$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME) \
202$(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME):
203 @$(prep-target)
204 $(LN) -s ../$(LIBJSIG_NAME) $@
205
206$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_NAME)
207 $(install-import-file)
208
209$(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDB_NAME)
210 $(install-import-file)
211
212$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDB_NAME)
213 $(install-import-file)
214
215$(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_NAME)
216 $(install-import-file)
217
218$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME): $(HOTSPOT_SERVER_PATH)/$(JVM_NAME)
219 $(install-import-file)
220
221$(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt : $(HOTSPOT_SERVER_PATH)/Xusage.txt
222 $(install-import-file)
223
224$(LIB_LOCATION)/$(CLIENT_LOCATION)/Xusage.txt : $(HOTSPOT_CLIENT_PATH)/Xusage.txt
225 $(install-import-file)
226
227ifeq ($(INCLUDE_SA), true)
228# The Serviceability Agent is built in the Hotspot workspace.
229# It contains two files:
230# - sa-jdi.jar: This goes into the same dir as tools.jar.
231# - a shared library: sawindbg.dll on windows / libproc.sa on unix
232# This goes into the same dir as the other
233# shared libs, eg. libjdwp.so.
234$(LIBDIR)/sa-jdi.jar: $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar
235 $(install-import-file)
236
237$(LIB_LOCATION)/$(SALIB_NAME): $(HOTSPOT_SALIB_PATH)/$(SALIB_NAME)
238 $(install-import-file)
239
240ifeq ($(PLATFORM), windows)
241$(LIB_LOCATION)/$(SAPDB_NAME): $(HOTSPOT_SALIB_PATH)/$(SAPDB_NAME)
242 $(install-import-file)
243
244$(LIB_LOCATION)/$(SAMAP_NAME): $(HOTSPOT_SALIB_PATH)/$(SAMAP_NAME)
245 $(install-import-file)
246endif # windows
247endif # INCLUDE_SA
248
249#
250# Specific to OpenJDK building
251#
252ifdef OPENJDK
253
254include $(BUILDDIR)/common/internal/BinaryPlugs.gmk
255
256build: import-binary-plugs
257
258else # !OPENJDK
259
260INTERNAL_IMPORT_LIST += \
261 $(LIBDIR)/security/US_export_policy.jar \
262 $(LIBDIR)/security/local_policy.jar \
263 $(LIBDIR)/jce.jar
264
265$(LIBDIR)/jce.jar: \
266 $(BUILDDIR)/closed/tools/crypto/jce/jce.jar
267 $(install-file)
268$(LIBDIR)/security/US_export_policy.jar: \
269 $(BUILDDIR)/closed/tools/crypto/jce/US_export_policy.jar
270 $(install-file)
271$(LIBDIR)/security/local_policy.jar: \
272 $(BUILDDIR)/closed/tools/crypto/jce/local_policy.jar
273 $(install-file)
274
275endif # OPENJDK
276
277ADDJSUM_JARFILE = $(BUILDTOOLJARDIR)/addjsum.jar
278
279# Construct classlist file
280$(LIBDIR)/classlist: \
281 $(CLASSSHARINGDATA_DIR)/classlist.$(PLATFORM) \
282 $(ADDJSUM_JARFILE)
283 @$(prep-target)
284 @$(RM) -f $@.temp
285 $(BOOT_JAVA_CMD) -jar $(ADDJSUM_JARFILE) \
286 $(CLASSSHARINGDATA_DIR)/classlist.$(PLATFORM) $@.temp
287 $(MV) $@.temp $@
288
289ifndef OPENJDK
290
291# Lucida font files are not included in the OpenJDK distribution.
292# Get names of font files
293include FILES.gmk
294
295# Copy font files into OUTPUTDIR area
296
297FONTFILES = $(SHARED_FONTFILES)
298FONTSDIR = $(LIBDIR)/fonts
299FONTSDIRFILE = $(FONTSDIR)/fonts.dir
300INTERNAL_IMPORT_LIST += $(FONTFILES)
301
302ifneq ($(PLATFORM), windows)
303 INTERNAL_IMPORT_LIST += $(FONTSDIRFILE)
304endif
305
306$(LIBDIR)/fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/%.ttf
307 $(install-file)
308
309$(FONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.fonts.dir
310 $(install-file)
311
312ifeq ($(PLATFORM), linux)
313
314# The oblique fonts are only needed/wanted on Linux.
315
316OBLFONTSDIR = $(LIBDIR)/oblique-fonts
317OBLFONTSDIRFILE = $(OBLFONTSDIR)/fonts.dir
318INTERNAL_IMPORT_LIST += $(OBLIQUE_FONTFILES) $(OBLFONTSDIRFILE)
319
320$(LIBDIR)/oblique-fonts/%.ttf: $(CLOSED_SRC)/share/lib/fonts/oblique/%.ttf
321 $(install-file)
322
323$(OBLFONTSDIRFILE): $(PLATFORM_SRC)/classes/sun/awt/motif/java.oblique-fonts.dir
324 $(install-file)
325
326endif # linux
327endif # !OPENJDK
328
329# Import internal files (ones that are stashed in this source tree)
330import_internal_files : $(INTERNAL_IMPORT_LIST)
331
332# Import files from the JDK that we are not building
333import_files: $(IMPORT_LIST)
334
335# Get component information variables and rules
336include $(BUILDDIR)/common/internal/ImportComponents.gmk
337
338# Security files we need to import
339SEC_FILES_ZIP=$(ABS_BUILDDIR)/tools/crypto/sec-bin.zip
340SEC_FILES_WIN_ZIP=$(ABS_BUILDDIR)/tools/crypto/sec-windows-bin.zip
341JGSS_WIN32_FILES_ZIP=$(ABS_BUILDDIR)/tools/crypto/jgss-windows-i586-bin.zip
342JGSS_WIN64_FILES_ZIP=$(ABS_BUILDDIR)/tools/crypto/jgss-windows-x64-bin.zip
343
344# Unzip zip file $2 into directory $1 (if $2 exists)
345# Warning: $2 must be absolute path not relative
346define SecUnzipper
347if [ -f $2 ] ; then \
348 $(MKDIR) -p $1; \
349 $(ECHO) "( $(CD) $1 && $(UNZIP) -o $2 )"; \
350 ( $(CD) $1 && $(UNZIP) -o $2 ); \
351fi
352endef
353
354# If sec-bin exists, unpack it into the build directory
355# Also, the library recompile build indirectly depends on two SSL classes,
356# so copy those as well FIXUP
357# if sec-windows-bin exists, unpack it into the build directory
358# if JGSS files exists, unpack it into the build directory
359$(TEMPDIR)/security_imported:
360 @$(prep-target)
361 @$(call SecUnzipper,$(OUTPUTDIR),$(SEC_FILES_ZIP))
362ifeq ($(PLATFORM), windows)
363 @$(call SecUnzipper,$(OUTPUTDIR),$(SEC_FILES_WIN_ZIP))
364endif
365ifeq ($(PLATFORM), windows)
366 ifeq ($(ARCH_DATA_MODEL), 32)
367 @$(call SecUnzipper,$(OUTPUTDIR),$(JGSS_WIN32_FILES_ZIP))
368 else
369 @$(call SecUnzipper,$(OUTPUTDIR),$(JGSS_WIN64_FILES_ZIP))
370 endif
371endif
372 @$(ECHO) "Imported on `$(DATE)`" > $@
373
374# Import all files from other components
375$(TEMPDIR)/components_imported:
376 @$(prep-target)
377 $(call import-component-binaries,$(ABS_OUTPUTDIR))
378 $(call import-component-sources,$(IMPORTSRCDIR))
379 $(call import-component-docs,$(IMPORTDOCDIR))
380 $(call import-component-classes,$(CLASSDESTDIR))
381 @$(ECHO) "Imported on `$(DATE)`" > $@
382
383# Do pretty much everything
384build : import_files \
385 import_internal_files \
386 $(TEMPDIR)/components_imported \
387 $(TEMPDIR)/security_imported
388
389# Clean up what we imported (except for component files)
390clean clobber::
391 $(RM) $(IMPORT_LIST)
392 $(RM) $(INTERNAL_IMPORT_LIST)
393 $(call import-component-sources-clean,$(IMPORTSRCDIR))
394 $(call import-component-docs-clean,$(IMPORTDOCDIR))
395 $(call import-component-classes-clean,$(CLASSDESTDIR))
396 $(RM) $(TEMPDIR)/components_imported
397 $(RM) $(TEMPDIR)/security_imported
398
399.PHONY: import_files import_internal_files
400