CompileJavaModules.gmk revision 1961:f900d5afd9c8
1615Ssundar#
2615Ssundar# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
3615Ssundar# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4877Sattila#
5615Ssundar# This code is free software; you can redistribute it and/or modify it
6615Ssundar# under the terms of the GNU General Public License version 2 only, as
7615Ssundar# published by the Free Software Foundation.  Oracle designates this
8877Sattila# particular file as subject to the "Classpath" exception as provided
9615Ssundar# by Oracle in the LICENSE file that accompanied this code.
10615Ssundar#
11615Ssundar# This code is distributed in the hope that it will be useful, but WITHOUT
12615Ssundar# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13615Ssundar# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14877Sattila# version 2 for more details (a copy is included in the LICENSE file that
15615Ssundar# accompanied this code).
16615Ssundar#
17615Ssundar# You should have received a copy of the GNU General Public License version
18877Sattila# 2 along with this work; if not, write to the Free Software Foundation,
19615Ssundar# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20615Ssundar#
21615Ssundar# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22615Ssundar# or visit www.oracle.com if you need additional information or have any
23615Ssundar# questions.
24615Ssundar#
25615Ssundar
26615Ssundar# This must be the first rule
27615Ssundardefault: all
28615Ssundar
29615Ssundarinclude $(SPEC)
30615Ssundarinclude MakeBase.gmk
31615Ssundarinclude Modules.gmk
32615Ssundarinclude JavaCompilation.gmk
33615Ssundarinclude SetupJavaCompilers.gmk
34615Ssundar
35615Ssundar# Hook to include the corresponding custom file, if present.
36615Ssundar$(eval $(call IncludeCustomExtension, , CompileJavaModules.gmk))
37615Ssundar
38615Ssundar################################################################################
39615Ssundar# Module specific build settings
40615Ssundar
41615Ssundarjava.activation_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
42615Ssundar
43615Ssundar################################################################################
44615Ssundar
45615Ssundarjava.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline
46615Ssundarjava.base_COPY := .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties
47615Ssundarjava.base_CLEAN := intrinsic.properties
48615Ssundar
49615Ssundarjava.base_EXCLUDE_FILES += \
50615Ssundar  $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java
51615Ssundar
52615Ssundarjava.base_EXCLUDES += java/lang/doc-files
53615Ssundar
54615Ssundar# Exclude BreakIterator classes that are just used in compile process to generate
55615Ssundar# data files and shouldn't go in the product
56615Ssundarjava.base_EXCLUDE_FILES += sun/text/resources/BreakIteratorRules.java
57615Ssundar
58615Ssundarifeq ($(OPENJDK_TARGET_OS), macosx)
59615Ssundar  java.base_EXCLUDE_FILES += sun/nio/fs/GnomeFileTypeDetector.java
60615Ssundarendif
61615Ssundar
62615Ssundarifneq ($(filter solaris macosx linux windows,$(OPENJDK_TARGET_OS)), )
63615Ssundar  java.base_EXCLUDE_FILES += \
64      sun/nio/ch/AbstractPollSelectorImpl.java \
65      sun/nio/ch/PollSelectorImpl.java \
66      sun/nio/ch/PollSelectorProvider.java \
67      #
68endif
69
70ifneq ($(OPENJDK_TARGET_OS), solaris)
71  java.base_EXCLUDE_FILES += \
72      SolarisLoginModule.java \
73      SolarisSystem.java \
74      #
75endif
76
77ifeq ($(filter $(OPENJDK_TARGET_OS), solaris macosx aix), )
78  #
79  # only solaris, macosx and aix
80  #
81  java.base_EXCLUDE_FILES += sun/nio/fs/PollingWatchService.java
82endif
83
84ifeq ($(OPENJDK_TARGET_OS), windows)
85  java.base_EXCLUDE_FILES += \
86      sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \
87      #
88endif
89
90################################################################################
91
92java.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
93
94################################################################################
95
96java.datatransfer_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
97java.datatransfer_COPY := flavormap.properties
98
99################################################################################
100
101java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
102java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
103java.desktop_CLEAN := iio-plugin.properties cursors.properties
104
105java.desktop_EXCLUDES += \
106    java/awt/doc-files \
107    javax/swing/doc-files \
108    javax/swing/text/doc-files \
109    javax/swing/plaf/synth/doc-files \
110    javax/swing/undo/doc-files \
111    sun/awt/X11/doc-files \
112    #
113
114# The exception handling of swing beaninfo
115# These resources violates the convention of having code and resources together under
116# $(JDK_TOPDIR)/src/.../classes directories
117$(eval $(call SetupCopyFiles,COPY_BEANINFO, \
118    SRC := $(JDK_TOPDIR)/make/data/swingbeaninfo/images, \
119    DEST := $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/beaninfo/images, \
120    FILES := $(wildcard $(JDK_TOPDIR)/make/data/swingbeaninfo/images/*.gif)))
121
122java.desktop_COPY_EXTRA += $(COPY_BEANINFO)
123
124java.desktop_EXCLUDE_FILES += \
125    javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
126    javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
127    javax/swing/plaf/nimbus/ScrollBarPainter.java \
128    javax/swing/plaf/nimbus/SliderPainter.java \
129    javax/swing/plaf/nimbus/SpinnerPainter.java \
130    javax/swing/plaf/nimbus/SplitPanePainter.java \
131    javax/swing/plaf/nimbus/TabbedPanePainter.java \
132    sun/awt/resources/security-icon-bw16.png \
133    sun/awt/resources/security-icon-bw24.png \
134    sun/awt/resources/security-icon-bw32.png \
135    sun/awt/resources/security-icon-bw48.png \
136    sun/awt/resources/security-icon-interim16.png \
137    sun/awt/resources/security-icon-interim24.png \
138    sun/awt/resources/security-icon-interim32.png \
139    sun/awt/resources/security-icon-interim48.png \
140    sun/awt/resources/security-icon-yellow16.png \
141    sun/awt/resources/security-icon-yellow24.png \
142    sun/awt/resources/security-icon-yellow32.png \
143    sun/awt/resources/security-icon-yellow48.png \
144    sun/awt/X11/java-icon16.png \
145    sun/awt/X11/java-icon24.png \
146    sun/awt/X11/java-icon32.png \
147    sun/awt/X11/java-icon48.png \
148    .template \
149    #
150
151ifeq ($(OPENJDK_TARGET_OS), macosx)
152  # exclude all X11 on Mac.
153  java.desktop_EXCLUDES += \
154      sun/awt/X11 \
155      sun/java2d/x11 \
156      sun/java2d/jules \
157      sun/java2d/xr \
158      com/sun/java/swing/plaf/gtk \
159      #
160  java.desktop_EXCLUDE_FILES += \
161      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/*.java) \
162      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/opengl/*.java) \
163      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/awt/*.java) \
164      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/font/*.java) \
165      #
166else
167  # TBD: figure out how to eliminate this long list
168  java.desktop_EXCLUDE_FILES += \
169      sun/awt/X11/ScreenFormat.java \
170      sun/awt/X11/XArc.java \
171      sun/awt/X11/XChar2b.java \
172      sun/awt/X11/XCharStruct.java \
173      sun/awt/X11/XClassHint.java \
174      sun/awt/X11/XComposeStatus.java \
175      sun/awt/X11/XExtCodes.java \
176      sun/awt/X11/XFontProp.java \
177      sun/awt/X11/XFontSetExtents.java \
178      sun/awt/X11/XFontStruct.java \
179      sun/awt/X11/XGCValues.java \
180      sun/awt/X11/XHostAddress.java \
181      sun/awt/X11/XIMCallback.java \
182      sun/awt/X11/XIMHotKeyTrigger.java \
183      sun/awt/X11/XIMHotKeyTriggers.java \
184      sun/awt/X11/XIMPreeditCaretCallbackStruct.java \
185      sun/awt/X11/XIMPreeditDrawCallbackStruct.java \
186      sun/awt/X11/XIMPreeditStateNotifyCallbackStruct.java \
187      sun/awt/X11/XIMStatusDrawCallbackStruct.java \
188      sun/awt/X11/XIMStringConversionCallbackStruct.java \
189      sun/awt/X11/XIMStringConversionText.java \
190      sun/awt/X11/XIMStyles.java \
191      sun/awt/X11/XIMText.java \
192      sun/awt/X11/XIMValuesList.java \
193      sun/awt/X11/XImage.java \
194      sun/awt/X11/XKeyboardControl.java \
195      sun/awt/X11/XKeyboardState.java \
196      sun/awt/X11/XOMCharSetList.java \
197      sun/awt/X11/XOMFontInfo.java \
198      sun/awt/X11/XOMOrientation.java \
199      sun/awt/X11/XPoint.java \
200      sun/awt/X11/XRectangle.java \
201      sun/awt/X11/XSegment.java \
202      sun/awt/X11/XStandardColormap.java \
203      sun/awt/X11/XTextItem.java \
204      sun/awt/X11/XTextItem16.java \
205      sun/awt/X11/XTextProperty.java \
206      sun/awt/X11/XTimeCoord.java \
207      sun/awt/X11/XWindowChanges.java \
208      sun/awt/X11/XdbeSwapInfo.java \
209      sun/awt/X11/XmbTextItem.java \
210      sun/awt/X11/XwcTextItem.java
211endif
212
213ifeq ($(OPENJDK_TARGET_OS), windows)
214  java.desktop_EXCLUDES += com/sun/java/swing/plaf/gtk
215endif
216
217ifdef BUILD_HEADLESS_ONLY
218  java.desktop_EXCLUDES += sun/applet
219endif
220
221# Why is this in the open source tree?
222ifdef OPENJDK
223  java.desktop_EXCLUDES += sun/dc
224endif
225
226# Used on windows and macosx
227ifeq ($(filter $(OPENJDK_TARGET_OS), windows macosx), )
228  java.desktop_EXCLUDE_FILES += sun/awt/AWTCharset.java
229endif
230
231# These files do not appear in the build result of the old build. This
232# is because they are generated sources, but the AUTO_JAVA_FILES won't
233# pick them up since they aren't generated when the source dirs are
234# searched and they aren't referenced by any other classes so they won't
235# be picked up by implicit compilation. On a rebuild, they are picked up
236# and compiled. Exclude them here to produce the same rt.jar as the old
237# build does when building just once.
238java.desktop_EXCLUDE_FILES += \
239    javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
240    javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
241    javax/swing/plaf/nimbus/ScrollBarPainter.java \
242    javax/swing/plaf/nimbus/SliderPainter.java \
243    javax/swing/plaf/nimbus/SpinnerPainter.java \
244    javax/swing/plaf/nimbus/SplitPanePainter.java \
245    javax/swing/plaf/nimbus/TabbedPanePainter.java \
246    #
247
248################################################################################
249
250java.scripting_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
251java.scripting_COPY := .js
252java.scripting_CLEAN := .properties
253
254################################################################################
255
256java.instrument_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
257
258################################################################################
259
260java.logging_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
261
262################################################################################
263
264java.management_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
265
266################################################################################
267
268java.prefs_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
269
270################################################################################
271
272java.transaction_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
273
274################################################################################
275
276java.sql_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
277java.sql_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
278
279################################################################################
280
281java.sql.rowset_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
282java.sql.rowset_CLEAN_FILES := $(wildcard \
283    $(JDK_TOPDIR)/src/java.sql.rowset/share/classes/com/sun/rowset/*.properties \
284    $(JDK_TOPDIR)/src/java.sql.rowset/share/classes/javax/sql/rowset/*.properties)
285
286################################################################################
287
288java.rmi_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
289java.rmi_CLEAN_FILES := $(wildcard \
290    $(JDK_TOPDIR)/src/java.rmi/share/classes/sun/rmi/registry/resources/*.properties \
291    $(JDK_TOPDIR)/src/java.rmi/share/classes/sun/rmi/server/resources/*.properties)
292
293################################################################################
294
295java.corba_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
296
297java.corba_COPY := .prp
298java.corba_CLEAN := .properties
299
300java.corba_EXCLUDES += \
301    com/sun/corba/se/PortableActivationIDL \
302    com/sun/tools/corba/se/logutil \
303    #
304java.corba_EXCLUDE_FILES += \
305    com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
306    com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
307    com/sun/org/omg/CORBA/IDLTypeOperations.java \
308    com/sun/org/omg/CORBA/IRObjectOperations.java \
309    org/omg/PortableInterceptor/UNKNOWN.java \
310    com/sun/tools/corba/se/idl/ResourceBundleUtil.java \
311    com/sun/corba/se/impl/presentation/rmi/jndi.properties \
312    #
313
314################################################################################
315
316java.xml_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
317java.xml_CLEAN := .properties
318
319################################################################################
320
321java.xml.bind_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
322java.xml.bind_CLEAN := .properties
323
324################################################################################
325
326java.xml.soap_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
327java.xml.soap_CLEAN := .properties
328
329################################################################################
330
331java.xml.ws_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
332java.xml.ws_COPY := .xml
333java.xml.ws_CLEAN := .properties
334
335################################################################################
336
337java.naming_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
338java.naming_CLEAN := jndiprovider.properties
339
340################################################################################
341
342java.security.saaj_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
343java.security.saaj_CLEAN := .properties
344
345################################################################################
346
347java.security.jgss_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
348
349################################################################################
350
351java.smartcardio_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
352
353################################################################################
354
355java.xml.crypto_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
356java.xml.crypto_COPY := .dtd .xml
357java.xml.crypto_CLEAN := .properties
358
359################################################################################
360
361jdk.charsets_COPY := .dat
362
363################################################################################
364
365jdk.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*' \
366    -XDstringConcat=inline
367jdk.compiler_CLEAN_FILES := $(wildcard \
368    $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
369        sun/tools/serialver/resources))
370
371################################################################################
372
373jdk.hotspot.agent_ADD_JAVAC_FLAGS := $(DISABLE_WARNINGS),-overrides
374jdk.hotspot.agent_COPY := .gif .png sa.js .properties
375
376################################################################################
377
378jdk.internal.le_COPY := .properties
379
380################################################################################
381
382jdk.jcmd_COPY := _options
383
384################################################################################
385
386jdk.dynalink_CLEAN := .properties
387
388################################################################################
389
390jdk.javadoc_COPY := .xml .css .js .png
391
392################################################################################
393
394jdk.rmic_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
395jdk.rmic_CLEAN := .properties
396
397################################################################################
398
399# No SCTP implementation on Mac OS X or AIX. These classes should be excluded.
400SCTP_IMPL_CLASSES = \
401    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/AssociationChange.java \
402    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/AssociationImpl.java \
403    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/PeerAddrChange.java \
404    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/ResultContainer.java \
405    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
406    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
407    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java \
408    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNotification.java \
409    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java \
410    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SendFailed.java \
411    $(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/Shutdown.java
412
413ifeq ($(OPENJDK_TARGET_OS), macosx)
414  jdk.sctp_EXCLUDE_FILES += $(SCTP_IMPL_CLASSES)
415endif
416
417ifeq ($(OPENJDK_TARGET_OS),aix)
418  jdk.sctp_EXCLUDE_FILES += $(SCTP_IMPL_CLASSES)
419endif
420
421################################################################################
422
423jdk.jconsole_COPY := .gif .png
424
425jdk.jconsole_CLEAN_FILES := $(wildcard \
426    $(JDK_TOPDIR)/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/*.properties)
427
428################################################################################
429
430jdk.jdeps_CLEAN_FILES := $(wildcard \
431    $(JDK_TOPDIR)/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/*.properties \
432    $(JDK_TOPDIR)/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/*.properties)
433
434################################################################################
435
436jdk.jdi_EXCLUDES += \
437    com/sun/tools/example/debug/bdi \
438    com/sun/tools/example/debug/event \
439    com/sun/tools/example/debug/gui \
440    com/sun/jdi/doc-files \
441    #
442
443jdk.jdi_EXCLUDE_FILES += jdi-overview.html
444
445################################################################################
446
447jdk.dev_CLEAN_FILES := $(wildcard \
448    $(patsubst %, $(JDK_TOPDIR)/src/jdk.dev/share/classes/%/*.properties, \
449        com/sun/tools/script/shell))
450
451jdk.dev_COPY := .js oqlhelp.html .txt
452
453################################################################################
454
455jdk.jvmstat_COPY := aliasmap
456
457################################################################################
458
459jdk.xml.bind_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
460jdk.xml.bind_CLEAN := .properties
461jdk.xml.bind_COPY := .xsd JAXBContextFactory.java ZeroOneBooleanAdapter.java
462
463################################################################################
464
465jdk.xml.ws_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
466jdk.xml.ws_CLEAN := .properties
467
468################################################################################
469
470sun.charsets_COPY := .dat
471
472################################################################################
473
474jdk.localedata_COPY := _dict _th
475# Exclude BreakIterator classes that are just used in compile process to generate
476# data files and shouldn't go in the product
477jdk.localedata_EXCLUDE_FILES += sun/text/resources/th/BreakIteratorRules_th.java
478
479################################################################################
480# Setup the compilation for the module
481#
482# Order src dirs in order of override with the most important first. Generated
483# source before static source and platform specific source before shared.
484#
485GENERATED_SRC_DIRS += \
486    $(SUPPORT_OUTPUTDIR)/gensrc \
487    #
488
489TOP_SRC_DIRS += \
490    $(HOTSPOT_TOPDIR)/src \
491    $(CORBA_TOPDIR)/src \
492    $(JDK_TOPDIR)/src \
493    $(LANGTOOLS_TOPDIR)/src \
494    $(JAXP_TOPDIR)/src \
495    $(JAXWS_TOPDIR)/src \
496    $(NASHORN_TOPDIR)/src \
497    #
498
499SRC_SUBDIRS += $(OPENJDK_TARGET_OS)/classes
500ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
501  SRC_SUBDIRS += $(OPENJDK_TARGET_OS_TYPE)/classes
502endif
503SRC_SUBDIRS += share/classes
504
505MODULE_SRC_DIRS := $(strip \
506    $(addsuffix /$(MODULE), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \
507    $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(MODULE)/$(sub), $(TOP_SRC_DIRS))))
508
509# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
510# JDK_FILTER at the make command line, only a subset of the JDK java files will
511# be recompiled. If multiple paths are separated by comma, convert that into a
512# space separated list.
513JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
514
515# Rewrite the MODULE_SRC_DIRS with a wildcard for the module so that all module
516# source dirs are available on the path.
517MODULESOURCEPATH := $(subst $(SPACE),$(PATH_SEP),$(subst $(MODULE),*,$(MODULE_SRC_DIRS)))
518
519# Add imported modules to the moduleclasspath
520MODULECLASSPATH := $(subst $(SPACE),$(PATH_SEP), $(IMPORT_MODULES_CLASSES))
521
522ifeq ($(MODULE), jdk.vm.ci)
523  ## WORKAROUND jdk.vm.ci source structure issue
524  JVMCI_MODULESOURCEPATH := $(MODULESOURCEPATH) \
525      $(subst /$(MODULE)/,/*/, $(filter-out %processor/src, \
526          $(wildcard $(HOTSPOT_TOPDIR)/src/jdk.vm.ci/share/classes/*/src)))
527  MODULESOURCEPATH := $(subst $(SPACE),$(PATH_SEP), $(JVMCI_MODULESOURCEPATH))
528endif
529
530# Make sure the generated source base dirs exist. Not all modules have generated
531# source in all of these directories and because of timing, all of them might not
532# exist at the time this makefile gets called. Javac will complain if there are
533# missing directories in the moduleclasspath.
534$(call MakeDir, $(GENERATED_SRC_DIRS))
535
536$(eval $(call SetupJavaCompilation, $(MODULE), \
537    SETUP := $(if $($(MODULE)_SETUP), $($(MODULE)_SETUP), GENERATE_JDKBYTECODE), \
538    MODULE := $(MODULE), \
539    SRC := $(wildcard $(MODULE_SRC_DIRS)), \
540    INCLUDES := $(JDK_USER_DEFINED_FILTER),\
541    BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
542    HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
543    ADD_JAVAC_FLAGS := \
544        $($(MODULE)_ADD_JAVAC_FLAGS) \
545        -modulesourcepath "$(MODULESOURCEPATH)" \
546        $(if $(MODULECLASSPATH), -modulepath "$(MODULECLASSPATH)") \
547        -system none, \
548))
549
550TARGETS += $($(MODULE)) $($(MODULE)_COPY_EXTRA)
551
552# Declare dependencies between java compilations of different modules.
553# Since the other modules are declared in different invocations of this file,
554# use the macro to find the correct target file to depend on.
555# Only the javac compilation actually depends on other modules so limit
556# dependency declaration to that by using the *_COMPILE_TARGET variable.
557$($(MODULE)_COMPILE_TARGET): $(foreach d, $(call FindDepsForModule, $(MODULE)), \
558    $(call SetupJavaCompilationCompileTarget, $d, \
559        $(if $($d_BIN), $($d_BIN), $(JDK_OUTPUTDIR)/modules/$d)))
560
561################################################################################
562# Copy zh_HK properties files from zh_TW
563
564$(JDK_OUTPUTDIR)/modules/%_zh_HK.properties: $(JDK_OUTPUTDIR)/modules/%_zh_TW.properties
565	$(install-file)
566
567CreateHkTargets = \
568    $(patsubst $(JDK_TOPDIR)/src/%, $(JDK_OUTPUTDIR)/modules/%, \
569      $(subst /share/classes,, \
570        $(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $1))))
571
572ifeq ($(MODULE), java.sql.rowset)
573  TARGETS += $(call CreateHkTargets, $(java.sql.rowset_CLEAN_FILES))
574endif
575
576ifeq ($(MODULE), java.rmi)
577  TARGETS += $(call CreateHkTargets, $(java.rmi_CLEAN_FILES))
578endif
579
580################################################################################
581# If this is an imported module, copy the pre built classes and resources into
582# the modules output dir
583
584ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), )
585  $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
586      $(call CacheFind, $(IMPORT_MODULES_CLASSES)/$(MODULE))
587	$(RM) -r $(@D)
588	$(MKDIR) -p $(@D)
589	$(CP) -R $(IMPORT_MODULES_CLASSES)/$(MODULE)/* $(@D)/
590	$(TOUCH) $@
591
592  TARGETS += $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker
593
594  # Add this dependency to avoid a race between compiling module-info.java and
595  # importing the classes.
596  $($(MODULE)_COMPILE_TARGET): $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker
597endif
598
599################################################################################
600
601$(eval $(call IncludeCustomExtension, , CompileJavaModules-post.gmk))
602
603################################################################################
604
605all: $(TARGETS)
606
607.PHONY: all
608