1 #
   2 # Copyright (c) 2003, 2016, 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.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #
  23 #
  24 
  25 # This makefile (trace.make) is included from the trace.make in the
  26 # build directories.
  27 #
  28 # It knows how to build and run the tools to generate trace files.
  29 
  30 include $(GAMMADIR)/make/linux/makefiles/rules.make
  31 include $(GAMMADIR)/make/altsrc.make
  32 
  33 # #########################################################################
  34 
  35 HAS_ALT_SRC := false
  36 ifndef OPENJDK
  37   ifneq ($(wildcard $(HS_ALT_SRC)/share/vm/trace), )
  38     HAS_ALT_SRC := true
  39   endif
  40 endif
  41 
  42 TOPDIR      = $(shell echo `pwd`)
  43 GENERATED   = $(TOPDIR)/../generated
  44 JvmtiOutDir = $(GENERATED)/jvmtifiles
  45 TraceOutDir   = $(GENERATED)/tracefiles
  46 
  47 TraceAltSrcDir = $(HS_ALT_SRC)/share/vm/trace
  48 TraceSrcDir = $(HS_COMMON_SRC)/share/vm/trace
  49 
  50 # set VPATH so make knows where to look for source files
  51 Src_Dirs_V += $(TraceSrcDir) $(TraceAltSrcDir)
  52 VPATH += $(Src_Dirs_V:%=%:)
  53 
  54 TraceGeneratedNames =     \
  55     traceEventClasses.hpp \
  56         traceEventIds.hpp     \
  57         traceTypes.hpp
  58 
  59 ifeq ($(HAS_ALT_SRC), true)
  60 TraceGeneratedNames +=  \
  61         traceRequestables.hpp \
  62     traceEventControl.hpp
  63 endif
  64 
  65 TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)
  66 
  67 XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen
  68 
  69 TraceXml = $(TraceSrcDir)/trace.xml
  70 ifeq ($(HAS_ALT_SRC), true)
  71   TraceXml = $(TraceAltSrcDir)/trace.xml
  72 endif
  73 
  74 XML_DEPS = $(TraceXml) $(TraceSrcDir)/tracetypes.xml \
  75     $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod \
  76     $(TraceSrcDir)/tracerelationdecls.xml $(TraceSrcDir)/traceevents.xml
  77 ifeq ($(HAS_ALT_SRC), true)
  78   XML_DEPS += $(TraceAltSrcDir)/traceeventscustom.xml \
  79       $(TraceAltSrcDir)/traceeventtypes.xml
  80 endif
  81 
  82 .PHONY: all clean cleanall
  83 
  84 # #########################################################################
  85 
  86 all: $(TraceGeneratedFiles)
  87 
  88 GENERATE_CODE= \
  89   $(QUIETLY) echo $(LOG_INFO) Generating $@; \
  90   $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@
  91 
  92 $(TraceOutDir)/traceEventIds.hpp: $(TraceXml) $(TraceSrcDir)/traceEventIds.xsl $(XML_DEPS)
  93         $(GENERATE_CODE)
  94 
  95 $(TraceOutDir)/traceTypes.hpp: $(TraceXml) $(TraceSrcDir)/traceTypes.xsl $(XML_DEPS)
  96         $(GENERATE_CODE)
  97 
  98 ifeq ($(HAS_ALT_SRC), false)
  99 
 100 $(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS)
 101         $(GENERATE_CODE)
 102 
 103 else
 104 
 105 $(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS)
 106         $(GENERATE_CODE)
 107 
 108 $(TraceOutDir)/traceRequestables.hpp: $(TraceXml) $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS)
 109         $(GENERATE_CODE)
 110 
 111 $(TraceOutDir)/traceEventControl.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS)
 112         $(GENERATE_CODE)
 113 
 114 endif
 115 
 116 # #########################################################################
 117 
 118 clean cleanall:
 119         rm $(TraceGeneratedFiles)