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         $(call LogInfo, Creating JDWP.java and JDWPCommands.h from jdwp.spec)
  44         $(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent)
  45         $(RM) $@ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
  46         $(TOOL_JDWPGEN) $< -jdi $@ -include \
  47             $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
  48         $(TOUCH) $@
  49 
  50 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
  51     $(BUILD_TOOLS_JDK)
  52         $(call LogInfo, Creating $(@F) from jdwp.spec)
  53         $(call MakeDir, $(@D))
  54         $(RM) $@
  55         $(TOOL_JDWPGEN) $< -doc $@
  56 
  57 GENSRC_JDWP := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
  58     $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h \
  59     $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
  60 GENSRC_JDK_JDI += $(GENSRC_JDWP)
  61 
  62 ################################################################################
  63 
  64 define process-provider
  65         $(call MakeDir, $(@D))
  66         $(CAT) $^ | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $@
  67 endef
  68 
  69 # Filter com.sun.jdi.connect.Connector
  70 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
  71     $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
  72     $(HOTSPOT_TOPDIR)/agent/src/share/classes/META-INF/services/com.sun.jdi.connect.Connector
  73         $(process-provider)
  74 
  75 # Copy the same service file into jdk.hotspot.agent so that they are kept the same.
  76 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector: \
  77     $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector
  78         $(install-file)
  79 
  80 # Some platforms don't have the serviceability agent
  81 ifeq (, $(filter $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), aix-ppc64))
  82   ifneq ($(JVM_VARIANT_ZERO), true)
  83     GENSRC_JDK_JDI += $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector \
  84         $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector
  85   endif
  86 endif
  87 
  88 ################################################################################
  89 
  90 include GensrcProperties.gmk
  91 
  92 $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
  93     SRC_DIRS := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/com/sun/tools/jdi/resources, \
  94     CLASS := ListResourceBundle, \
  95 ))
  96 
  97 GENSRC_JDK_JDI += $(COMPILE_PROPERTIES)
  98 
  99 ################################################################################
 100 
 101 jdk.jdi: $(GENSRC_JDK_JDI)
 102 
 103 all: jdk.jdi
 104 
 105 .PHONY: all jdk.jdi