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