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