1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/make/windows/makefiles/sa.make Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,149 @@ 1.4 +# 1.5 +# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 +# 1.8 +# This code is free software; you can redistribute it and/or modify it 1.9 +# under the terms of the GNU General Public License version 2 only, as 1.10 +# published by the Free Software Foundation. 1.11 +# 1.12 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 +# version 2 for more details (a copy is included in the LICENSE file that 1.16 +# accompanied this code). 1.17 +# 1.18 +# You should have received a copy of the GNU General Public License version 1.19 +# 2 along with this work; if not, write to the Free Software Foundation, 1.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 +# 1.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 +# or visit www.oracle.com if you need additional information or have any 1.24 +# questions. 1.25 +# 1.26 +# 1.27 + 1.28 +# This makefile is used to build Serviceability Agent code 1.29 +# and generate JNI header file for native methods. 1.30 + 1.31 +AGENT_DIR = $(WorkSpace)/agent 1.32 +checkAndBuildSA:: 1.33 + 1.34 +!if "$(BUILD_WIN_SA)" != "1" 1.35 +# Already warned about this in build.make 1.36 +!else 1.37 + 1.38 +# This first part is used to build sa-jdi.jar 1.39 +!include $(WorkSpace)/make/windows/makefiles/rules.make 1.40 +!include $(WorkSpace)/make/sa.files 1.41 + 1.42 +GENERATED = ../generated 1.43 + 1.44 +# tools.jar is needed by the JDI - SA binding 1.45 +SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar 1.46 + 1.47 +SA_CLASSDIR = $(GENERATED)/saclasses 1.48 + 1.49 +SA_BUILD_VERSION_PROP = sun.jvm.hotspot.runtime.VM.saBuildVersion=$(SA_BUILD_VERSION) 1.50 + 1.51 +SA_PROPERTIES = $(SA_CLASSDIR)/sa.properties 1.52 + 1.53 +default:: $(GENERATED)/sa-jdi.jar 1.54 + 1.55 +# Remove the space between $(SA_BUILD_VERSION_PROP) and > below as it adds a white space 1.56 +# at the end of SA version string and causes a version mismatch with the target VM version. 1.57 + 1.58 +$(GENERATED)/sa-jdi.jar: $(AGENT_FILES) 1.59 + $(QUIETLY) mkdir -p $(SA_CLASSDIR) 1.60 + @echo ...Building sa-jdi.jar into $(SA_CLASSDIR) 1.61 + @echo ...$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -d $(SA_CLASSDIR) .... 1.62 + @$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES) 1.63 + $(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer 1.64 + $(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES) 1.65 + $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js 1.66 + $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql 1.67 + $(QUIETLY) rm -rf $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources 1.68 + $(QUIETLY) mkdir $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources 1.69 + $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources 1.70 + $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR) 1.71 + $(RUN_JAR) cf $@ -C $(SA_CLASSDIR) . 1.72 + $(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector 1.73 + $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal 1.74 + $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext 1.75 + $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext 1.76 + $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.asm.Disassembler 1.77 + 1.78 + 1.79 + 1.80 +# This second part is used to build sawindbg.dll 1.81 +# We currently build it the same way for product, debug, and fastdebug. 1.82 + 1.83 +SAWINDBG=sawindbg.dll 1.84 + 1.85 +checkAndBuildSA:: $(SAWINDBG) 1.86 + 1.87 +# These do not need to be optimized (don't run a lot of code) and it 1.88 +# will be useful to have the assertion checks in place 1.89 + 1.90 +!if "$(BUILDARCH)" == "ia64" 1.91 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c 1.92 +!elseif "$(BUILDARCH)" == "amd64" 1.93 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN64" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -c 1.94 +!if "$(COMPILER_NAME)" == "VS2005" 1.95 +# On amd64, VS2005 compiler requires bufferoverflowU.lib on the link command line, 1.96 +# otherwise we get missing __security_check_cookie externals at link time. 1.97 +SA_LD_FLAGS = bufferoverflowU.lib 1.98 +!endif 1.99 +!else 1.100 +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c 1.101 +!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" 1.102 +SA_CFLAGS = $(SA_CFLAGS) -ZI 1.103 +!endif 1.104 +!endif 1.105 +!if "$(MT)" != "" 1.106 +SA_LD_FLAGS = -manifest $(SA_LD_FLAGS) 1.107 +!endif 1.108 + 1.109 +SASRCFILES = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp \ 1.110 + $(AGENT_DIR)/src/share/native/sadis.c 1.111 + 1.112 +SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE) 1.113 +!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" 1.114 +SA_LFLAGS = $(SA_LFLAGS) -map -debug 1.115 +!endif 1.116 +!if "$(BUILDARCH)" == "i486" 1.117 +SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS) 1.118 +!endif 1.119 + 1.120 +SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG) 1.121 + 1.122 +# Note that we do not keep sawindbj.obj around as it would then 1.123 +# get included in the dumpbin command in build_vm_def.sh 1.124 + 1.125 +# In VS2005 or VS2008 the link command creates a .manifest file that we want 1.126 +# to insert into the linked artifact so we do not need to track it separately. 1.127 +# Use ";#2" for .dll and ";#1" for .exe in the MT command below: 1.128 +$(SAWINDBG): $(SASRCFILES) 1.129 + set INCLUDE=$(SA_INCLUDE)$(INCLUDE) 1.130 + $(CXX) @<< 1.131 + -I"$(BootStrapDir)/include" -I"$(BootStrapDir)/include/win32" 1.132 + -I"$(GENERATED)" $(SA_CFLAGS) 1.133 + $(SASRCFILES) 1.134 + -out:$*.obj 1.135 +<< 1.136 + set LIB=$(SA_LIB)$(LIB) 1.137 + $(LD) -out:$@ -DLL sawindbg.obj sadis.obj dbgeng.lib $(SA_LFLAGS) 1.138 +!if "$(MT)" != "" 1.139 + $(MT) -manifest $(@F).manifest -outputresource:$(@F);#2 1.140 +!endif 1.141 +!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" 1.142 +!if "$(ZIP_DEBUGINFO_FILES)" == "1" 1.143 + $(ZIPEXE) -q $*.diz $*.map $*.pdb 1.144 + $(RM) $*.map $*.pdb 1.145 +!endif 1.146 +!endif 1.147 + -@rm -f $*.obj 1.148 + 1.149 +cleanall : 1.150 + rm -rf $(GENERATED)/saclasses 1.151 + rm -rf $(GENERATED)/sa-jdi.jar 1.152 +!endif