1 #
   2 # Copyright (c) 1997, 2009, 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 
  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 MODULE   = base
  39 PRODUCT  = java
  40 include $(BUILDDIR)/common/Defs.gmk
  41 
  42 SERVER_LOCATION = server
  43 CLIENT_LOCATION = client
  44 
  45 DB_SUFFIX = _db
  46 DTRACE_SUFFIX = _dtrace
  47 
  48 ifeq ($(PLATFORM), windows)
  49   LIB_LOCATION = $(BINDIR)
  50 else
  51   LIB_LOCATION = $(LIBDIR)/$(LIBARCH)
  52 endif
  53 
  54 JVM_NAME               = $(LIB_PREFIX)jvm.$(LIBRARY_SUFFIX)
  55 JVMLIB_NAME            = $(LIB_PREFIX)jvm.$(LIB_SUFFIX)
  56 JVMMAP_NAME            = $(LIB_PREFIX)jvm.map
  57 JVMPDB_NAME            = $(LIB_PREFIX)jvm.pdb
  58 LIBJSIG_NAME           = $(LIB_PREFIX)jsig.$(LIBRARY_SUFFIX)
  59 JVMDB_NAME             = $(LIB_PREFIX)jvm$(DB_SUFFIX).$(LIBRARY_SUFFIX)
  60 JVMDTRACE_NAME         = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).$(LIBRARY_SUFFIX)
  61 JVMCFG_NAME            = jvm.cfg
  62 
  63 CLASSSHARINGDATA_DIR   = $(BUILDDIR)/tools/sharing
  64 
  65 # Needed to do file copy
  66 ABS_BUILDDIR :=$(call FullPath,$(BUILDDIR))
  67 
  68 SUBDIRS_desktop = fonts
  69 SUBDIRS_tools   = sajdi
  70 include $(BUILDDIR)/common/Subdirs.gmk
  71 
  72 all clean clobber::
  73         $(SUBDIRS-loop)
  74 
  75 all:: build
  76 
  77 # List of files created here or coming from BUILDDIR area (this workspace)
  78 INTERNAL_IMPORT_LIST = $(LIBDIR)/classlist
  79 
  80 # List of files coming from outside this workspace
  81 IMPORT_LIST = $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME) \
  82               $(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt \
  83               $(LIBDIR)/$(LIBARCH)/$(JVMCFG_NAME)
  84 
  85 # Hotspot client is only available on 32-bit non-Zero builds
  86 ifneq ($(ZERO_BUILD), true)
  87 ifeq ($(ARCH_DATA_MODEL), 32)
  88   IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME) \
  89                  $(LIB_LOCATION)/$(CLIENT_LOCATION)/Xusage.txt
  90 endif
  91 endif
  92 
  93 # Get $(JVMCFG_NAME) files
  94 $(LIBDIR)/$(LIBARCH)/$(JVMCFG_NAME) : $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)/$(JVMCFG_NAME)
  95         $(install-import-file)
  96 
  97 ifeq ($(PLATFORM), windows)
  98 #  Windows     vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv  Windows
  99 
 100 IMPORT_LIST += $(MS_RUNTIME_LIBRARIES:%=$(BINDIR)/%)
 101 
 102 # NOTE: These might actually come from BUILDDIR, depends on the settings.
 103 $(BINDIR)/msvcrt.dll: $(MSVCRT_DLL_PATH)/msvcrt.dll
 104         $(install-import-file)
 105         $(call chmod-file, a+x)
 106 $(BINDIR)/$(MSVCRNN_DLL): $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)
 107         $(install-import-file)
 108         $(call chmod-file, a+x)
 109 
 110 # Get the hotspot .map and .pdb files for client and server
 111 IMPORT_LIST += \
 112         $(LIBDIR)/$(JVMLIB_NAME) \
 113         $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME) \
 114         $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME)
 115 
 116 # Add .map and .pdb files to the import path for client and kernel VMs. 
 117 # These are only available on 32-bit windows builds. 
 118 ifeq ($(ARCH_DATA_MODEL), 32)
 119   IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME) \
 120                  $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME)
 121   ifeq ($(DO_KERNEL), true)
 122     IMPORT_LIST += $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME) \
 123                    $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME)
 124   endif
 125 endif
 126 
 127 $(LIBDIR)/$(JVMLIB_NAME): $(HOTSPOT_LIB_PATH)/$(JVMLIB_NAME)
 128         $(install-import-file)
 129 
 130 # it is OK for the .map and .pdb files to not exist, so do not force a 
 131 # dependency on them from the bootstrap location, and allow the copy to fail.
 132 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME):
 133         @$(prep-target)
 134         -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMMAP_NAME)  $@
 135         @$(install-module-file)
 136 
 137 $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME):
 138         @$(prep-target)
 139         -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMMAP_NAME)  $@
 140         @$(install-module-file)
 141 
 142 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME):
 143         @$(prep-target)
 144         -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMMAP_NAME) $@
 145         @$(install-module-file)
 146 
 147 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME):
 148         @$(prep-target)
 149         -$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMPDB_NAME)  $@
 150         @$(install-module-file)
 151 
 152 $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME):
 153         @$(prep-target)
 154         -$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMPDB_NAME)  $@
 155         @$(install-module-file)
 156 
 157 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME): 
 158         @$(prep-target)
 159         -$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMPDB_NAME) $@
 160         @$(install-module-file)
 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 # The conditional can be removed when import JDKs contain these files.
 173 ifneq ($(wildcard $(HOTSPOT_SERVER_PATH)/$(JVMDTRACE_NAME)),)
 174   IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDTRACE_NAME)
 175 else
 176   $(warning WARNING: $(HOTSPOT_SERVER_PATH)/$(JVMDB_NAME) not found!)
 177 endif 
 178 endif 
 179 
 180 ifneq ($(ZERO_BUILD), true)
 181 ifeq ($(ARCH_DATA_MODEL), 32)
 182 
 183 IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME)
 184 
 185 ifeq ($(PLATFORM), solaris)
 186 #  solaris   vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv  solaris
 187 
 188 IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME)
 189 
 190 # The conditional can be removed when import JDKs contain these files.
 191 ifneq ($(wildcard $(HOTSPOT_CLIENT_PATH)/$(JVMDTRACE_NAME)),)
 192   IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDTRACE_NAME)
 193   IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_NAME)
 194   IMPORT_LIST += $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDTRACE_NAME)
 195 else
 196   $(warning WARNING: $(HOTSPOT_CLIENT_PATH)/$(JVMDTRACE_NAME) not found!)
 197 endif
 198 
 199 # The conditional can be removed when import JDKs contain these files.
 200 ifneq ($(wildcard $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_NAME)),)
 201   IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_NAME)
 202 else
 203   $(warning WARNING: $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_NAME) not found!)
 204 endif
 205 
 206 # The conditional can be removed when import JDKs contain these files.
 207 ifneq ($(wildcard $(HOTSPOT_SERVER_PATH)/64/$(JVMDTRACE_NAME)),)
 208   IMPORT_LIST += $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDTRACE_NAME)
 209 else
 210   $(warning WARNING: $(HOTSPOT_SERVER_PATH)/64/$(JVMDTRACE_NAME) not found!)
 211 endif
 212 
 213 # For backwards compatability, make a link of the 32-bit client JVM to $(LIBDIR)
 214 IMPORT_LIST += $(LIB_LOCATION)/$(JVM_NAME)
 215 
 216 $(LIB_LOCATION)/$(JVM_NAME): $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME)
 217         @$(prep-target)
 218 
 219 #  solaris   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ solaris
 220 endif # 32bit solaris
 221 
 222 endif # 32bit
 223 
 224 endif # ZERO_BUILD
 225 
 226 #  NOT Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NOT Windows
 227 
 228 endif # PLATFORM
 229 
 230 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVM_NAME)
 231         $(install-import-file)
 232 
 233 $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVM_NAME): $(HOTSPOT_KERNEL_PATH)/$(JVM_NAME)
 234         $(install-file)
 235 
 236 $(LIB_LOCATION)/$(LIBJSIG_NAME): $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_NAME)
 237         $(install-import-file)
 238 
 239 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME) \
 240 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME):
 241         @$(prep-target)
 242         $(call install-sym-link, ../$(LIBJSIG_NAME))
 243 
 244 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_NAME)
 245         $(install-import-file)
 246 
 247 $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDB_NAME)
 248         $(install-import-file)
 249 
 250 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDB_NAME)
 251         $(install-import-file)
 252 
 253 $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_NAME)
 254         $(install-import-file)
 255 
 256 $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDTRACE_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDTRACE_NAME)
 257         $(install-import-file)
 258 
 259 $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDTRACE_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDTRACE_NAME)
 260         $(install-import-file)
 261 
 262 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDTRACE_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDTRACE_NAME)
 263         $(install-import-file)
 264 
 265 $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDTRACE_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDTRACE_NAME)
 266         $(install-import-file)
 267 
 268 $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME): $(HOTSPOT_SERVER_PATH)/$(JVM_NAME)
 269         $(install-import-file)
 270 
 271 $(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt : $(HOTSPOT_SERVER_PATH)/Xusage.txt
 272         $(install-import-file)
 273 
 274 $(LIB_LOCATION)/$(CLIENT_LOCATION)/Xusage.txt : $(HOTSPOT_CLIENT_PATH)/Xusage.txt
 275         $(install-import-file)
 276 
 277 $(LIB_LOCATION)/$(KERNEL_LOCATION)/Xusage.txt : $(HOTSPOT_KERNEL_PATH)/Xusage.txt
 278         $(install-file)
 279 
 280 #
 281 # Specific to OpenJDK building
 282 #
 283 ifdef OPENJDK
 284 
 285   ifeq ($(IMPORT_BINARY_PLUGS),true)
 286     include $(BUILDDIR)/common/internal/BinaryPlugs.gmk
 287 
 288     build: import-binary-plugs
 289   endif
 290 
 291 else # !OPENJDK
 292 
 293 INTERNAL_IMPORT_LIST += \
 294             $(LIBDIR)/security/US_export_policy.jar \
 295             $(LIBDIR)/security/local_policy.jar \
 296             $(LIBDIR)/jce.jar
 297 
 298 $(LIBDIR)/jce.jar: \
 299             $(BUILDDIR)/closed/tools/crypto/jce/jce.jar
 300         $(install-non-module-file)
 301 $(LIBDIR)/security/US_export_policy.jar: \
 302             $(BUILDDIR)/closed/tools/crypto/jce/US_export_policy.jar
 303         $(install-file)
 304 $(LIBDIR)/security/local_policy.jar: \
 305             $(BUILDDIR)/closed/tools/crypto/jce/local_policy.jar
 306         $(install-file)
 307 
 308 endif # OPENJDK
 309 
 310 ADDJSUM_JARFILE = $(BUILDTOOLJARDIR)/addjsum.jar
 311 
 312 # Construct classlist file
 313 $(LIBDIR)/classlist: \
 314     $(CLASSSHARINGDATA_DIR)/classlist.$(PLATFORM) \
 315     $(ADDJSUM_JARFILE)
 316         @$(prep-target)
 317         @$(RM) -f $@.temp
 318         $(BOOT_JAVA_CMD) -jar $(ADDJSUM_JARFILE) \
 319             $(CLASSSHARINGDATA_DIR)/classlist.$(PLATFORM) $@.temp
 320         $(MV) $@.temp $@
 321 
 322 # Import internal files (ones that are stashed in this source tree)
 323 import_internal_files : $(INTERNAL_IMPORT_LIST)
 324 
 325 # Import files from the JDK that we are not building
 326 import_files: $(IMPORT_LIST)
 327 
 328 # Get component information variables and rules
 329 include $(BUILDDIR)/common/internal/ImportComponents.gmk
 330 
 331 # Security files we need to import
 332 SEC_FILES_ZIP=$(ABS_BUILDDIR)/tools/crypto/sec-bin.zip
 333 SEC_FILES_WIN_ZIP=$(ABS_BUILDDIR)/tools/crypto/sec-windows-bin.zip
 334 JGSS_WIN32_FILES_ZIP=$(ABS_BUILDDIR)/tools/crypto/jgss-windows-i586-bin.zip
 335 JGSS_WIN64_FILES_ZIP=$(ABS_BUILDDIR)/tools/crypto/jgss-windows-x64-bin.zip
 336 
 337 # Unzip zip file $2 into directory $1 (if $2 exists)
 338 #   Warning: $2 must be absolute path not relative
 339 define SecUnzipper
 340 if [ -f $2 ] ; then \
 341   $(MKDIR) -p $1; \
 342   $(ECHO) "( $(CD) $1 && $(UNZIP) -o $2 )"; \
 343   ( $(CD) $1 && $(UNZIP) -o $2 ); \
 344 fi
 345 endef
 346 
 347 # If sec-bin exists, unpack it into the build directory
 348 #   Also, the library recompile build indirectly depends on two SSL classes,
 349 #   so copy those as well   FIXUP
 350 #   if sec-windows-bin exists, unpack it into the build directory
 351 #   if JGSS files exists, unpack it into the build directory
 352 $(TEMPDIR)/security_imported:
 353         @$(prep-target)
 354         @$(call SecUnzipper,$(OUTPUTDIR),$(SEC_FILES_ZIP))
 355 ifeq ($(PLATFORM), windows)
 356         @$(call SecUnzipper,$(OUTPUTDIR),$(SEC_FILES_WIN_ZIP))
 357 endif
 358 ifeq ($(PLATFORM), windows)
 359     ifeq ($(ARCH_DATA_MODEL), 32)
 360         @$(call SecUnzipper,$(OUTPUTDIR),$(JGSS_WIN32_FILES_ZIP))
 361     else
 362         @$(call SecUnzipper,$(OUTPUTDIR),$(JGSS_WIN64_FILES_ZIP))
 363     endif
 364 endif
 365         @$(ECHO) "Imported on `$(DATE)`" > $@
 366 
 367 # Import all files from other components
 368 $(TEMPDIR)/components_imported:
 369         @$(prep-target)
 370         $(call import-component-binaries,$(ABS_OUTPUTDIR))
 371         $(call import-component-sources,$(IMPORTSRCDIR))
 372         $(call import-component-docs,$(IMPORTDOCDIR))
 373         $(call import-component-classes,$(CLASSDESTDIR))
 374         @$(ECHO) "Imported on `$(DATE)`" > $@
 375 
 376 # Do pretty much everything
 377 build : import_files \
 378         import_internal_files \
 379         $(TEMPDIR)/components_imported \
 380         $(TEMPDIR)/security_imported
 381 
 382 # Clean up what we imported (except for component files)
 383 clean clobber::
 384         $(RM) $(IMPORT_LIST)
 385         $(RM) $(INTERNAL_IMPORT_LIST)
 386         $(call import-component-sources-clean,$(IMPORTSRCDIR))
 387         $(call import-component-docs-clean,$(IMPORTDOCDIR))
 388         $(call import-component-classes-clean,$(CLASSDESTDIR))
 389         $(RM) $(TEMPDIR)/components_imported
 390         $(RM) $(TEMPDIR)/security_imported
 391 
 392 .PHONY: import_files import_internal_files
 393