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_SERVICE, \
  40     SETUP := GENERATE_OLDBYTECODE, \
  41     SRC := $(SRC_DIR)/jdk.vm.ci.service/src \
  42         $(SRC_DIR)/jdk.vm.ci.service.processor/src, \
  43     BIN := $(BUILDTOOLS_OUTPUTDIR)/jvmci_service, \
  44     JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.service.jar, \
  45 ))
  46 
  47 ################################################################################
  48 
  49 PROC_SRC_SUBDIRS := \
  50     jdk.vm.ci.hotspot \
  51     jdk.vm.ci.hotspot.aarch64 \
  52     jdk.vm.ci.hotspot.amd64 \
  53     jdk.vm.ci.hotspot.sparc \
  54     jdk.vm.ci.runtime \
  55     #
  56 
  57 PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS))
  58 
  59 PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS)))
  60 
  61 ALL_SRC_DIRS := $(wildcard $(SRC_DIR)/*/src)
  62 SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS))
  63 PROCESSOR_PATH := $(call PathList, \
  64     $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.service.jar)
  65 
  66 $(GENSRC_DIR)/_gensrc_proc_done: $(PROC_SRCS) \
  67     $(BUILD_JVMCI_SERVICE)
  68         $(MKDIR) -p $(@D)
  69         $(eval $(call ListPathsSafely,PROC_SRCS,$(@D)/_gensrc_proc_files))
  70         $(JAVA_SMALL) $(NEW_JAVAC) \
  71             -XDignore.symbol.file \
  72             -sourcepath $(SOURCEPATH) \
  73             -implicit:none \
  74             -proc:only \
  75             -processorpath $(PROCESSOR_PATH) \
  76             -d $(GENSRC_DIR) \
  77             -s $(GENSRC_DIR) \
  78             @$(@D)/_gensrc_proc_files
  79         $(TOUCH) $@
  80 
  81 TARGETS += $(GENSRC_DIR)/_gensrc_proc_done
  82 
  83 ################################################################################
  84 
  85 $(GENSRC_DIR)/_providers_converted: $(GENSRC_DIR)/_gensrc_proc_done
  86         $(MKDIR) -p $(GENSRC_DIR)/META-INF/services
  87         ($(CD) $(GENSRC_DIR)/META-INF/jvmci.providers && \
  88             for i in $$($(LS)); do \
  89               c=$$($(CAT) $$i | $(TR) -d '\n\r'); \
  90               $(ECHO) $$i >> $(GENSRC_DIR)/META-INF/services/$$c.tmp; \
  91             done)
  92         ($(CD) $(GENSRC_DIR)/META-INF/services && \
  93             for i in $$($(LS) *.tmp); do \
  94               $(MV) $$i $${i%.tmp}; \
  95             done)
  96         $(TOUCH) $@
  97 
  98 TARGETS += $(GENSRC_DIR)/_providers_converted
  99 
 100 ################################################################################
 101 
 102 all: $(TARGETS)
 103 
 104 .PHONY: default all