Modules.gmk revision 1169:980f315286b9
1193326Sed#
2193326Sed# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3193326Sed# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4193326Sed#
5193326Sed# This code is free software; you can redistribute it and/or modify it
6193326Sed# under the terms of the GNU General Public License version 2 only, as
7193326Sed# published by the Free Software Foundation.  Oracle designates this
8193326Sed# particular file as subject to the "Classpath" exception as provided
9193326Sed# by Oracle in the LICENSE file that accompanied this code.
10193326Sed#
11193326Sed# This code is distributed in the hope that it will be useful, but WITHOUT
12193326Sed# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13193326Sed# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14193326Sed# version 2 for more details (a copy is included in the LICENSE file that
15193326Sed# accompanied this code).
16249423Sdim#
17249423Sdim# You should have received a copy of the GNU General Public License version
18193326Sed# 2 along with this work; if not, write to the Free Software Foundation,
19193326Sed# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20243830Sdim#
21193326Sed# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22193326Sed# or visit www.oracle.com if you need additional information or have any
23193326Sed# questions.
24193326Sed#
25193326Sed
26193326Sedifndef _MODULES_GMK
27212904Sdim_MODULES_GMK := 1
28193326Sed
29193326Sedinclude JavaCompilation.gmk
30198092Srdivackyinclude SetupJavaCompilers.gmk
31198092Srdivacky
32193326Sed################################################################################
33193326Sed# Module list macros
34193326Sed
35193326SedALL_TOP_SRC_DIRS := \
36193326Sed    $(JDK_TOPDIR)/src \
37202879Srdivacky    $(LANGTOOLS_TOPDIR)/src \
38202879Srdivacky    $(CORBA_TOPDIR)/src \
39202879Srdivacky    $(JAXP_TOPDIR)/src \
40202879Srdivacky    $(JAXWS_TOPDIR)/src \
41193326Sed    $(NASHORN_TOPDIR)/src \
42202879Srdivacky    #
43202879Srdivacky
44202879Srdivacky# There are snmp classes in the open but they are not included in OpenJDK
45202879SrdivackyJAVA_MODULES_FILTER := jdk.snmp
46202879Srdivacky
47193326Sed# Find all modules with java sources by looking in the source dirs
48193326Seddefine FindJavaModules
49193326Sed  $(filter-out $(JAVA_MODULES_FILTER), $(sort $(notdir \
50193326Sed      $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
51234353Sdim      $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
52234353Sdim          $(patsubst %,%/*/$(OPENJDK_TARGET_OS_API_DIR)/classes/*, $(ALL_TOP_SRC_DIRS)) \
53193576Sed          $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
54193576Sedendef
55193576Sed
56195341Sed# Find all modules with source for the target platform.
57249423Sdimdefine FindAllModules
58249423Sdim  $(sort $(filter-out closed demo sample, $(notdir $(patsubst %/,%, $(dir \
59249423Sdim      $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
60193576Sed      $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
61193576Sed      $(patsubst %, %/*/$(OPENJDK_TARGET_OS_API_DIR), $(ALL_TOP_SRC_DIRS))))))))
62193576Sedendef
63193576Sed
64193576Sed################################################################################
65193576Sed
66198092Srdivacky$(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
67193326Sed    SETUP := BOOT_JAVAC, \
68249423Sdim    SRC := $(JDK_TOPDIR)/make/src/classes, \
69249423Sdim    INCLUDES := build/tools/module, \
70249423Sdim    BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist))
71249423Sdim
72249423SdimTOOL_GENMODULESLIST = $(JAVA_SMALL) \
73249423Sdim    -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
74249423Sdim    build.tools.module.GenModulesList
75249423Sdim
76249423SdimMODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
77249423SdimMODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
78193326Sed
79193326Sed$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml \
80193326Sed    $(BUILD_GENMODULESLIST)
81193326Sed	$(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
82193326Sed
83193326Sed$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
84193326Sed	$(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
85193326Sed
86249423Sdim-include $(MODULE_DEPS_MAKEFILE)
87249423Sdim
88249423Sdim# Param 1: Module to find deps for
89193326Seddefine FindDepsForModule
90198092Srdivacky  $(DEPS_$(strip $1))
91193326Sedendef
92193326Sed
93193326Sed################################################################################
94193326Sed
95193326Sed# Hook to include the corresponding custom file, if present.
96249423Sdim$(eval $(call IncludeCustomExtension, , common/Modules.gmk))
97249423Sdim
98249423Sdimendif # _MODULES_GMK
99249423Sdim