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