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