1 #
   2 # Copyright (c) 2015, 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 include JarArchive.gmk
  27 include JavaCompilation.gmk
  28 include Modules.gmk
  29 include SetupJavaCompilers.gmk
  30 
  31 ################################################################################
  32 
  33 # Hook to include the corresponding custom file, if present.
  34 $(eval $(call IncludeCustomExtension, gendata/Gendata-jdk.compiler-pre.gmk))
  35 
  36 # This is needed to properly setup DOCS_MODULES.
  37 $(eval $(call ReadImportMetaData))
  38 
  39 # Modules that should be visible for 9 - the documented modules:
  40 CT_MODULES := $(DOCS_MODULES)
  41 
  42 # Get the complete module source path:
  43 CT_MODULESOURCEPATH := $(call GetModuleSrcPath)
  44 
  45 CT_DATA_DESCRIPTION ?= $(TOPDIR)/make/data/symbols/symbols
  46 
  47 COMPILECREATESYMBOLS_ADD_EXPORTS := \
  48     --add-exports jdk.compiler.interim/com.sun.tools.javac.api=ALL-UNNAMED \
  49     --add-exports jdk.compiler.interim/com.sun.tools.javac.code=ALL-UNNAMED \
  50     --add-exports jdk.compiler.interim/com.sun.tools.javac.util=ALL-UNNAMED \
  51     --add-exports jdk.compiler.interim/com.sun.tools.javac.jvm=ALL-UNNAMED \
  52     --add-exports jdk.jdeps.interim/com.sun.tools.classfile=ALL-UNNAMED \
  53     #
  54 
  55 $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
  56     SETUP := GENERATE_OLDBYTECODE, \
  57     SRC := $(TOPDIR)/make/langtools/src/classes, \
  58     INCLUDES := build/tools/symbolgenerator, \
  59     BIN := $(BUILDTOOLS_OUTPUTDIR)/create_symbols, \
  60     ADD_JAVAC_FLAGS := $(INTERIM_LANGTOOLS_ARGS) \
  61         $(COMPILECREATESYMBOLS_ADD_EXPORTS), \
  62 ))
  63 
  64 $(SUPPORT_OUTPUTDIR)/symbols/ct.sym-files/_the.symbols: \
  65     $(COMPILE_CREATE_SYMBOLS) \
  66     $(wildcard $(TOPDIR)/make/data/symbols/*) \
  67     $(MODULE_INFOS)
  68         $(RM) -r $(@D)
  69         $(MKDIR) -p $(@D)
  70         $(ECHO) Creating ct.sym classes
  71         $(JAVA_SMALL) $(INTERIM_LANGTOOLS_ARGS) \
  72             $(COMPILECREATESYMBOLS_ADD_EXPORTS) \
  73             -classpath $(BUILDTOOLS_OUTPUTDIR)/create_symbols \
  74             build.tools.symbolgenerator.CreateSymbols \
  75             build-ctsym \
  76             $(CT_DATA_DESCRIPTION) \
  77             $(@D)
  78         $(MKDIR) $(@D)/A
  79         $(JAVA_SMALL) $(INTERIM_LANGTOOLS_ARGS) \
  80             $(COMPILECREATESYMBOLS_ADD_EXPORTS) \
  81             -classpath $(BUILDTOOLS_OUTPUTDIR)/create_symbols \
  82             build.tools.symbolgenerator.TransitiveDependencies \
  83             $(CT_MODULESOURCEPATH) \
  84             $(CT_MODULES) \
  85             >$(@D)/A/system-modules
  86         $(TOUCH) $@
  87 
  88 # Can't generate ct.sym directly into modules libs as the SetupJarArchive macro
  89 # creates meta data files in the output dir.
  90 $(eval $(call SetupJarArchive, CREATE_CTSYM, \
  91     DEPENDENCIES := $(SUPPORT_OUTPUTDIR)/symbols/ct.sym-files/_the.symbols, \
  92     SRCS := $(SUPPORT_OUTPUTDIR)/symbols/ct.sym-files, \
  93     SUFFIXES := .sig system-modules, \
  94     JAR := $(SUPPORT_OUTPUTDIR)/symbols/ct.sym, \
  95 ))
  96 
  97 # Copy ct.sym to the modules libs dir
  98 $(eval $(call SetupCopyFiles, COPY_TO_LIBS, \
  99     FILES := $(SUPPORT_OUTPUTDIR)/symbols/ct.sym, \
 100     DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.compiler, \
 101 ))
 102 
 103 TARGETS += $(CREATE_CTSYM) $(COPY_TO_LIBS)
 104 
 105 ################################################################################