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