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