1 #
   2 # Copyright (c) 2012, 2015, 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 default: all
  27 
  28 include $(SPEC)
  29 include MakeBase.gmk
  30 
  31 ################################################################################
  32 
  33 # Put the libraries here. Different locations for different target OS types.
  34 ifneq ($(OPENJDK_TARGET_OS), windows)
  35   HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
  36   BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
  37   SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent$(OPENJDK_TARGET_CPU_LIBDIR)
  38 else
  39   HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/bin
  40   BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
  41   SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent
  42 endif
  43 
  44 ################################################################################
  45 #
  46 # Import hotspot
  47 #
  48 
  49 # Don't import jsig library for static builds
  50 ifneq ($(BUILD_STATIC), true)
  51   JSIG_IMPORT = jsig.*
  52 else
  53   JSIG_IMPORT = 
  54 endif
  55 
  56 HOTSPOT_BASE_IMPORT_FILES := \
  57     $(addprefix $(LIBRARY_PREFIX), jvm.* $(JSIG_IMPORT) jvm_db.* jvm_dtrace.*) \
  58     Xusage.txt \
  59     #
  60 
  61 HOTSPOT_SA_IMPORT_FILES := \
  62     $(addprefix $(LIBRARY_PREFIX), saproc.* sawindbg.*) \
  63     #
  64 
  65 $(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE, \
  66     SRC := $(HOTSPOT_LIB_DIR), \
  67     DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
  68     FILES := $(shell $(FIND) $(HOTSPOT_LIB_DIR) -type f  \
  69         -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE), $(HOTSPOT_BASE_IMPORT_FILES)) \) )))
  70 
  71 ifeq ($(OPENJDK_TARGET_OS), windows)
  72   $(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE_JVMLIB, \
  73       SRC := $(HOTSPOT_DIST)/lib, \
  74       DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
  75       FILES := $(wildcard $(HOTSPOT_DIST)/lib/*.lib)))
  76 endif
  77 
  78 BASE_TARGETS := $(COPY_HOTSPOT_BASE) $(COPY_HOTSPOT_BASE_JVMLIB)
  79 
  80 $(eval $(call SetupCopyFiles,COPY_HOTSPOT_SA, \
  81     SRC := $(HOTSPOT_LIB_DIR), \
  82     DEST := $(SA_INSTALL_LIBRARIES_HERE), \
  83     FILES := $(shell $(FIND) $(HOTSPOT_LIB_DIR) -type f  \
  84         -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE), $(HOTSPOT_SA_IMPORT_FILES)) \) )))
  85 
  86 SA_TARGETS := $(COPY_HOTSPOT_SA)
  87 
  88 ################################################################################
  89 
  90 ifneq ($(BUILD_STATIC), true)
  91   ifeq ($(OPENJDK_TARGET_OS), macosx)
  92     JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
  93         $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
  94   else
  95     JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
  96         $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
  97   endif
  98 
  99   ifneq ($(OPENJDK_TARGET_OS), windows)
 100     ifeq ($(JVM_VARIANT_SERVER), true)
 101       BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
 102       ifneq (, $(JSIG_DEBUGINFO))
 103         BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
 104       endif
 105     endif
 106     ifeq ($(JVM_VARIANT_CLIENT), true)
 107       BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
 108       ifneq (, $(JSIG_DEBUGINFO))
 109         BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
 110       endif
 111     endif
 112     ifneq ($(OPENJDK_TARGET_OS), macosx)
 113       ifeq ($(JVM_VARIANT_MINIMAL1), true)
 114         BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
 115         ifneq (,$(JSIG_DEBUGINFO))
 116           BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
 117         endif
 118       endif
 119     endif
 120   endif
 121 endif
 122 
 123 $(BASE_INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 124         $(MKDIR) -p $(@D)
 125         $(RM) $@
 126         $(LN) -s ../$(@F) $@
 127 
 128 ifeq ($(OPENJDK_TARGET_OS), macosx)
 129   $(BASE_INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
 130         $(MKDIR) -p $(@D)
 131         $(RM) $@
 132         $(LN) -s ../$(@F) $@
 133 
 134   $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 135         $(MKDIR) -p $(@D)
 136         $(RM) $@
 137         $(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 138         $(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 139         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
 140         $(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 141         $(MV) $@.tmp $@
 142 else
 143   $(BASE_INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 144         $(MKDIR) -p $(@D)
 145         $(RM) $@
 146         $(LN) -s ../$(@F) $@
 147 
 148   $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 149         $(MKDIR) -p $(@D)
 150         $(RM) $@
 151         $(RM) $@.tmp $(basename $@).debuginfo
 152         $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
 153         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
 154         $(RM) $(basename $@).debuginfo
 155         $(MV) $@.tmp $@
 156 endif
 157 
 158 $(BASE_INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 159         $(MKDIR) -p $(@D)
 160         $(RM) $@
 161         $(LN) -s ../$(@F) $@
 162 
 163 ifeq ($(OPENJDK_TARGET_OS), macosx)
 164   $(BASE_INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
 165         $(MKDIR) -p $(@D)
 166         $(RM) $@
 167         $(LN) -s ../$(@F) $@
 168 
 169   $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 170         $(MKDIR) -p $(@D)
 171         $(RM) $@
 172         $(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 173         $(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 174         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
 175         $(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 176         $(MV) $@.tmp $@
 177 else
 178   $(BASE_INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 179         $(MKDIR) -p $(@D)
 180         $(RM) $@
 181         $(LN) -s ../$(@F) $@
 182 
 183   $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 184         $(MKDIR) -p $(@D)
 185         $(RM) $@
 186         $(RM) $@.tmp $(basename $@).debuginfo
 187         $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
 188         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
 189         $(RM) $(basename $@).debuginfo
 190         $(MV) $@.tmp $@
 191 endif
 192 
 193 $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 194         $(MKDIR) -p $(@D)
 195         $(RM) $@
 196         $(LN) -s ../$(@F) $@
 197 
 198 ifneq ($(OPENJDK_TARGET_OS), macosx)
 199   $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 200         $(MKDIR) -p $(@D)
 201         $(RM) $@
 202         $(LN) -s ../$(@F) $@
 203 
 204   $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 205         $(MKDIR) -p $(@D)
 206         $(RM) $@
 207         $(RM) $@.tmp $(basename $@).debuginfo
 208         $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
 209         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
 210         $(RM) $(basename $@).debuginfo
 211         $(MV) $@.tmp $@
 212 endif
 213 
 214 ################################################################################
 215 
 216 $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked: $(HOTSPOT_DIST)/lib/sa-jdi.jar \
 217     $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 218         $(ECHO) $(LOG_INFO) Unzipping $(<F)
 219         $(RM) -r $(@D)
 220         $(MKDIR) -p $(@D)
 221         $(CD) $(@D) && $(UNZIP) $< -x META-INF/MANIFEST.MF $(LOG_DEBUG)
 222         # We must move the service provider file out of the way so that
 223         # Gensrc-jdk.jdi.gmk can combine them.
 224         $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent
 225         $(MV) $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector \
 226             $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 227         $(TOUCH) $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 228         $(TOUCH) $@
 229 
 230 # Declaring this dependency guarantees that _the.sa.services will be rebuilt
 231 # even if zip is already unpacked.
 232 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services: $(HOTSPOT_DIST)/lib/sa-jdi.jar
 233 
 234 # Some platforms don't have the serviceability agent
 235 ifeq (, $(filter $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), aix-ppc64))
 236   ifneq ($(JVM_VARIANT_ZERO), true)
 237     SA_TARGETS += $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked \
 238         $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 239   endif
 240 endif
 241 
 242 ################################################################################
 243 
 244 ifeq ($(OPENJDK_TARGET_OS), windows)
 245   $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_BIN, \
 246       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
 247       DEST := $(JDK_OUTPUTDIR)/bin, \
 248       FILES := $(filter-out %.lib, $(BASE_TARGETS))))
 249 
 250   $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_LIB, \
 251       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
 252       DEST := $(JDK_OUTPUTDIR)/lib, \
 253       FILES := $(filter %.lib, $(BASE_TARGETS))))
 254 
 255   $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
 256       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
 257       DEST := $(JDK_OUTPUTDIR)/lib, \
 258       FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, \
 259           $(SA_TARGETS))))
 260 
 261   $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
 262       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
 263       DEST := $(JDK_OUTPUTDIR)/bin, \
 264       FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, \
 265           $(SA_TARGETS))))
 266 else
 267   $(eval $(call SetupCopyFiles,BASE_COPY_LIBS, \
 268       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
 269       DEST := $(JDK_OUTPUTDIR)/lib, \
 270       FILES := $(BASE_TARGETS)))
 271 
 272   $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
 273       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
 274       DEST := $(JDK_OUTPUTDIR)/lib, \
 275       FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, $(SA_TARGETS))))
 276 endif
 277 
 278 ################################################################################
 279 
 280 all: $(BASE_TARGETS) $(SA_TARGETS) \
 281     $(BASE_COPY_LIBS_BIN) $(BASE_COPY_LIBS_LIB) \
 282     $(BASE_COPY_LIBS) $(SA_COPY_LIBS)
 283 
 284 .PHONY: default all