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 BUILDDIR = ../../..
  27 MODULE   = sajdi
  28 PRODUCT  = java
  29 include $(BUILDDIR)/common/Defs.gmk
  30 
  31 ifeq ($(PLATFORM), windows)
  32   LIB_LOCATION = $(BINDIR)
  33 else
  34   LIB_LOCATION = $(LIBDIR)/$(LIBARCH)
  35 endif
  36 
  37 # INCLUDE_SA is false on platforms where SA is not supported.
  38 # On platforms where it is supported, we want to allow it to
  39 # not be present, at least temporarily.  So,
  40 # if the SA files (well, just sa-jdi.jar) do not exist
  41 # in the HOTSPOT_IMPORT_PATH, then we won't build SA.
  42 SA_EXISTS := $(shell if [ -r $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar ] ; then \
  43                           $(ECHO) true; \
  44                         else \
  45                           $(ECHO) false; \
  46                         fi)
  47 
  48 ifeq ($(SA_EXISTS), false)
  49   INCLUDE_SA := false
  50 endif
  51 
  52 IMPORT_LIST =
  53 ifeq ($(INCLUDE_SA), true)
  54   IMPORT_LIST += $(LIBDIR)/sa-jdi.jar \
  55                  $(LIB_LOCATION)/$(SALIB_NAME)
  56   ifeq ($(PLATFORM), windows)
  57     IMPORT_LIST += $(LIB_LOCATION)/$(SAMAP_NAME) \
  58                    $(LIB_LOCATION)/$(SAPDB_NAME)
  59   endif
  60 endif # INCLUDE_SA
  61 
  62 
  63 ifeq ($(INCLUDE_SA), true)
  64 # The Serviceability Agent is built in the Hotspot workspace.
  65 # It contains two files:
  66 #  - sa-jdi.jar:  This goes into the same dir as tools.jar.
  67 #  - a shared library:  sawindbg.dll on windows / libproc.sa on unix
  68 #                       This goes into the same dir as the other
  69 #                       shared libs, eg. libjdwp.so.
  70 $(LIBDIR)/sa-jdi.jar: $(HOTSPOT_IMPORT_PATH)/lib/sa-jdi.jar
  71         $(install-importonly-file)
  72 
  73 $(LIB_LOCATION)/$(SALIB_NAME): $(HOTSPOT_SALIB_PATH)/$(SALIB_NAME)
  74         $(install-import-file)
  75 
  76 ifeq ($(PLATFORM), windows)
  77 $(LIB_LOCATION)/$(SAPDB_NAME): $(HOTSPOT_SALIB_PATH)/$(SAPDB_NAME)
  78         $(install-import-file)
  79 
  80 $(LIB_LOCATION)/$(SAMAP_NAME): $(HOTSPOT_SALIB_PATH)/$(SAMAP_NAME)
  81         $(install-import-file)
  82 endif # windows
  83 endif # INCLUDE_SA
  84 
  85 all: $(IMPORT_LIST)
  86 
  87 clean clobber::