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