Thu, 31 Oct 2013 12:36:10 -0700
Added tag jdk8-b114 for changeset 7fd913010dbb
never@3156 | 1 | # |
minqi@4093 | 2 | # Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
never@3156 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
never@3156 | 4 | # |
never@3156 | 5 | # This code is free software; you can redistribute it and/or modify it |
never@3156 | 6 | # under the terms of the GNU General Public License version 2 only, as |
never@3156 | 7 | # published by the Free Software Foundation. |
never@3156 | 8 | # |
never@3156 | 9 | # This code is distributed in the hope that it will be useful, but WITHOUT |
never@3156 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
never@3156 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
never@3156 | 12 | # version 2 for more details (a copy is included in the LICENSE file that |
never@3156 | 13 | # accompanied this code). |
never@3156 | 14 | # |
never@3156 | 15 | # You should have received a copy of the GNU General Public License version |
never@3156 | 16 | # 2 along with this work; if not, write to the Free Software Foundation, |
never@3156 | 17 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
never@3156 | 18 | # |
never@3156 | 19 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
never@3156 | 20 | # or visit www.oracle.com if you need additional information or have any |
never@3156 | 21 | # questions. |
never@3156 | 22 | # |
never@3156 | 23 | # |
never@3156 | 24 | |
never@3156 | 25 | # This makefile (sa.make) is included from the sa.make in the |
never@3156 | 26 | # build directories. |
never@3156 | 27 | |
never@3156 | 28 | # This makefile is used to build Serviceability Agent java code |
never@3156 | 29 | # and generate JNI header file for native methods. |
never@3156 | 30 | |
never@3156 | 31 | include $(GAMMADIR)/make/bsd/makefiles/rules.make |
never@3156 | 32 | |
never@3156 | 33 | AGENT_DIR = $(GAMMADIR)/agent |
never@3156 | 34 | |
never@3156 | 35 | include $(GAMMADIR)/make/sa.files |
never@3156 | 36 | |
never@3156 | 37 | TOPDIR = $(shell echo `pwd`) |
never@3156 | 38 | GENERATED = $(TOPDIR)/../generated |
never@3156 | 39 | |
dcubed@3304 | 40 | # SA-JDI depends on the standard JDI classes. |
dcubed@3304 | 41 | # Default SA_CLASSPATH location: |
dcubed@3304 | 42 | DEF_SA_CLASSPATH=$(BOOT_JAVA_HOME)/lib/tools.jar |
dcubed@3304 | 43 | ifeq ($(ALT_SA_CLASSPATH),) |
dcubed@3304 | 44 | # no alternate specified; see if default exists |
dcubed@3304 | 45 | SA_CLASSPATH=$(shell test -f $(DEF_SA_CLASSPATH) && echo $(DEF_SA_CLASSPATH)) |
dcubed@3304 | 46 | ifeq ($(SA_CLASSPATH),) |
dcubed@3304 | 47 | # the default doesn't exist |
dcubed@3304 | 48 | ifeq ($(OS_VENDOR), Darwin) |
dcubed@3304 | 49 | # A JDK from Apple doesn't have tools.jar; the JDI classes are |
dcubed@3304 | 50 | # are in the regular classes.jar file. |
dcubed@3304 | 51 | APPLE_JAR=$(BOOT_JAVA_HOME)/bundle/Classes/classes.jar |
dcubed@3304 | 52 | SA_CLASSPATH=$(shell test -f $(APPLE_JAR) && echo $(APPLE_JAR)) |
dcubed@3304 | 53 | endif |
dcubed@3304 | 54 | endif |
dcubed@3202 | 55 | else |
dcubed@3304 | 56 | _JUNK_ := $(shell echo >&2 "INFO: ALT_SA_CLASSPATH=$(ALT_SA_CLASSPATH)") |
dcubed@3304 | 57 | SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH)) |
dcubed@3202 | 58 | endif |
never@3156 | 59 | |
never@3156 | 60 | # TODO: if it's a modules image, check if SA module is installed. |
never@3156 | 61 | MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules |
never@3156 | 62 | |
dcubed@3202 | 63 | AGENT_FILES_LIST := $(GENERATED)/agent.classes.list |
never@3156 | 64 | |
never@3156 | 65 | SA_CLASSDIR = $(GENERATED)/saclasses |
never@3156 | 66 | |
never@3156 | 67 | SA_BUILD_VERSION_PROP = "sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION)" |
never@3156 | 68 | |
never@3156 | 69 | SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties |
never@3156 | 70 | |
never@3156 | 71 | # if $(AGENT_DIR) does not exist, we don't build SA |
never@3156 | 72 | # also, we don't build SA on Itanium, PowerPC, ARM or zero. |
never@3156 | 73 | |
never@3156 | 74 | all: |
never@3156 | 75 | if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \ |
never@3156 | 76 | -a "$(SRCARCH)" != "arm" \ |
never@3156 | 77 | -a "$(SRCARCH)" != "ppc" \ |
never@3156 | 78 | -a "$(SRCARCH)" != "zero" ] ; then \ |
never@3156 | 79 | $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \ |
never@3156 | 80 | fi |
never@3156 | 81 | |
dcubed@3202 | 82 | $(GENERATED)/sa-jdi.jar: $(AGENT_FILES) |
never@3156 | 83 | $(QUIETLY) echo "Making $@" |
never@3156 | 84 | $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ |
never@3156 | 85 | echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ |
never@3156 | 86 | exit 1; \ |
never@3156 | 87 | fi |
dcubed@3304 | 88 | $(QUIETLY) if [ ! -f "$(SA_CLASSPATH)" -a ! -d $(MODULELIB_PATH) ] ; then \ |
dcubed@3304 | 89 | echo "Cannot find JDI classes. Use 1.6.0 or later version of JDK."; \ |
never@3156 | 90 | echo ""; \ |
never@3156 | 91 | exit 1; \ |
never@3156 | 92 | fi |
never@3156 | 93 | $(QUIETLY) if [ ! -d $(SA_CLASSDIR) ] ; then \ |
never@3156 | 94 | mkdir -p $(SA_CLASSDIR); \ |
never@3156 | 95 | fi |
never@3156 | 96 | # Note: When indented, make tries to execute the '$(shell' comment. |
never@3156 | 97 | # In some environments, cmd processors have limited line length. |
never@3156 | 98 | # To prevent the javac invocation in the next block from using |
never@3156 | 99 | # a very long cmd line, we use javac's @file-list option. We |
never@3156 | 100 | # generate the file lists using make's built-in 'foreach' control |
never@3156 | 101 | # flow which also avoids cmd processor line length issues. Since |
never@3156 | 102 | # the 'foreach' is done as part of make's macro expansion phase, |
never@3156 | 103 | # the initialization of the lists is also done in the same phase |
never@3156 | 104 | # using '$(shell rm ...' instead of using the more traditional |
never@3156 | 105 | # 'rm ...' rule. |
dcubed@3202 | 106 | $(shell rm -rf $(AGENT_FILES_LIST)) |
dcubed@3202 | 107 | # gnumake 3.78.1 does not accept the *'s that |
dcubed@3202 | 108 | # are in AGENT_FILES, so use the shell to expand them. |
dcubed@3202 | 109 | # Be extra carefull to not produce too long command lines in the shell! |
dcubed@3202 | 110 | $(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST))) |
dcubed@3202 | 111 | $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST) |
never@3156 | 112 | $(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer |
never@3156 | 113 | $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) |
never@3156 | 114 | $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js |
never@3156 | 115 | $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql |
never@3156 | 116 | $(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources |
never@3156 | 117 | $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/* |
never@3156 | 118 | $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ |
never@3156 | 119 | $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ |
never@3156 | 120 | $(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ . |
never@3156 | 121 | $(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector |
never@3156 | 122 | $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext |
never@3156 | 123 | $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext |
never@3156 | 124 | $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext |
minqi@4093 | 125 | $(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler |
never@3156 | 126 | |
never@3156 | 127 | clean: |
never@3156 | 128 | rm -rf $(SA_CLASSDIR) |
never@3156 | 129 | rm -rf $(GENERATED)/sa-jdi.jar |
dcubed@3202 | 130 | rm -rf $(AGENT_FILES_LIST) |