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