1 #
   2 # Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   3 # Copyright (c) 2018-2019, Azul Systems, Inc. All rights reserved.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.
   9 #
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 #
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #  
  24 #
  25 
  26 # This makefile (jfr.make) is included from the jfr.make in the
  27 # build directories.
  28 #
  29 # It knows how to build and run the tools to generate jfr.
  30 
  31 include $(GAMMADIR)/make/linux/makefiles/rules.make
  32 
  33 # #########################################################################
  34 # Build tools needed for the Jfr source code generation
  35 
  36 TOPDIR      = $(shell echo `pwd`)
  37 GENERATED   = $(TOPDIR)/../generated
  38 
  39 JFR_TOOLS_SRCDIR := $(GAMMADIR)/src/share/vm/jfr
  40 JFR_TOOLS_OUTPUTDIR := $(GENERATED)/tools/jfr
  41 
  42 JFR_OUTPUTDIR := $(GENERATED)/jfrfiles
  43 JFR_SRCDIR := $(GAMMADIR)/src/share/vm/jfr/metadata
  44 
  45 METADATA_XML ?= $(JFR_SRCDIR)/metadata.xml
  46 METADATA_XSD ?= $(JFR_SRCDIR)/metadata.xsd
  47 
  48 # Changing these will trigger a rebuild of generated jfr files.
  49 JFR_DEPS += \
  50     $(METADATA_XML) \
  51     $(METADATA_XSD) \
  52     #
  53 
  54 JfrGeneratedNames = \
  55         jfrEventClasses.hpp \
  56         jfrEventControl.hpp \
  57         jfrEventIds.hpp \
  58         jfrPeriodic.hpp \
  59         jfrTypes.hpp
  60 
  61 JfrGenSource = $(JFR_TOOLS_SRCDIR)/GenerateJfrFiles.java
  62 JfrGenClass = $(JFR_TOOLS_OUTPUTDIR)/build/tools/jfr/GenerateJfrFiles.class
  63 
  64 JfrGeneratedFiles = $(JfrGeneratedNames:%=$(JFR_OUTPUTDIR/%)
  65 
  66 .PHONY: all clean cleanall
  67 
  68 # #########################################################################
  69 
  70 all: $(JfrGeneratedFiles)
  71 
  72 $(JfrGenClass): $(JfrGenSource)
  73         mkdir -p $(@D)
  74         $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JFR_TOOLS_OUTPUTDIR) $(JfrGenSource)
  75 
  76 $(JFR_OUTPUTDIR)/jfrEventClasses.hpp: $(METADATA_XML) $(METADATA_XSD) $(JfrGenClass)
  77         $(QUIETLY) echo Generating $(@F)
  78         mkdir -p $(@D)
  79         $(QUIETLY) $(REMOTE) $(RUN.JAVA) -cp $(JFR_TOOLS_OUTPUTDIR) build.tools.jfr.GenerateJfrFiles $(METADATA_XML) $(METADATA_XSD) $(JFR_OUTPUTDIR)
  80         test -f $@
  81 
  82 $(filter-out $(JFR_OUTPUTDIR)/jfrEventClasses.hpp, $(JfrGeneratedFiles)): $(JFR_OUTPUTDIR)/jfrEventClasses.hpp
  83 
  84 TARGETS += $(JFR_OUTPUTDIR)/jfrEventClasses.hpp
  85 
  86 # #########################################################################
  87 
  88 clean cleanall :
  89         rm $(JfrGenClass) $(JfrGeneratedFiles)
  90 
  91 # #########################################################################
  92