1 #
   2 # Copyright (c) 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 default: all
  27 
  28 include $(SPEC)
  29 include MakeBase.gmk
  30 include JavaCompilation.gmk
  31 include SetupJavaCompilers.gmk
  32 
  33 GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.vm.ci
  34 SRC_DIR := $(HOTSPOT_TOPDIR)/src/jdk.vm.ci/share/classes
  35 
  36 ################################################################################
  37 # Compile the annotation processor
  38 
  39 $(eval $(call SetupJavaCompilation, BUILD_JVMCI_OPTIONS, \
  40     SETUP := GENERATE_OLDBYTECODE, \
  41     SRC := $(SRC_DIR)/jdk.vm.ci.options/src \
  42         $(SRC_DIR)/jdk.vm.ci.options.processor/src \
  43         $(SRC_DIR)/jdk.vm.ci.inittimer/src, \
  44     BIN := $(BUILDTOOLS_OUTPUTDIR)/jvmci_options, \
  45     JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.options.jar, \
  46 ))
  47 
  48 $(eval $(call SetupJavaCompilation, BUILD_JVMCI_SERVICE, \
  49     SETUP := GENERATE_OLDBYTECODE, \
  50     SRC := $(SRC_DIR)/jdk.vm.ci.service/src \
  51         $(SRC_DIR)/jdk.vm.ci.service.processor/src, \
  52     BIN := $(BUILDTOOLS_OUTPUTDIR)/jvmci_service, \
  53     JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.service.jar, \
  54 ))
  55 
  56 ################################################################################
  57 
  58 PROC_SRC_SUBDIRS := \
  59     jdk.vm.ci.hotspot \
  60     jdk.vm.ci.hotspot.amd64 \
  61     jdk.vm.ci.hotspot.sparc \
  62     jdk.vm.ci.runtime \
  63     #
  64 
  65 PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS))
  66 
  67 PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS)))
  68 
  69 ALL_SRC_DIRS := $(wildcard $(SRC_DIR)/*/src)
  70 SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS))
  71 PROCESSOR_PATH := $(call PathList, \
  72     $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.options.jar \
  73     $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.service.jar)
  74 
  75 $(GENSRC_DIR)/_gensrc_proc_done: $(PROC_SRCS) \
  76     $(BUILD_JVMCI_OPTIONS) $(BUILD_JVMCI_SERVICE)
  77         $(MKDIR) -p $(@D)
  78         $(eval $(call ListPathsSafely,PROC_SRCS,$(@D)/_gensrc_proc_files))
  79         $(JAVA_SMALL) $(NEW_JAVAC) \
  80             -XDignore.symbol.file \
  81             -sourcepath $(SOURCEPATH) \
  82             -implicit:none \
  83             -proc:only \
  84             -processorpath $(PROCESSOR_PATH) \
  85             -d $(GENSRC_DIR) \
  86             -s $(GENSRC_DIR) \
  87             @$(@D)/_gensrc_proc_files
  88         $(TOUCH) $@
  89 
  90 TARGETS += $(GENSRC_DIR)/_gensrc_proc_done
  91 
  92 ################################################################################
  93 
  94 $(GENSRC_DIR)/META-INF/services/jdk.vm.ci.options.OptionDescriptors: \
  95     $(GENSRC_DIR)/_gensrc_proc_done
  96         $(MKDIR) -p $(@D)
  97         $(FIND) $(GENSRC_DIR) -name '*_OptionDescriptors.java' | $(SED) 's:.*/jdk\.vm\.ci/\(.*\)\.java:\1:' | $(TR) '/' '.' > $@
  98 
  99 TARGETS += $(GENSRC_DIR)/META-INF/services/jdk.vm.ci.options.OptionDescriptors
 100 
 101 ################################################################################
 102 
 103 $(GENSRC_DIR)/_providers_converted: $(GENSRC_DIR)/_gensrc_proc_done
 104         $(MKDIR) -p $(GENSRC_DIR)/META-INF/services
 105         ($(CD) $(GENSRC_DIR)/META-INF/jvmci.providers && \
 106             for i in $$($(LS)); do \
 107               c=$$($(CAT) $$i | $(TR) -d '\n\r'); \
 108               $(ECHO) $$i >> $(GENSRC_DIR)/META-INF/services/$$c.tmp; \
 109             done)
 110         ($(CD) $(GENSRC_DIR)/META-INF/services && \
 111             for i in $$($(LS) *.tmp); do \
 112               $(MV) $$i $${i%.tmp}; \
 113             done)
 114         $(TOUCH) $@
 115 
 116 TARGETS += $(GENSRC_DIR)/_providers_converted
 117 
 118 ################################################################################
 119 
 120 all: $(TARGETS)
 121 
 122 .PHONY: default all