blob: 26c334e6190ebd1c4cf7be05297246d62b014fd2 [file] [log] [blame]
ihse554e46f2013-11-14 11:19:32 +01001#
2# Copyright (c) 2011, 2012, 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
26default: all
27
28include $(SPEC)
29include MakeBase.gmk
30include JavaCompilation.gmk
31
32# Setup the java compilers for the JDK build.
33include Setup.gmk
34
35JARS :=
36EXFILES :=
37EXCLUDES :=
38
39##########################################################################################
40
41EXCLUDES += com/sun/pept \
42 com/sun/tools/example/trace \
43 com/sun/tools/example/debug/bdi \
44 com/sun/tools/example/debug/event \
45 com/sun/tools/example/debug/gui
46
47ifdef OPENJDK
48 EXCLUDES += sun/dc \
49 com/sun/jmx/snmp \
50 sun/management/snmp \
51 com/sun/script
52endif
53
54ifndef OPENJDK
55 # There exists two versions of this file...
56 EXFILES := $(JDK_TOPDIR)/src/share/classes/javax/crypto/JarVerifier.java
57
58 ifeq ($(OPENJDK_TARGET_OS), windows)
59 # This gets built on unix platforms implicitly in the old build even though
60 # it's excluded in the closed build.
61 EXCLUDES += sun/java2d/pisces
62
63 # AccessBridge is compiled separately below.
64 EXFILES += AccessBridge.java \
65 AccessBridgeLoader.java \
66 com/sun/java/accessibility/util/java/awt/ChoiceTranslator.java
67 # This seems to never be built
68 EXCLUDES += com/sun/java/accessibility/extensions
69 endif
70
71endif
72
73ifneq ($(OPENJDK_TARGET_OS), solaris)
74 # Exclude Solaris nio and two security related files in src/share/classes
75 EXFILES += SolarisAclFileAttributeView.java \
76 SolarisFileStore.java \
77 SolarisFileSystem.java \
78 SolarisFileSystemProvider.java \
79 SolarisNativeDispatcher.java \
80 SolarisUserDefinedFileAttributeView.java \
81 SolarisWatchService.java \
82 SolarisAclFileAttributeView.java \
83 SolarisLoginModule.java \
84 SolarisSystem.java \
85 sun/nio/ch/DevPollArrayWrapper.java \
86 sun/nio/ch/DevPollSelectorImpl.java \
87 sun/nio/ch/DevPollSelectorProvider.java \
88 sun/nio/ch/EventPortSelectorImpl.java \
89 sun/nio/ch/EventPortSelectorProvider.java \
90 sun/nio/ch/EventPortWrapper.java \
91 sun/nio/ch/SolarisAsynchronousChannelProvider.java \
92 sun/nio/ch/SolarisEventPort.java \
93 sun/tools/attach/SolarisAttachProvider.java \
94 sun/tools/attach/SolarisVirtualMachine.java
95
96 EXCLUDES += com/oracle/security
97endif
98
99EXFILES += WrapperGenerator.java
100
101ifneq ($(OPENJDK_TARGET_OS), windows)
102 # Exclude Window security related files in src/share/classes
103 EXFILES += NTLoginModule.java \
104 NTSystem.java
105else
106 EXFILES += UnixLoginModule.java \
107 UnixSystem.java
108endif
109
110ifeq ($(OPENJDK_TARGET_OS), windows)
111 # Don't build GTK L&F on Windows
112 EXCLUDES += com/sun/java/swing/plaf/gtk
113endif
114
115ifneq ($(OPENJDK_TARGET_OS), linux)
116 EXFILES += sun/tools/attach/LinuxAttachProvider.java \
117 sun/tools/attach/LinuxVirtualMachine.java \
118 sun/nio/ch/EPoll.java \
119 sun/nio/ch/EPollArrayWrapper.java \
120 sun/nio/ch/EPollPort.java \
121 sun/nio/ch/EPollSelectorImpl.java \
122 sun/nio/ch/EPollSelectorProvider.java \
123 sun/nio/ch/LinuxAsynchronousChannelProvider.java \
124 sun/nio/fs/LinuxDosFileAttributeView.java \
125 sun/nio/fs/LinuxFileStore.java \
126 sun/nio/fs/LinuxFileSystem.java \
127 sun/nio/fs/LinuxFileSystemProvider.java \
128 sun/nio/fs/MagicFileTypeDetector.java \
129 sun/nio/fs/LinuxNativeDispatcher.java \
130 sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
131 sun/nio/fs/LinuxWatchService.java
132endif
133
134ifneq ($(OPENJDK_TARGET_OS), macosx)
135 EXFILES += sun/nio/ch/BsdAsynchronousChannelProvider.java \
136 sun/nio/ch/KQueue.java \
137 sun/nio/ch/KQueuePort.java \
138 sun/nio/fs/BsdFileStore.java \
139 sun/nio/fs/BsdFileSystem.java \
140 sun/nio/fs/BsdFileSystemProvider.java \
141 sun/nio/fs/BsdNativeDispatcher.java \
142 sun/nio/fs/MacOSXFileSystemProvider.java \
143 sun/nio/fs/MacOSXFileSystem.java \
144 sun/nio/fs/MacOSXNativeDispatcher.java \
145 sun/tools/attach/BsdAttachProvider.java \
146 sun/tools/attach/BsdVirtualMachine.java
147endif
148
kvn7130df72013-12-05 15:10:36 -0800149ifneq ($(OPENJDK_TARGET_OS),aix)
150 EXFILES+=sun/nio/ch/AixAsynchronousChannelProvider.java \
151 sun/nio/ch/AixPollPort.java \
152 sun/nio/fs/AixFileStore.java \
153 sun/nio/fs/AixFileSystem.java \
154 sun/nio/fs/AixFileSystemProvider.java \
155 sun/nio/fs/AixNativeDispatcher.java \
156 sun/tools/attach/AixAttachProvider.java \
157 sun/tools/attach/AixVirtualMachine.java
158endif
159
ihse554e46f2013-11-14 11:19:32 +0100160# Exclude BreakIterator classes that are just used in compile process to generate
161# data files and shouldn't go in the product
162EXFILES += sun/text/resources/BreakIteratorRules.java \
163 sun/text/resources/BreakIteratorRules_th.java
164
165# TODO: Add BUILD_HEADLESS_ONLY to configure?
166ifdef BUILD_HEADLESS_ONLY
167 EXCLUDES += sun/applet
168endif
169
170ifdef OPENJDK
171 EXCLUDES += sun/java2d/cmm/kcms
172endif
173
174# Used on windows and macosx
175ifeq (, $(filter $(OPENJDK_TARGET_OS), windows macosx))
176 EXFILES += sun/awt/AWTCharset.java
177endif
178
179ifeq ($(OPENJDK_TARGET_OS), macosx)
180 # exclude all X11 on Mac, we can't exclude some like below or we'll have compilation errors
181 EXCLUDES += sun/awt/X11
182else
183 # TBD: figure out how to eliminate this long list
184 EXFILES += sun/awt/X11/ScreenFormat.java \
185 sun/awt/X11/XArc.java \
186 sun/awt/X11/XChar2b.java \
187 sun/awt/X11/XCharStruct.java \
188 sun/awt/X11/XClassHint.java \
189 sun/awt/X11/XComposeStatus.java \
190 sun/awt/X11/XExtCodes.java \
191 sun/awt/X11/XFontProp.java \
192 sun/awt/X11/XFontSetExtents.java \
193 sun/awt/X11/XFontStruct.java \
194 sun/awt/X11/XGCValues.java \
195 sun/awt/X11/XHostAddress.java \
196 sun/awt/X11/XIMCallback.java \
197 sun/awt/X11/XIMHotKeyTrigger.java \
198 sun/awt/X11/XIMHotKeyTriggers.java \
199 sun/awt/X11/XIMPreeditCaretCallbackStruct.java \
200 sun/awt/X11/XIMPreeditDrawCallbackStruct.java \
201 sun/awt/X11/XIMPreeditStateNotifyCallbackStruct.java \
202 sun/awt/X11/XIMStatusDrawCallbackStruct.java \
203 sun/awt/X11/XIMStringConversionCallbackStruct.java \
204 sun/awt/X11/XIMStringConversionText.java \
205 sun/awt/X11/XIMStyles.java \
206 sun/awt/X11/XIMText.java \
207 sun/awt/X11/XIMValuesList.java \
208 sun/awt/X11/XImage.java \
209 sun/awt/X11/XKeyboardControl.java \
210 sun/awt/X11/XKeyboardState.java \
211 sun/awt/X11/XOMCharSetList.java \
212 sun/awt/X11/XOMFontInfo.java \
213 sun/awt/X11/XOMOrientation.java \
214 sun/awt/X11/XPoint.java \
215 sun/awt/X11/XRectangle.java \
216 sun/awt/X11/XSegment.java \
217 sun/awt/X11/XStandardColormap.java \
218 sun/awt/X11/XTextItem.java \
219 sun/awt/X11/XTextItem16.java \
220 sun/awt/X11/XTextProperty.java \
221 sun/awt/X11/XTimeCoord.java \
222 sun/awt/X11/XWindowChanges.java \
223 sun/awt/X11/XdbeSwapInfo.java \
224 sun/awt/X11/XmbTextItem.java \
225 sun/awt/X11/XwcTextItem.java
226endif
227
228# Exclude another implicitly not included file.
229EXFILES += sun/util/locale/AsciiUtil.java
230
231ifeq (, $(filter $(OPENJDK_TARGET_OS), solaris macosx))
232 #
233 # only solaris and macosx
234 #
235 EXFILES += sun/nio/fs/PollingWatchService.java
236endif
237
238# TODO: Fix when converting NIO
239# Exclude *-linux-arm.java and *-linux-ppc.java from closed.
240EXFILES += -linux-arm.java \
241 -linux-ppc.java
242
243ifeq ($(OPENJDK_TARGET_OS), windows)
244 EXFILES += sun/nio/ch/AbstractPollSelectorImpl.java \
245 sun/nio/ch/PollSelectorProvider.java \
246 sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
247endif
248
249# These files do not appear in the build result of the old build. This
250# is because they are generated sources, but the AUTO_JAVA_FILES won't
251# pick them up since they aren't generated when the source dirs are
252# searched and they aren't referenced by any other classes so they won't
253# be picked up by implicit compilation. On a rebuild, they are picked up
254# and compiled. Exclude them here to produce the same rt.jar as the old
255# build does when building just once.
256EXFILES += javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
257 javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
258 javax/swing/plaf/nimbus/ScrollBarPainter.java \
259 javax/swing/plaf/nimbus/SliderPainter.java \
260 javax/swing/plaf/nimbus/SpinnerPainter.java \
261 javax/swing/plaf/nimbus/SplitPanePainter.java \
262 javax/swing/plaf/nimbus/TabbedPanePainter.java
263
264# Acquire a list of files that should be copied straight over to the classes.
265include CopyIntoClasses.gmk
266# Now we have COPY_PATTERNS, COPY_FILES and COPY_EXTRA
267
268ifndef OPENJDK
269 CLOSED_SRC_DIRS := $(JDK_TOPDIR)/src/closed/share/classes \
270 $(JDK_TOPDIR)/src/closed/$(OPENJDK_TARGET_OS_API_DIR)/classes
271endif
272
273MACOSX_SRC_DIRS :=
274ifeq ($(OPENJDK_TARGET_OS), macosx)
275 MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/classes
276
277 # this files are duplicated in MACOSX_SRC_DIRS
278 EXFILES += $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java \
279 $(JDK_TOPDIR)/src/solaris/classes/sun/java2d/BackBufferCapsProvider.java \
280 $(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
281 $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
282 $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
283 $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java \
284 $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
285 $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
286 $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
287
288 # JObjC.jar contains 1.5 byte-code...so skip it here :-(
289 # MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/jobjc/src
290 # EXCLUDES += tests/java/com/apple/jobjc
291
292 EXCLUDES += com/apple/jobjc
293endif
294
295# The security classes should not end up in the classes directory as that will prevent them
296# from working when running the exploded jdk image. Compile them separately to a different
297# directory from where the jars can be created.
298SECURITY_PKGS := \
299 com/oracle/security/ucrypto \
300 com/sun/crypto/provider \
301 javax/crypto \
302 sun/security/ec \
303 sun/security/internal \
304 sun/security/mscapi \
305 sun/security/pkcs11 \
306 #
307
kvn7130df72013-12-05 15:10:36 -0800308AIX_SRC_DIRS :=
309ifeq ($(OPENJDK_TARGET_OS),aix)
310 AIX_SRC_DIRS += $(JDK_TOPDIR)/src/aix/classes
311endif
312
ihse554e46f2013-11-14 11:19:32 +0100313# The exception handling of swing beaninfo
314# These resources violates the convention of having code and resources together under
315# $(JDK_TOPDIR)/src/.../classes directories
316$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
317 $(call install-file)
318
319# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
320# JDK_FILTER at the make command line, only a subset of the JDK java files will
321# be recompiled. If multiple paths are separated by comma, convert that into a
322# space separated list.
323JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
324
325ifeq ($(ENABLE_SJAVAC),yes)
326 # With sjavac enabled, excluded sources are not even considered for linking.
327 # Explicitly add the security sources to sourcepath for linking.
328 BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%.*,$(subst /,.,$(SECURITY_PKGS))) \
329 -sourcepath $(JDK_TOPDIR)/src/share/classes
330endif
331
332$(eval $(call SetupJavaCompilation,BUILD_JDK,\
333 SETUP:=GENERATE_JDKBYTECODE,\
334 SRC:=$(JDK_TOPDIR)/src/share/classes \
335 $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
336 $(MACOSX_SRC_DIRS) \
kvn7130df72013-12-05 15:10:36 -0800337 $(AIX_SRC_DIRS) \
ihse554e46f2013-11-14 11:19:32 +0100338 $(JDK_OUTPUTDIR)/gensrc \
339 $(JDK_OUTPUTDIR)/gensrc_no_srczip \
340 $(CLOSED_SRC_DIRS),\
341 INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
342 EXCLUDES:=$(EXCLUDES) $(SECURITY_PKGS),\
343 EXCLUDE_FILES:=$(EXFILES),\
344 BIN:=$(JDK_OUTPUTDIR)/classes,\
345 COPY:=$(COPY_PATTERNS),\
346 COPY_FILES:=$(COPY_FILES),\
347 HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
348 ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))
349
350##########################################################################################
351
352$(eval $(call SetupJavaCompilation,BUILD_SECURITY, \
353 SETUP := GENERATE_JDKBYTECODE, \
354 SRC := $(JDK_TOPDIR)/src/share/classes \
355 $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
356 $(MACOSX_SRC_DIRS) \
357 $(CLOSED_SRC_DIRS), \
358 INCLUDES := $(SECURITY_PKGS), \
359 EXCLUDES := $(EXCLUDES), \
360 EXCLUDE_FILES := $(EXFILES), \
361 BIN := $(JDK_OUTPUTDIR)/classes_security, \
362 HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
363
364$(BUILD_SECURITY): $(BUILD_JDK)
365
366##########################################################################################
367
368$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin:
369 $(MKDIR) -p $(@D)
370 $(TOUCH) $@
371
372##########################################################################################
373
374ifeq ($(OPENJDK_TARGET_OS), macosx)
375 #
376 # JObjC.jar is compiled with BOOT_JAVAC which (may) not support the "-h" flag.
377 # so we first compile classes with BOOT_JAVAC and then with JDK_JAVAC :-(
378 #
379 $(eval $(call SetupJavaCompiler,GENERATE_15BYTECODE, \
380 JAVAC := $(JAVAC), \
381 FLAGS := -source 1.5 -target 1.5 -g -bootclasspath $(BOOT_RTJAR) -cp $(JDK_OUTPUTDIR)/../langtools/dist/lib/classes.jar $(DISABLE_WARNINGS), \
382 SERVER_DIR := $(SJAVAC_SERVER_DIR), \
383 SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
384
385 $(eval $(call SetupJavaCompilation,BUILD_JOBJC, \
386 SETUP := GENERATE_15BYTECODE, \
387 DISABLE_SJAVAC := true, \
388 SRC := $(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
389 $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
390 $(JDK_OUTPUTDIR)/gensrc_jobjc/src, \
391 INCLUDES := com/apple/jobjc, \
392 EXCLUDES := tests/java/com/apple/jobjc, \
393 BIN := $(JDK_OUTPUTDIR)/jobjc_classes, \
394 JAR := $(JDK_OUTPUTDIR)/lib/JObjC.jar, \
395 JARINDEX := true))
396
397 $(BUILD_JOBJC): $(BUILD_JDK)
398
399 $(eval $(call SetupJavaCompilation,BUILD_JOBJC_HEADERS, \
400 SETUP := GENERATE_JDKBYTECODE, \
401 SRC := $(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/java \
402 $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/java \
403 $(JDK_OUTPUTDIR)/gensrc_jobjc/src, \
404 INCLUDES := com/apple/jobjc, \
405 EXCLUDES := tests/java/com/apple/jobjc, \
406 BIN := $(JDK_OUTPUTDIR)/jobjc_classes_headers, \
407 HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers_jobjc))
408
409$(BUILD_JOBJC_HEADERS): $(BUILD_JDK)
410
411endif
412
413##########################################################################################
414
415ifndef OPENJDK
416 ifeq ($(OPENJDK_TARGET_OS), windows)
417 ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
418 $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_32, \
419 SETUP := GENERATE_JDKBYTECODE, \
420 JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
421 SRC := $(JDK_OUTPUTDIR)/gensrc_ab/32bit, \
422 BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit))
423
424 $(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)
425
426 $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_LEGACY, \
427 SETUP := GENERATE_JDKBYTECODE, \
428 JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
429 SRC := $(JDK_OUTPUTDIR)/gensrc_ab/legacy, \
430 BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy))
431
432 $(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)
433
434 else
435
436 $(eval $(call SetupJavaCompilation,BUILD_ACCESSBRIDGE_64, \
437 SETUP := GENERATE_JDKBYTECODE, \
438 JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
439 SRC := $(JDK_OUTPUTDIR)/gensrc_ab/64bit, \
440 BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit))
441
442 $(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)
443
444 endif
445 endif
446endif
447
448##########################################################################################
449
450all: $(BUILD_JDK) $(BUILD_SECURITY) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
451 $(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
452 $(BUILD_ACCESSBRIDGE_32) $(BUILD_ACCESSBRIDGE_64) \
453 $(BUILD_ACCESSBRIDGE_LEGACY)
454
455.PHONY: all