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)/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 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)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
  84       $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
  85 else
  86   JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
  87       $(wildcard $(HOTSPOT_DIST)/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_CLIENT), true)
  98     BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
  99     ifneq (, $(JSIG_DEBUGINFO))
 100       BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
 101     endif
 102   endif
 103   ifneq ($(OPENJDK_TARGET_OS), macosx)
 104     ifeq ($(JVM_VARIANT_MINIMAL1), true)
 105       BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
 106       ifneq (,$(JSIG_DEBUGINFO))
 107         BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
 108       endif
 109     endif
 110   endif
 111 endif
 112 
 113 $(BASE_INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 114         $(MKDIR) -p $(@D)
 115         $(RM) $@
 116         $(LN) -s ../$(@F) $@
 117 
 118 ifeq ($(OPENJDK_TARGET_OS), macosx)
 119   $(BASE_INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
 120         $(MKDIR) -p $(@D)
 121         $(RM) $@
 122         $(LN) -s ../$(@F) $@
 123 
 124   $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 125         $(MKDIR) -p $(@D)
 126         $(RM) $@
 127         $(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 128         $(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 129         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
 130         $(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 131         $(MV) $@.tmp $@
 132 else
 133   $(BASE_INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 134         $(MKDIR) -p $(@D)
 135         $(RM) $@
 136         $(LN) -s ../$(@F) $@
 137 
 138   $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 139         $(MKDIR) -p $(@D)
 140         $(RM) $@
 141         $(RM) $@.tmp $(basename $@).debuginfo
 142         $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
 143         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
 144         $(RM) $(basename $@).debuginfo
 145         $(MV) $@.tmp $@
 146 endif
 147 
 148 $(BASE_INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 149         $(MKDIR) -p $(@D)
 150         $(RM) $@
 151         $(LN) -s ../$(@F) $@
 152 
 153 ifeq ($(OPENJDK_TARGET_OS), macosx)
 154   $(BASE_INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
 155         $(MKDIR) -p $(@D)
 156         $(RM) $@
 157         $(LN) -s ../$(@F) $@
 158 
 159   $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 160         $(MKDIR) -p $(@D)
 161         $(RM) $@
 162         $(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 163         $(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 164         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
 165         $(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 166         $(MV) $@.tmp $@
 167 else
 168   $(BASE_INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 169         $(MKDIR) -p $(@D)
 170         $(RM) $@
 171         $(LN) -s ../$(@F) $@
 172 
 173   $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 174         $(MKDIR) -p $(@D)
 175         $(RM) $@
 176         $(RM) $@.tmp $(basename $@).debuginfo
 177         $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
 178         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
 179         $(RM) $(basename $@).debuginfo
 180         $(MV) $@.tmp $@
 181 endif
 182 
 183 $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 184         $(MKDIR) -p $(@D)
 185         $(RM) $@
 186         $(LN) -s ../$(@F) $@
 187 
 188 ifneq ($(OPENJDK_TARGET_OS), macosx)
 189   $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 190         $(MKDIR) -p $(@D)
 191         $(RM) $@
 192         $(LN) -s ../$(@F) $@
 193 
 194   $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 195         $(MKDIR) -p $(@D)
 196         $(RM) $@
 197         $(RM) $@.tmp $(basename $@).debuginfo
 198         $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
 199         $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
 200         $(RM) $(basename $@).debuginfo
 201         $(MV) $@.tmp $@
 202 endif
 203 
 204 ################################################################################
 205 
 206 $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked: $(HOTSPOT_DIST)/lib/sa-jdi.jar \
 207     $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 208         $(ECHO) $(LOG_INFO) Unzipping $(<F)
 209         $(RM) -r $(@D)
 210         $(MKDIR) -p $(@D)
 211         $(CD) $(@D) && $(UNZIP) $< -x META-INF/MANIFEST.MF $(LOG_DEBUG)
 212         # We must move the service provider file out of the way so that
 213         # Gensrc-jdk.jdi.gmk can combine them.
 214         $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent
 215         $(MV) $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector \
 216             $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 217         $(TOUCH) $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 218         $(TOUCH) $@
 219 
 220 # Declaring this dependency guarantees that _the.sa.services will be rebuilt
 221 # even if zip is already unpacked.
 222 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services: $(HOTSPOT_DIST)/lib/sa-jdi.jar
 223 
 224 # Some platforms don't have the serviceability agent
 225 ifeq (, $(filter $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), aix-ppc64))
 226   ifneq ($(JVM_VARIANT_ZERO), true)
 227     SA_TARGETS += $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked \
 228         $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 229   endif
 230 endif
 231 
 232 ################################################################################
 233 
 234 ifeq ($(OPENJDK_TARGET_OS), windows)
 235   $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_BIN, \
 236       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
 237       DEST := $(JDK_OUTPUTDIR)/bin, \
 238       FILES := $(filter-out %.lib, $(BASE_TARGETS))))
 239 
 240   $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_LIB, \
 241       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
 242       DEST := $(JDK_OUTPUTDIR)/lib, \
 243       FILES := $(filter %.lib, $(BASE_TARGETS))))
 244 
 245   $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
 246       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
 247       DEST := $(JDK_OUTPUTDIR)/lib, \
 248       FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, \
 249           $(SA_TARGETS))))
 250 
 251   $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
 252       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
 253       DEST := $(JDK_OUTPUTDIR)/bin, \
 254       FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, \
 255           $(SA_TARGETS))))
 256 else
 257   $(eval $(call SetupCopyFiles,BASE_COPY_LIBS, \
 258       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
 259       DEST := $(JDK_OUTPUTDIR)/lib, \
 260       FILES := $(BASE_TARGETS)))
 261 
 262   $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
 263       SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
 264       DEST := $(JDK_OUTPUTDIR)/lib, \
 265       FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, $(SA_TARGETS))))
 266 endif
 267 
 268 ################################################################################
 269 
 270 all: $(BASE_TARGETS) $(SA_TARGETS) \
 271     $(BASE_COPY_LIBS_BIN) $(BASE_COPY_LIBS_LIB) \
 272     $(BASE_COPY_LIBS) $(SA_COPY_LIBS)
 273 
 274 .PHONY: default all