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 $(WorkSpace)/make/windows/makefiles/rules.make
  32 
  33 # #########################################################################
  34 # Build tools needed for the Jfr source code generation
  35 
  36 GENERATED   = ../generated
  37 
  38 JFR_TOOLS_SRCDIR = $(WorkSpace)/src/share/vm/jfr
  39 JFR_TOOLS_OUTPUTDIR = $(GENERATED)/tools/jfr
  40 
  41 JFR_OUTPUTDIR = $(GENERATED)/jfrfiles
  42 JFR_SRCDIR = $(WorkSpace)/src/share/vm/jfr/metadata
  43 
  44 METADATA_XML = $(JFR_SRCDIR)/metadata.xml
  45 METADATA_XSD = $(JFR_SRCDIR)/metadata.xsd
  46 
  47 # Changing these will trigger a rebuild of generated jfr files.
  48 JFR_DEPS = $(METADATA_XML) \
  49         $(METADATA_XSD)
  50 
  51 JfrGeneratedFiles = \
  52         $(JFR_OUTPUTDIR)/jfrEventControl.hpp \
  53         $(JFR_OUTPUTDIR)/jfrEventIds.hpp \
  54         $(JFR_OUTPUTDIR)/jfrPeriodic.hpp \
  55         $(JFR_OUTPUTDIR)/jfrTypes.hpp
  56 
  57 JfrGenSource = $(JFR_TOOLS_SRCDIR)/GenerateJfrFiles.java
  58 JfrGenClass = $(JFR_TOOLS_OUTPUTDIR)/build/tools/jfr/GenerateJfrFiles.class
  59 
  60 .PHONY: all cleanall
  61 
  62 # #########################################################################
  63 
  64 all: $(JfrGeneratedFiles)
  65 
  66 $(JfrGenClass): $(JfrGenSource)
  67         mkdir -p $(@D)
  68         $(COMPILE_JAVAC) -d $(JFR_TOOLS_OUTPUTDIR) $(JfrGenSource)
  69 
  70 $(JFR_OUTPUTDIR)/jfrEventClasses.hpp: $(METADATA_XML) $(METADATA_XSD) $(JfrGenClass)
  71         echo Generating $(@F)
  72         mkdir -p $(@D)
  73         $(RUN_JAVA) -cp $(JFR_TOOLS_OUTPUTDIR) build.tools.jfr.GenerateJfrFiles $(METADATA_XML) $(METADATA_XSD) $(JFR_OUTPUTDIR)
  74         test -f $@
  75 
  76 $(JfrGeneratedFiles): $(JFR_OUTPUTDIR)/jfrEventClasses.hpp
  77 
  78 # #########################################################################
  79 
  80 cleanall :
  81         rm $(JfrGenClass) $(JfrGeneratedFiles) $(JFR_OUTPUTDIR)/jfrEventClasses.hpp