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