blob: 6a04e29dc594fcaf0b9d6ccbe1d7e7f6d24c8007 [file] [log] [blame]
ihse554e46f2013-11-14 11:19:32 +01001#
ptbrunetdc4e52b2015-03-31 18:39:00 +04002# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
ihse554e46f2013-11-14 11:19:32 +01003# 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 NativeCompilation.gmk
31
32# Setup the java compilers for the JDK build.
33include Setup.gmk
34
35# Prepare the find cache. Only used on windows.
36$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/bin))
37
38# Build tools
39include Tools.gmk
40
41BUILD_LAUNCHERS =
42
43# When building a legacy overlay image (on solaris 64 bit), the launchers
44# need to be built with a different rpath and a different output dir.
45ifeq ($(OVERLAY_IMAGES), true)
46 ORIGIN_ROOT := /../..
47 OUTPUT_SUBDIR := $(OPENJDK_TARGET_CPU_ISADIR)
48else
49 ORIGIN_ROOT := /..
50endif
51
52ifeq ($(OPENJDK_TARGET_OS), macosx)
53 ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
54else
55 ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
56endif
57
58#
59# Applications expect to be able to link against libjawt without invoking
60# System.loadLibrary("jawt") first. This was the behaviour described in the
61# devloper documentation of JAWT and what worked with OpenJDK6.
62#
63ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
64 ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR))
65endif
66
67define SetupLauncher
68 # TODO: Fix mapfile on solaris. Won't work with ld as linker.
69 # Parameter 1 is the name of the launcher (java, javac, jar...)
70 # Parameter 2 is extra CFLAGS
71 # Parameter 3 is extra LDFLAGS
72 # Parameter 4 is extra LDFLAGS_SUFFIX_posix
73 # Parameter 5 is extra LDFLAGS_SUFFIX_windows
74 # Parameter 6 is optional Windows JLI library (full path)
75 # Parameter 7 is optional Windows resource (RC) flags
76 # Parameter 8 is optional Windows version resource file (.rc)
77 # Parameter 9 is different output dir
78 # Parameter 10 if set, link statically with c runtime on windows.
79 # Parameter 11 if set, override plist file on macosx.
80
81 $1_WINDOWS_JLI_LIB := $(JDK_OUTPUTDIR)/objs/libjli/jli.lib
82 ifneq ($6, )
83 $1_WINDOWS_JLI_LIB := $6
84 endif
85 $1_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc
86 ifneq ($8, )
87 $1_VERSION_INFO_RESOURCE := $8
88 endif
89
90 $1_LDFLAGS := $3
91 $1_LDFLAGS_SUFFIX :=
92 ifeq ($(OPENJDK_TARGET_OS), macosx)
93 $1_PLIST_FILE := Info-cmdline.plist
94 ifneq ($(11), )
95 $1_PLIST_FILE := $(11)
96 ifneq ($$(findstring privileged, $$($1_PLIST_FILE)), )
97 $1_CODESIGN := true
98 endif
99 endif
100
101 $1_LDFLAGS += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
102 -framework Cocoa -framework Security -framework ApplicationServices \
103 -sectcreate __TEXT __info_plist $(JDK_TOPDIR)/src/macosx/lib/$$($1_PLIST_FILE)
104 $1_LDFLAGS_SUFFIX += -pthread
105 endif
106
kvn7130df72013-12-05 15:10:36 -0800107 ifeq ($(OPENJDK_TARGET_OS), aix)
108 $1_LDFLAGS_SUFFIX += -L$(JDK_OUTPUTDIR)/objs -ljli_static
109 endif
110
ihse554e46f2013-11-14 11:19:32 +0100111 ifeq ($(USE_EXTERNAL_LIBZ), true)
112 $1_LDFLAGS_SUFFIX += -lz
113 endif
114
115 $1_OUTPUT_DIR_ARG := $9
116 ifeq (, $$($1_OUTPUT_DIR_ARG))
117 $1_OUTPUT_DIR_ARG := $(JDK_OUTPUTDIR)/bin
118 endif
119
120 # TODO: maybe it's better to move this if-statement out of this function
121 ifeq ($1, java)
122 $1_OPTIMIZATION_ARG := HIGH
123 $1_LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR)
124 else
125 $1_OPTIMIZATION_ARG := LOW
126 endif
127
128 $1_CFLAGS := $(CFLAGS_JDKEXE)
129 ifeq ($(10), true)
130 $1_CFLAGS := $(filter-out -MD, $(CFLAGS_JDKEXE))
131 endif
132
kvn7130df72013-12-05 15:10:36 -0800133 # The linker on older SuSE distros (e.g. on SLES 10) complains with:
134 # "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
135 # if feeded with a version script which contains named tags.
136 ifeq ($(USING_BROKEN_SUSE_LD),yes)
137 ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), )
138 $1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous
139 else
140 $1_MAPFILE :=
141 endif
ihse554e46f2013-11-14 11:19:32 +0100142 else
kvn7130df72013-12-05 15:10:36 -0800143 ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), )
144 $1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
145 else
146 $1_MAPFILE :=
147 endif
ihse554e46f2013-11-14 11:19:32 +0100148 endif
149
150 $(call SetupNativeCompilation,BUILD_LAUNCHER_$1, \
151 SRC := $(JDK_TOPDIR)/src/share/bin, \
152 INCLUDE_FILES := main.c, \
153 LANG := C, \
154 OPTIMIZATION := $$($1_OPTIMIZATION_ARG), \
155 CFLAGS := $$($1_CFLAGS) \
156 -I$(JDK_TOPDIR)/src/share/bin \
157 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin \
158 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/bin \
159 -DFULL_VERSION='"$(FULL_VERSION)"' \
160 -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
161 -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
162 -DLIBARCHNAME='"$(OPENJDK_TARGET_CPU_LEGACY)"' \
163 -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
164 -DPROGNAME='"$1"' $(DPACKAGEPATH) \
165 $2, \
166 CFLAGS_linux := -fPIC, \
167 CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \
168 LDFLAGS := $(LDFLAGS_JDKEXE) \
169 $(ORIGIN_ARG) \
170 $$($1_LDFLAGS), \
171 LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_NAME,$1), \
172 LDFLAGS_linux := -lpthread \
173 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
174 LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \
175 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
176 MAPFILE := $$($1_MAPFILE), \
177 LDFLAGS_SUFFIX := $(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX), \
178 LDFLAGS_SUFFIX_posix := $4, \
179 LDFLAGS_SUFFIX_windows := $$($1_WINDOWS_JLI_LIB) \
180 $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5, \
181 LDFLAGS_SUFFIX_linux := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
182 LDFLAGS_SUFFIX_solaris := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
183 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/$1_objs$(OUTPUT_SUBDIR), \
184 OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \
185 PROGRAM := $1, \
186 DEBUG_SYMBOLS := true, \
187 VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
188 RC_FLAGS := $(RC_FLAGS) \
189 -D "JDK_FNAME=$1$(EXE_SUFFIX)" \
190 -D "JDK_INTERNAL_NAME=$1" \
191 -D "JDK_FTYPE=0x1L" \
192 $7, \
193 MANIFEST := $(JDK_TOPDIR)/src/windows/resource/java.manifest, \
194 CODESIGN := $$($1_CODESIGN))
195
196 BUILD_LAUNCHERS += $$(BUILD_LAUNCHER_$1)
197
kvn7130df72013-12-05 15:10:36 -0800198 ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
ihse554e46f2013-11-14 11:19:32 +0100199 $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjli_static.a
200 endif
201
202 ifeq ($(OPENJDK_TARGET_OS), windows)
203 $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
204 $$($1_WINDOWS_JLI_LIB)
205 endif
206endef
207
208##########################################################################################
209
210XLIBS := $(X_LIBS) -lX11
211ifeq ($(OPENJDK_TARGET_OS), macosx)
212 DPACKAGEPATH := -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
213 XLIBS :=
214endif
215
216ifdef OPENJDK
217 JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
218else
219 JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
220endif
221
222# On windows, the debuginfo files get the same name as for java.dll. Build
223# into another dir and copy selectively so debuginfo for java.dll isn't
224# overwritten.
225$(eval $(call SetupLauncher,java, \
226 -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
227 $(JDK_OUTPUTDIR)/objs/jli_static.lib, $(JAVA_RC_FLAGS), \
228 $(JDK_TOPDIR)/src/windows/resource/java.rc, $(JDK_OUTPUTDIR)/objs/java_objs,true))
229
230$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
231 $(MKDIR) -p $(@D)
232 $(RM) $@
233 $(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
234
235BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
236
237ifeq ($(OPENJDK_TARGET_OS), windows)
238 $(eval $(call SetupLauncher,javaw, \
239 -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
240 $(JDK_OUTPUTDIR)/objs/jli_static.lib, $(JAVA_RC_FLAGS), \
241 $(JDK_TOPDIR)/src/windows/resource/java.rc,,true))
242endif
243
244
245ifndef BUILD_HEADLESS_ONLY
246 $(eval $(call SetupLauncher,appletviewer, \
247 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',, \
248 $(XLIBS)))
249endif
250
251$(eval $(call SetupLauncher,extcheck, \
252 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.extcheck.Main"$(COMMA) }'))
253
254$(eval $(call SetupLauncher,idlj, \
255 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))
256
257$(eval $(call SetupLauncher,jar, \
258 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
259
260$(eval $(call SetupLauncher,jarsigner, \
261 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
262
263$(eval $(call SetupLauncher,javac, \
264 -DEXPAND_CLASSPATH_WILDCARDS \
265 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
266 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))
267
268ifeq ($(ENABLE_SJAVAC), yes)
269 $(eval $(call SetupLauncher,sjavac, \
270 -DEXPAND_CLASSPATH_WILDCARDS \
271 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
272 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }'))
273endif
274
275$(eval $(call SetupLauncher,javadoc, \
276 -DEXPAND_CLASSPATH_WILDCARDS \
277 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
278 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
279
280$(eval $(call SetupLauncher,javah, \
281 -DEXPAND_CLASSPATH_WILDCARDS \
282 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
283 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))
284
285$(eval $(call SetupLauncher,javap, \
286 -DEXPAND_CLASSPATH_WILDCARDS \
287 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
288 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
289
290$(eval $(call SetupLauncher,jdeps, \
291 -DEXPAND_CLASSPATH_WILDCARDS \
292 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
293 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))
294
295BUILD_LAUNCHER_jconsole_CFLAGS_windows := -DJAVAW
296BUILD_LAUNCHER_jconsole_LDFLAGS_windows := user32.lib
297
298$(eval $(call SetupLauncher,jconsole, \
299 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
300 -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))
301
302$(eval $(call SetupLauncher,jdb, \
303 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
304 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
305
306$(eval $(call SetupLauncher,jhat, \
307 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))
308
309$(eval $(call SetupLauncher,jinfo, \
310 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
311 "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
312 "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
313 "sun.tools.jinfo.JInfo"$(COMMA) }' \
314 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
315 ,,,,,,,,,Info-privileged.plist))
316
317$(eval $(call SetupLauncher,jmap, \
318 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
319 "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
320 "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
321 "sun.tools.jmap.JMap"$(COMMA) }' \
322 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
323 ,,,,,,,,,Info-privileged.plist))
324
325$(eval $(call SetupLauncher,jps, \
326 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))
327
328$(eval $(call SetupLauncher,jrunscript, \
329 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
330
331$(eval $(call SetupLauncher,jjs, \
332 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.nashorn.tools.Shell"$(COMMA) }'))
333
334$(eval $(call SetupLauncher,jsadebugd, \
335 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
336 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
337 ,,,,,,,,,Info-privileged.plist))
338
339$(eval $(call SetupLauncher,jstack, \
340 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
341 "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
342 "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
343 "sun.tools.jstack.JStack"$(COMMA) }' \
344 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
345 ,,,,,,,,,Info-privileged.plist))
346
347$(eval $(call SetupLauncher,jstat, \
348 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))
349
350$(eval $(call SetupLauncher,jstatd, \
351 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
352
353$(eval $(call SetupLauncher,keytool, \
354 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.keytool.Main"$(COMMA) }'))
355
356$(eval $(call SetupLauncher,native2ascii, \
357 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
358
359ifndef BUILD_HEADLESS_ONLY
360 $(eval $(call SetupLauncher,policytool, \
361 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
362 $(XLIBS)))
363endif
364
365$(eval $(call SetupLauncher,rmic, \
366 -DEXPAND_CLASSPATH_WILDCARDS \
367 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
368
369$(eval $(call SetupLauncher,schemagen, \
370 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))
371
372$(eval $(call SetupLauncher,serialver, \
373 -DEXPAND_CLASSPATH_WILDCARDS \
374 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
375
376$(eval $(call SetupLauncher,xjc, \
377 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
378
379$(eval $(call SetupLauncher,wsgen, \
380 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))
381
382$(eval $(call SetupLauncher,wsimport, \
383 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
384
385$(eval $(call SetupLauncher,orbd, \
386 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
387 "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
388 "-J-Dcom.sun.CORBA.activation.Port=1049"$(COMMA) \
389 "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
390 "com.sun.corba.se.impl.activation.ORBD"$(COMMA) }'))
391
392$(eval $(call SetupLauncher,servertool, \
393 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))
394
395$(eval $(call SetupLauncher,tnameserv, \
396 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
397 "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
398 "-J-Djava.util.logging.LoggingPermission=contol"$(COMMA) \
399 "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
400 "com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))
401
402$(eval $(call SetupLauncher,pack200, \
kizune8f7be8d2013-11-19 22:05:45 +0400403 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) }'))
ihse554e46f2013-11-14 11:19:32 +0100404
405$(eval $(call SetupLauncher,rmid, \
406 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
407
408$(eval $(call SetupLauncher,rmiregistry, \
409 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
410
411$(eval $(call SetupLauncher,jcmd, \
412 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
413
414ifeq ($(OPENJDK_TARGET_OS), windows)
415 $(eval $(call SetupLauncher,kinit, \
416 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
417
418 $(eval $(call SetupLauncher,klist, \
419 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
420
421 $(eval $(call SetupLauncher,ktab, \
422 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
423endif
424
425##########################################################################################
426# The order of the object files on the link command line affects the size of the resulting
427# binary (at least on linux) which causes the size to differ between old and new build.
428ifeq ($(USE_EXTERNAL_LIBZ), true)
429 UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
430 UNPACKEXE_ZIPOBJS := -lz
431else
sherman0ffd8242014-06-04 15:15:09 -0700432 UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.8
ihse554e46f2013-11-14 11:19:32 +0100433 UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
434 $(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
435 $(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
436 $(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
437 $(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
438 $(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
439 $(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
440 $(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
441 $(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
442 $(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
443
444endif
445
ihse554e46f2013-11-14 11:19:32 +0100446UNPACKEXE_LANG := C
447ifeq ($(OPENJDK_TARGET_OS), solaris)
448 UNPACKEXE_LANG := C++
449endif
450# On windows, unpack200 is linked completely differently to all other
451# executables, using the compiler with the compiler arguments.
452# It's also linked incrementally, producing a .ilk file that needs to
453# be kept away.
454ifeq ($(OPENJDK_TARGET_OS), windows)
455 BUILD_UNPACKEXE_LDEXE := $(CC)
456 EXE_OUT_OPTION_save := $(EXE_OUT_OPTION)
457 EXE_OUT_OPTION := -Fe
458endif
kvn7130df72013-12-05 15:10:36 -0800459
460# The linker on older SuSE distros (e.g. on SLES 10) complains with:
461# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
462# if feeded with a version script which contains named tags.
463ifeq ($(USING_BROKEN_SUSE_LD), yes)
464 UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200.anonymous
465else
466 UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200
467endif
468
ihse554e46f2013-11-14 11:19:32 +0100469$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
470 SRC := $(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack, \
471 EXCLUDE_FILES := jni.cpp, \
472 LANG := $(UNPACKEXE_LANG), \
473 OPTIMIZATION := LOW, \
474 CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) \
475 -DFULL, \
476 CFLAGS_release := -DPRODUCT, \
477 CFLAGS_linux := -fPIC, \
478 CFLAGS_solaris := -KPIC, \
479 CFLAGS_macosx := -fPIC, \
kvn7130df72013-12-05 15:10:36 -0800480 MAPFILE := $(UNPACK_MAPFILE),\
ihse554e46f2013-11-14 11:19:32 +0100481 LDFLAGS := $(UNPACKEXE_ZIPOBJS), \
482 LDFLAGS_windows := $(CXXFLAGS_JDKEXE), \
483 LDFLAGS_posix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
484 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
485 $(call SET_SHARED_LIBRARY_ORIGIN), \
486 LDFLAGS_linux := -lc, \
487 LDFLAGS_solaris := $(UNPACKEXE_LDFLAGS_solaris) -lc, \
488 LDFLAGS_SUFFIX := $(LIBCXX), \
489 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \
490 OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \
491 PROGRAM := unpack200, \
492 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
493 RC_FLAGS := $(RC_FLAGS) \
494 -D "JDK_FNAME=unpack200.exe" \
495 -D "JDK_INTERNAL_NAME=unpack200" \
496 -D "JDK_FTYPE=0x1L", \
497 DEBUG_SYMBOLS := true, \
498 MANIFEST := $(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))
499
500ifeq ($(OPENJDK_TARGET_OS), windows)
501 EXE_OUT_OPTION := $(EXE_OUT_OPTION_save)
502endif
503
504ifneq ($(USE_EXTERNAL_LIBZ), true)
505
506 $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
507
508endif
509
510# Build into object dir and copy executable afterwards to avoid .ilk file in
511# image. The real fix would be clean up linking of unpack200 using
512# -link -incremental:no
513# like all other launchers.
514$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
515 $(call install-file)
516
517BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX)
518
519##########################################################################################
520
521
522BUILD_JEXEC :=
523BUILD_JEXEC_SRC :=
524BUILD_JEXEC_INC :=
525BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
526
527#
528# UNHANDLED:
529# - COMPILE_APPROACH = normal
530#
531
532#
533# jdk/make/java/Makefile
534#
535ifeq ($(OPENJDK_TARGET_OS), solaris)
536 ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
537 BUILD_JEXEC := 1
538 endif
539endif
540
541ifeq ($(OPENJDK_TARGET_OS), linux)
542 BUILD_JEXEC := 1
543endif # OPENJDK_TARGET_OS
544
545#
546# jdk/make/java/jexec/Makefile
547#
548ifeq ($(BUILD_JEXEC), 1)
549
550 ifeq ($(OPENJDK_TARGET_OS), windows)
551 else ifeq ($(OPENJDK_TARGET_OS), macosx)
552 BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/macosx/bin
553 else
554 BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/solaris/bin
555 endif
556
557 ifeq ($(OPENJDK_TARGET_OS), linux)
558 BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
559 BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
560 endif
561endif
562
563#
564# Note that the two Makefile's seems to contradict each other,
565# and that src/macosx/bin/jexec.c seems unused
566#
567ifneq ($(BUILD_JEXEC_SRC), )
568 $(eval $(call SetupNativeCompilation,BUILD_JEXEC, \
569 SRC := $(BUILD_JEXEC_SRC), \
570 INCLUDE_FILES := jexec.c, \
571 LANG := C, \
572 OPTIMIZATION := LOW, \
573 CFLAGS := $(CFLAGS_JDKEXE) \
574 $(BUILD_JEXEC_INC), \
575 CFLAGS_linux := -fPIC, \
576 CFLAGS_solaris := -KPIC, \
577 LDFLAGS := $(LDFLAGS_JDKEXE) \
578 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
579 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jexec_obj, \
580 OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
581 DEBUG_SYMBOLS := true, \
582 PROGRAM := jexec))
583
584 BUILD_LAUNCHERS += $(BUILD_JEXEC)
585endif
586
587##########################################################################################
588
589#
590# The java-rmi.cgi script in bin/ only gets delivered in certain situations
591#
592JAVA_RMI_CGI := $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
593ifeq ($(OPENJDK_TARGET_OS), linux)
594 BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
595endif
596ifeq ($(OPENJDK_TARGET_OS), solaris)
597 BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
598endif
599
600# TODO:
601# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all
602# this time anyway. Since jdk6, it has been built from the wrong source and resulted
603# in a (almost) copy of the standard java launcher named "java-rmi.exe" ending up in
604# the final images bin dir. This weird behavior is mimicked here in the converted
605# makefiles for now. Should probably just be deleted.
606# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
607ifeq ($(OPENJDK_TARGET_OS), windows)
608 $(eval $(call SetupLauncher,java-rmi, , \
609 $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/make/java/main/java/mapfile-$(OPENJDK_TARGET_CPU))))
610else
611 $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
612 $(call install-file)
613 $(CHMOD) a+x $@
614endif
615
616##########################################################################################
617
618BUILD_JSPAWNHELPER :=
619BUILD_JSPAWNHELPER_SRC := $(JDK_TOPDIR)/src/solaris/native/java/lang
620BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
621LINK_JSPAWNHELPER_OBJECTS := $(JDK_OUTPUTDIR)/objs/libjava/childproc.o
622LINK_JSPAWNHELPER_FLAGS :=
623
kvn7130df72013-12-05 15:10:36 -0800624ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
ihse554e46f2013-11-14 11:19:32 +0100625 BUILD_JSPAWNHELPER := 1
626endif
627
628ifeq ($(OPENJDK_TARGET_OS), macosx)
629 BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib
630endif
631
632ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
kvn7130df72013-12-05 15:10:36 -0800633 LINK_JSPAWNHELPER_FLAGS += $(COMPILER_TARGET_BITS_FLAG)64
ihse554e46f2013-11-14 11:19:32 +0100634endif
635
636ifeq ($(BUILD_JSPAWNHELPER), 1)
637 $(eval $(call SetupNativeCompilation,BUILD_JSPAWNHELPER, \
638 SRC := $(BUILD_JSPAWNHELPER_SRC), \
639 INCLUDE_FILES := jspawnhelper.c, \
640 LANG := C, \
641 OPTIMIZATION := LOW, \
642 CFLAGS := $(CFLAGS_JDKEXE), \
643 LDFLAGS := $(LDFLAGS_JDKEXE) $(LINK_JSPAWNHELPER_FLAGS), \
644 LDFLAGS_SUFFIX := $(LINK_JSPAWNHELPER_OBJECTS), \
645 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jspawnhelper, \
646 OUTPUT_DIR := $(BUILD_JSPAWNHELPER_DST_DIR), \
647 PROGRAM := jspawnhelper))
648
649 $(BUILD_JSPAWNHELPER): $(LINK_JSPAWNHELPER_OBJECTS)
650
651 BUILD_LAUNCHERS += $(BUILD_JSPAWNHELPER)
652endif
653
654##########################################################################################
655# jabswitch
656
ihse554e46f2013-11-14 11:19:32 +0100657 ifeq ($(OPENJDK_TARGET_OS), windows)
658
659 $(eval $(call SetupNativeCompilation,BUILD_JABSWITCH, \
ptbrunetdc4e52b2015-03-31 18:39:00 +0400660 SRC := $(JDK_TOPDIR)/src/windows/native/sun/bridge, \
ihse554e46f2013-11-14 11:19:32 +0100661 INCLUDE_FILES := jabswitch.cpp, \
662 LANG := C++, \
663 CFLAGS := $(filter-out -Zc:wchar_t-, $(CFLAGS_JDKEXE)) -Zc:wchar_t \
664 -analyze- -Od -Gd -D_WINDOWS \
665 -D_UNICODE -DUNICODE -RTC1 -EHsc, \
666 LDFLAGS := $(LDFLAGS_JDKEXE) \
667 Advapi32.lib Version.lib User32.lib, \
668 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jabswitch, \
669 OUTPUT_DIR := $(JDK_OUTPUTDIR)/bin, \
670 PROGRAM := jabswitch, \
671 DEBUG_SYMBOLS := true, \
ptbrunetdc4e52b2015-03-31 18:39:00 +0400672 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/native/sun/bridge/AccessBridgeStatusWindow.rc, \
ptbrunet0dc55502014-02-27 16:11:08 -0600673 RC_FLAGS := $(RC_FLAGS) \
674 -D "JDK_FNAME=jabswitch.exe" \
675 -D "JDK_INTERNAL_NAME=jabswitch" \
676 -D "JDK_FTYPE=0x01L", \
ptbrunetdc4e52b2015-03-31 18:39:00 +0400677 MANIFEST := $(JDK_TOPDIR)/src/windows/native/sun/bridge/jabswitch.manifest))
ihse554e46f2013-11-14 11:19:32 +0100678
679 BUILD_LAUNCHERS += $(BUILD_JABSWITCH)
680
681 endif
ihse554e46f2013-11-14 11:19:32 +0100682
683##########################################################################################
684
685$(BUILD_LAUNCHERS): $(JDK_TOPDIR)/make/CompileLaunchers.gmk
686
687all: $(BUILD_LAUNCHERS)
688
689.PHONY: all