1 #
   2 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 include GensrcCommon.gmk
  27 
  28 ################################################################################
  29 # Translate the Java debugger wire protocol (jdwp.spec) file into a JDWP.java file
  30 # and a JDWPCommands.h C-header file.
  31 
  32 JDWP_SPEC_FILE := $(JDK_TOPDIR)/make/data/jdwp/jdwp.spec
  33 HEADER_FILE := $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
  34 JAVA_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java
  35 
  36 # Both the header and java file are created using the same recipe. By declaring
  37 # this rule and adding header file to dependencies for java file, both are
  38 # rebuilt if either is missing
  39 $(HEADER_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK)
  40 
  41 # Touch the target of this rule at the end to avoid triggering false rebuilds
  42 $(JAVA_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) $(HEADER_FILE)
  43         $(MKDIR) -p $(@D)
  44         $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent
  45         $(RM) $@ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
  46         $(ECHO) $(LOG_INFO) Creating JDWP.java and JDWPCommands.h from jdwp.spec
  47         $(TOOL_JDWPGEN) $< -jdi $@ -include \
  48             $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
  49         $(TOUCH) $@
  50 
  51 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
  52     $(BUILD_TOOLS_JDK)
  53         $(MKDIR) -p $(@D)
  54         $(RM) $@
  55         $(ECHO) $(LOG_INFO) Creating $(@F) from jdwp.spec
  56         $(TOOL_JDWPGEN) $< -doc $@
  57 
  58 GENSRC_JDWP := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
  59     $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h \
  60     $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
  61 GENSRC_JDK_JDI += $(GENSRC_JDWP)
  62 
  63 ################################################################################
  64 
  65 define process-provider
  66         $(MKDIR) -p $(@D)
  67         $(CAT) $^ | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $@
  68 endef
  69 
  70 # Filter com.sun.jdi.connect.Connector
  71 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
  72     $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
  73     $(HOTSPOT_TOPDIR)/agent/src/share/classes/META-INF/services/com.sun.jdi.connect.Connector
  74         $(process-provider)
  75 
  76 # Copy the same service file into jdk.hotspot.agent so that they are kept the same.
  77 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector: \
  78     $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector
  79         $(install-file)
  80 
  81 # Some platforms don't have the serviceability agent
  82 ifeq (, $(filter $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), aix-ppc64))
  83   ifneq ($(JVM_VARIANT_ZERO), true)
  84     GENSRC_JDK_JDI += $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector \
  85         $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector
  86   endif
  87 endif
  88 
  89 ################################################################################
  90 
  91 include GensrcProperties.gmk
  92 
  93 $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
  94     SRC_DIRS := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/com/sun/tools/jdi/resources, \
  95     CLASS := ListResourceBundle, \
  96 ))
  97 
  98 GENSRC_JDK_JDI += $(COMPILE_PROPERTIES)
  99 
 100 ################################################################################
 101 
 102 jdk.jdi: $(GENSRC_JDK_JDI)
 103 
 104 all: jdk.jdi
 105 
 106 .PHONY: all jdk.jdi