Modules.gmk revision 1203:5673f89cd541
1104349Sphk#
2104349Sphk# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3104349Sphk# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4104349Sphk#
5178848Scokane# This code is free software; you can redistribute it and/or modify it
6178848Scokane# under the terms of the GNU General Public License version 2 only, as
7104349Sphk# published by the Free Software Foundation.  Oracle designates this
8104349Sphk# particular file as subject to the "Classpath" exception as provided
9104349Sphk# by Oracle in the LICENSE file that accompanied this code.
10104349Sphk#
11247296Sdelphij# This code is distributed in the hope that it will be useful, but WITHOUT
12178848Scokane# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13178848Scokane# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14178848Scokane# version 2 for more details (a copy is included in the LICENSE file that
15104349Sphk# accompanied this code).
16178848Scokane#
17104349Sphk# You should have received a copy of the GNU General Public License version
18178848Scokane# 2 along with this work; if not, write to the Free Software Foundation,
19104349Sphk# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20104349Sphk#
21178848Scokane# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22104349Sphk# or visit www.oracle.com if you need additional information or have any
23104349Sphk# questions.
24104349Sphk#
25104349Sphk
26104349Sphkifndef _MODULES_GMK
27104349Sphk_MODULES_GMK := 1
28104349Sphk
29104349Sphkinclude JavaCompilation.gmk
30104349Sphkinclude SetupJavaCompilers.gmk
31104349Sphk
32104349Sphk################################################################################
33104349Sphk# Module list macros
34104349Sphk
35104349SphkALL_TOP_SRC_DIRS := \
36104349Sphk    $(JDK_TOPDIR)/src \
37104349Sphk    $(LANGTOOLS_TOPDIR)/src \
38104349Sphk    $(CORBA_TOPDIR)/src \
39104349Sphk    $(JAXP_TOPDIR)/src \
40104349Sphk    $(JAXWS_TOPDIR)/src \
41104349Sphk    $(NASHORN_TOPDIR)/src \
42104349Sphk    #
43104349Sphk
44104349Sphk# Find all modules with java sources by looking in the source dirs
45104349Sphkdefine FindJavaModules
46104349Sphk  $(filter-out $(JAVA_MODULES_FILTER), $(sort $(notdir \
47104349Sphk      $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
48104349Sphk      $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
49104349Sphk          $(patsubst %,%/*/$(OPENJDK_TARGET_OS_API_DIR)/classes/*, $(ALL_TOP_SRC_DIRS)) \
50104349Sphk          $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
51104349Sphkendef
52104349Sphk
53104349Sphk# Find all modules with source for the target platform.
54104349Sphkdefine FindAllModules
55104349Sphk  $(sort $(filter-out closed demo sample, $(notdir $(patsubst %/,%, $(dir \
56104349Sphk      $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
57104349Sphk      $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
58178848Scokane      $(patsubst %, %/*/$(OPENJDK_TARGET_OS_API_DIR), $(ALL_TOP_SRC_DIRS))))))))
59104349Sphkendef
60104349Sphk
61178848Scokane################################################################################
62104349Sphk
63104349Sphk$(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
64178848Scokane    SETUP := BOOT_JAVAC, \
65104349Sphk    SRC := $(JDK_TOPDIR)/make/src/classes, \
66104349Sphk    INCLUDES := build/tools/module, \
67178848Scokane    BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
68104349Sphk    DISABLE_SJAVAC := true))
69104349Sphk
70104349SphkTOOL_GENMODULESLIST = $(JAVA_SMALL) \
71104349Sphk    -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
72104349Sphk    build.tools.module.GenModulesList
73104349Sphk
74104349SphkMODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
75104349SphkMODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
76104349Sphk
77104349Sphk$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml \
78104349Sphk    $(BUILD_GENMODULESLIST)
79104349Sphk	$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
80104349Sphk
81104349Sphk$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
82104349Sphk	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
83104349Sphk
84104349Sphk-include $(MODULE_DEPS_MAKEFILE)
85104349Sphk
86104349Sphk# Param 1: Module to find deps for
87104349Sphkdefine FindDepsForModule
88104349Sphk  $(DEPS_$(strip $1))
89104349Sphkendef
90104349Sphk
91104349Sphk################################################################################
92104349Sphk
93104349Sphk# Hook to include the corresponding custom file, if present.
94104349Sphk$(eval $(call IncludeCustomExtension, , common/Modules.gmk))
95104349Sphk
96104349Sphkendif # _MODULES_GMK
97104349Sphk