2796N/A#
2796N/A# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
2796N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2796N/A#
2796N/A# This code is free software; you can redistribute it and/or modify it
2796N/A# under the terms of the GNU General Public License version 2 only, as
2796N/A# published by the Free Software Foundation.
2796N/A#
2796N/A# This code is distributed in the hope that it will be useful, but WITHOUT
2796N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2796N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2796N/A# version 2 for more details (a copy is included in the LICENSE file that
2796N/A# accompanied this code).
2796N/A#
2796N/A# You should have received a copy of the GNU General Public License version
2796N/A# 2 along with this work; if not, write to the Free Software Foundation,
2796N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2796N/A#
2796N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2796N/A# or visit www.oracle.com if you need additional information or have any
2796N/A# questions.
2796N/A#
2796N/A#
2796N/A
2796N/A# This makefile (sa.make) is included from the sa.make in the
2796N/A# build directories.
2796N/A
2796N/A# This makefile is used to build Serviceability Agent java code
2796N/A# and generate JNI header file for native methods.
2796N/A
2796N/Ainclude $(GAMMADIR)/make/bsd/makefiles/rules.make
2796N/A
2796N/AAGENT_DIR = $(GAMMADIR)/agent
2796N/A
2796N/Ainclude $(GAMMADIR)/make/sa.files
2796N/A
2796N/ATOPDIR = $(shell echo `pwd`)
2796N/AGENERATED = $(TOPDIR)/../generated
2796N/A
2951N/A# SA-JDI depends on the standard JDI classes.
2951N/A# Default SA_CLASSPATH location:
2951N/ADEF_SA_CLASSPATH=$(BOOT_JAVA_HOME)/lib/tools.jar
2951N/Aifeq ($(ALT_SA_CLASSPATH),)
2951N/A # no alternate specified; see if default exists
2951N/A SA_CLASSPATH=$(shell test -f $(DEF_SA_CLASSPATH) && echo $(DEF_SA_CLASSPATH))
2951N/A ifeq ($(SA_CLASSPATH),)
2951N/A # the default doesn't exist
2951N/A ifeq ($(OS_VENDOR), Darwin)
2951N/A # A JDK from Apple doesn't have tools.jar; the JDI classes are
2951N/A # are in the regular classes.jar file.
2951N/A APPLE_JAR=$(BOOT_JAVA_HOME)/bundle/Classes/classes.jar
2951N/A SA_CLASSPATH=$(shell test -f $(APPLE_JAR) && echo $(APPLE_JAR))
2951N/A endif
2951N/A endif
2842N/Aelse
2951N/A _JUNK_ := $(shell echo >&2 "INFO: ALT_SA_CLASSPATH=$(ALT_SA_CLASSPATH)")
2951N/A SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
2842N/Aendif
2796N/A
2796N/A# TODO: if it's a modules image, check if SA module is installed.
2796N/AMODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
2796N/A
2842N/AAGENT_FILES_LIST := $(GENERATED)/agent.classes.list
2796N/A
2796N/ASA_CLASSDIR = $(GENERATED)/saclasses
2796N/A
2796N/ASA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION)"
2796N/A
2796N/ASA_PROPERTIES = $(SA_CLASSDIR)/sa.properties
2796N/A
2796N/A# if $(AGENT_DIR) does not exist, we don't build SA
2796N/A# also, we don't build SA on Itanium, PowerPC, ARM or zero.
2796N/A
2796N/Aall:
2796N/A if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
2796N/A -a "$(SRCARCH)" != "arm" \
2796N/A -a "$(SRCARCH)" != "ppc" \
2796N/A -a "$(SRCARCH)" != "zero" ] ; then \
2796N/A $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
2796N/A fi
2796N/A
2842N/A$(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
2796N/A $(QUIETLY) echo "Making $@"
2796N/A $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
2796N/A echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
2796N/A exit 1; \
2796N/A fi
2951N/A $(QUIETLY) if [ ! -f "$(SA_CLASSPATH)" -a ! -d $(MODULELIB_PATH) ] ; then \
2951N/A echo "Cannot find JDI classes. Use 1.6.0 or later version of JDK."; \
2796N/A echo ""; \
2796N/A exit 1; \
2796N/A fi
2796N/A $(QUIETLY) if [ ! -d $(SA_CLASSDIR) ] ; then \
2796N/A mkdir -p $(SA_CLASSDIR); \
2796N/A fi
2796N/A# Note: When indented, make tries to execute the '$(shell' comment.
2796N/A# In some environments, cmd processors have limited line length.
2796N/A# To prevent the javac invocation in the next block from using
2796N/A# a very long cmd line, we use javac's @file-list option. We
2796N/A# generate the file lists using make's built-in 'foreach' control
2796N/A# flow which also avoids cmd processor line length issues. Since
2796N/A# the 'foreach' is done as part of make's macro expansion phase,
2796N/A# the initialization of the lists is also done in the same phase
2796N/A# using '$(shell rm ...' instead of using the more traditional
2796N/A# 'rm ...' rule.
2842N/A $(shell rm -rf $(AGENT_FILES_LIST))
2842N/A# gnumake 3.78.1 does not accept the *'s that
2842N/A# are in AGENT_FILES, so use the shell to expand them.
2842N/A# Be extra carefull to not produce too long command lines in the shell!
2842N/A $(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
2842N/A $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
2796N/A $(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
2796N/A $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
2796N/A $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
2796N/A $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql
2796N/A $(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources
2796N/A $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/*
2796N/A $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/
2796N/A $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
2796N/A $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
2796N/A $(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
2796N/A $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
2796N/A $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.ia64.IA64ThreadContext
2796N/A $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
2796N/A $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext
2796N/A
2796N/Aclean:
2796N/A rm -rf $(SA_CLASSDIR)
2796N/A rm -rf $(GENERATED)/sa-jdi.jar
2842N/A rm -rf $(AGENT_FILES_LIST)