1 #
   2 # Copyright (c) 2016, 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 Tools.gmk
  31 
  32 $(eval $(call IncludeCustomExtension, hotspot, gensrc/Gensrc-jdk.vm.compiler.gmk))
  33 
  34 GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)
  35 SRC_DIR := $(HOTSPOT_TOPDIR)/src/$(MODULE)/share/classes
  36 
  37 ################################################################################
  38 
  39 PROC_SRC_SUBDIRS := \
  40     com.oracle.graal.code \
  41     com.oracle.graal.compiler \
  42     com.oracle.graal.compiler.aarch64 \
  43     com.oracle.graal.compiler.amd64 \
  44     com.oracle.graal.compiler.common \
  45     com.oracle.graal.compiler.sparc \
  46     com.oracle.graal.debug \
  47     com.oracle.graal.hotspot \
  48     com.oracle.graal.hotspot.aarch64 \
  49     com.oracle.graal.hotspot.amd64 \
  50     com.oracle.graal.hotspot.sparc \
  51     com.oracle.graal.graph \
  52     com.oracle.graal.java \
  53     com.oracle.graal.lir \
  54     com.oracle.graal.lir.amd64 \
  55     com.oracle.graal.loop \
  56     com.oracle.graal.loop.phases \
  57     com.oracle.graal.nodes \
  58     com.oracle.graal.replacements \
  59     com.oracle.graal.replacements.aarch64 \
  60     com.oracle.graal.replacements.amd64 \
  61     com.oracle.graal.phases \
  62     com.oracle.graal.phases.common \
  63     com.oracle.graal.printer \
  64     com.oracle.graal.virtual \
  65     #
  66 
  67 PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS))
  68 
  69 PROC_SRCS := $(filter %.java, $(call CacheFind, $(PROC_SRC_DIRS)))
  70 
  71 ALL_SRC_DIRS := $(wildcard $(SRC_DIR)/*/src)
  72 SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS))
  73 
  74 PROCESSOR_JARS := \
  75     $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.match.processor.jar \
  76     $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.nodeinfo.processor.jar \
  77     $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.options.processor.jar \
  78     $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar \
  79     $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.serviceprovider.processor.jar \
  80     #
  81 PROCESSOR_PATH := $(call PathList, $(PROCESSOR_JARS))
  82 
  83 ADD_EXPORTS := \
  84     --add-exports jdk.vm.ci/jdk.vm.ci.aarch64=ALL-UNNAMED \
  85     --add-exports jdk.vm.ci/jdk.vm.ci.amd64=ALL-UNNAMED \
  86     --add-exports jdk.vm.ci/jdk.vm.ci.code=ALL-UNNAMED \
  87     --add-exports jdk.vm.ci/jdk.vm.ci.code.site=ALL-UNNAMED \
  88     --add-exports jdk.vm.ci/jdk.vm.ci.code.stack=ALL-UNNAMED \
  89     --add-exports jdk.vm.ci/jdk.vm.ci.common=ALL-UNNAMED \
  90     --add-exports jdk.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED \
  91     --add-exports jdk.vm.ci/jdk.vm.ci.hotspot.aarch64=ALL-UNNAMED \
  92     --add-exports jdk.vm.ci/jdk.vm.ci.hotspot.amd64=ALL-UNNAMED \
  93     --add-exports jdk.vm.ci/jdk.vm.ci.hotspot.events=ALL-UNNAMED \
  94     --add-exports jdk.vm.ci/jdk.vm.ci.hotspot.sparc=ALL-UNNAMED \
  95     --add-exports jdk.vm.ci/jdk.vm.ci.hotspotvmconfig=ALL-UNNAMED \
  96     --add-exports jdk.vm.ci/jdk.vm.ci.inittimer=ALL-UNNAMED \
  97     --add-exports jdk.vm.ci/jdk.vm.ci.meta=ALL-UNNAMED \
  98     --add-exports jdk.vm.ci/jdk.vm.ci.runtime=ALL-UNNAMED \
  99     --add-exports jdk.vm.ci/jdk.vm.ci.services=ALL-UNNAMED \
 100     --add-exports jdk.vm.ci/jdk.vm.ci.sparc=ALL-UNNAMED \
 101     #
 102 
 103 $(GENSRC_DIR)/_gensrc_proc_done: $(PROC_SRCS) $(PROCESSOR_JARS)
 104         $(call MakeDir, $(@D))
 105         $(eval $(call ListPathsSafely,PROC_SRCS,$(@D)/_gensrc_proc_files))
 106         $(JAVA_SMALL) $(NEW_JAVAC) \
 107             -XDignore.symbol.file \
 108             --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none \
 109             $(ADD_EXPORTS) \
 110             -sourcepath $(SOURCEPATH) \
 111             -implicit:none \
 112             -proc:only \
 113             -processorpath $(PROCESSOR_PATH) \
 114             -d $(GENSRC_DIR) \
 115             -s $(GENSRC_DIR) \
 116             @$(@D)/_gensrc_proc_files
 117         $(TOUCH) $@
 118 
 119 TARGETS += $(GENSRC_DIR)/_gensrc_proc_done
 120 
 121 ################################################################################
 122 
 123 $(GENSRC_DIR)/module-info.java.extra: $(GENSRC_DIR)/_gensrc_proc_done
 124         ($(CD) $(GENSRC_DIR)/META-INF/providers && \
 125             for i in $$($(LS)); do \
 126               c=$$($(CAT) $$i | $(TR) -d '\n\r'); \
 127               $(ECHO) "provides $$c with $$i;" >> $@; \
 128             done); \
 129         $(ECHO) "uses com.oracle.graal.options.OptionDescriptors;" >> $@; \
 130         for i in $$($(FIND) $(GENSRC_DIR) -name '*_OptionDescriptors.java'); do \
 131             c=$$($(ECHO) $$i | $(SED) 's:.*/jdk\.vm\.compiler/\(.*\)\.java:\1:' | $(TR) '/' '.'); \
 132             $(ECHO) "provides com.oracle.graal.options.OptionDescriptors with $$c;" >> $@; \
 133         done
 134 
 135 TARGETS += $(GENSRC_DIR)/module-info.java.extra
 136 
 137 ################################################################################
 138 
 139 all: $(TARGETS)
 140 
 141 .PHONY: default all