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