blob: 85434c1df21e420bd058fc6545ec28786ed87536 [file] [log] [blame]
ihse554e46f2013-11-14 11:19:32 +01001#
ptbrunet0dc55502014-02-27 16:11:08 -06002# Copyright (c) 2011, 2014, 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
432 UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
433 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
446ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
447 UNPACKEXE_CFLAGS += -xregs=no%appl
448 UNPACKEXE_LDFLAGS_solaris += -xmemalign=4s
449endif
450
451UNPACKEXE_LANG := C
452ifeq ($(OPENJDK_TARGET_OS), solaris)
453 UNPACKEXE_LANG := C++
454endif
455# On windows, unpack200 is linked completely differently to all other
456# executables, using the compiler with the compiler arguments.
457# It's also linked incrementally, producing a .ilk file that needs to
458# be kept away.
459ifeq ($(OPENJDK_TARGET_OS), windows)
460 BUILD_UNPACKEXE_LDEXE := $(CC)
461 EXE_OUT_OPTION_save := $(EXE_OUT_OPTION)
462 EXE_OUT_OPTION := -Fe
463endif
kvn7130df72013-12-05 15:10:36 -0800464
465# The linker on older SuSE distros (e.g. on SLES 10) complains with:
466# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
467# if feeded with a version script which contains named tags.
468ifeq ($(USING_BROKEN_SUSE_LD), yes)
469 UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200.anonymous
470else
471 UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200
472endif
473
ihse554e46f2013-11-14 11:19:32 +0100474$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
475 SRC := $(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack, \
476 EXCLUDE_FILES := jni.cpp, \
477 LANG := $(UNPACKEXE_LANG), \
478 OPTIMIZATION := LOW, \
479 CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) \
480 -DFULL, \
481 CFLAGS_release := -DPRODUCT, \
482 CFLAGS_linux := -fPIC, \
483 CFLAGS_solaris := -KPIC, \
484 CFLAGS_macosx := -fPIC, \
kvn7130df72013-12-05 15:10:36 -0800485 MAPFILE := $(UNPACK_MAPFILE),\
ihse554e46f2013-11-14 11:19:32 +0100486 LDFLAGS := $(UNPACKEXE_ZIPOBJS), \
487 LDFLAGS_windows := $(CXXFLAGS_JDKEXE), \
488 LDFLAGS_posix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
489 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
490 $(call SET_SHARED_LIBRARY_ORIGIN), \
491 LDFLAGS_linux := -lc, \
492 LDFLAGS_solaris := $(UNPACKEXE_LDFLAGS_solaris) -lc, \
493 LDFLAGS_SUFFIX := $(LIBCXX), \
494 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \
495 OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \
496 PROGRAM := unpack200, \
497 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
498 RC_FLAGS := $(RC_FLAGS) \
499 -D "JDK_FNAME=unpack200.exe" \
500 -D "JDK_INTERNAL_NAME=unpack200" \
501 -D "JDK_FTYPE=0x1L", \
502 DEBUG_SYMBOLS := true, \
503 MANIFEST := $(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))
504
505ifeq ($(OPENJDK_TARGET_OS), windows)
506 EXE_OUT_OPTION := $(EXE_OUT_OPTION_save)
507endif
508
509ifneq ($(USE_EXTERNAL_LIBZ), true)
510
511 $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
512
513endif
514
515# Build into object dir and copy executable afterwards to avoid .ilk file in
516# image. The real fix would be clean up linking of unpack200 using
517# -link -incremental:no
518# like all other launchers.
519$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
520 $(call install-file)
521
522BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX)
523
524##########################################################################################
525
526
527BUILD_JEXEC :=
528BUILD_JEXEC_SRC :=
529BUILD_JEXEC_INC :=
530BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
531
532#
533# UNHANDLED:
534# - COMPILE_APPROACH = normal
535#
536
537#
538# jdk/make/java/Makefile
539#
540ifeq ($(OPENJDK_TARGET_OS), solaris)
541 ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
542 BUILD_JEXEC := 1
543 endif
544endif
545
546ifeq ($(OPENJDK_TARGET_OS), linux)
547 BUILD_JEXEC := 1
548endif # OPENJDK_TARGET_OS
549
550#
551# jdk/make/java/jexec/Makefile
552#
553ifeq ($(BUILD_JEXEC), 1)
554
555 ifeq ($(OPENJDK_TARGET_OS), windows)
556 else ifeq ($(OPENJDK_TARGET_OS), macosx)
557 BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/macosx/bin
558 else
559 BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/solaris/bin
560 endif
561
562 ifeq ($(OPENJDK_TARGET_OS), linux)
563 BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
564 BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
565 endif
566endif
567
568#
569# Note that the two Makefile's seems to contradict each other,
570# and that src/macosx/bin/jexec.c seems unused
571#
572ifneq ($(BUILD_JEXEC_SRC), )
573 $(eval $(call SetupNativeCompilation,BUILD_JEXEC, \
574 SRC := $(BUILD_JEXEC_SRC), \
575 INCLUDE_FILES := jexec.c, \
576 LANG := C, \
577 OPTIMIZATION := LOW, \
578 CFLAGS := $(CFLAGS_JDKEXE) \
579 $(BUILD_JEXEC_INC), \
580 CFLAGS_linux := -fPIC, \
581 CFLAGS_solaris := -KPIC, \
582 LDFLAGS := $(LDFLAGS_JDKEXE) \
583 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
584 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jexec_obj, \
585 OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
586 DEBUG_SYMBOLS := true, \
587 PROGRAM := jexec))
588
589 BUILD_LAUNCHERS += $(BUILD_JEXEC)
590endif
591
592##########################################################################################
593
594#
595# The java-rmi.cgi script in bin/ only gets delivered in certain situations
596#
597JAVA_RMI_CGI := $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
598ifeq ($(OPENJDK_TARGET_OS), linux)
599 BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
600endif
601ifeq ($(OPENJDK_TARGET_OS), solaris)
602 BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
603endif
604
605# TODO:
606# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all
607# this time anyway. Since jdk6, it has been built from the wrong source and resulted
608# in a (almost) copy of the standard java launcher named "java-rmi.exe" ending up in
609# the final images bin dir. This weird behavior is mimicked here in the converted
610# makefiles for now. Should probably just be deleted.
611# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
612ifeq ($(OPENJDK_TARGET_OS), windows)
613 $(eval $(call SetupLauncher,java-rmi, , \
614 $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/make/java/main/java/mapfile-$(OPENJDK_TARGET_CPU))))
615else
616 $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
617 $(call install-file)
618 $(CHMOD) a+x $@
619endif
620
621##########################################################################################
622
623BUILD_JSPAWNHELPER :=
624BUILD_JSPAWNHELPER_SRC := $(JDK_TOPDIR)/src/solaris/native/java/lang
625BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
626LINK_JSPAWNHELPER_OBJECTS := $(JDK_OUTPUTDIR)/objs/libjava/childproc.o
627LINK_JSPAWNHELPER_FLAGS :=
628
kvn7130df72013-12-05 15:10:36 -0800629ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
ihse554e46f2013-11-14 11:19:32 +0100630 BUILD_JSPAWNHELPER := 1
631endif
632
633ifeq ($(OPENJDK_TARGET_OS), macosx)
634 BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib
635endif
636
637ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
kvn7130df72013-12-05 15:10:36 -0800638 LINK_JSPAWNHELPER_FLAGS += $(COMPILER_TARGET_BITS_FLAG)64
ihse554e46f2013-11-14 11:19:32 +0100639endif
640
641ifeq ($(BUILD_JSPAWNHELPER), 1)
642 $(eval $(call SetupNativeCompilation,BUILD_JSPAWNHELPER, \
643 SRC := $(BUILD_JSPAWNHELPER_SRC), \
644 INCLUDE_FILES := jspawnhelper.c, \
645 LANG := C, \
646 OPTIMIZATION := LOW, \
647 CFLAGS := $(CFLAGS_JDKEXE), \
648 LDFLAGS := $(LDFLAGS_JDKEXE) $(LINK_JSPAWNHELPER_FLAGS), \
649 LDFLAGS_SUFFIX := $(LINK_JSPAWNHELPER_OBJECTS), \
650 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jspawnhelper, \
651 OUTPUT_DIR := $(BUILD_JSPAWNHELPER_DST_DIR), \
652 PROGRAM := jspawnhelper))
653
654 $(BUILD_JSPAWNHELPER): $(LINK_JSPAWNHELPER_OBJECTS)
655
656 BUILD_LAUNCHERS += $(BUILD_JSPAWNHELPER)
657endif
658
659##########################################################################################
660# jabswitch
661
662ifndef OPENJDK
663 ifeq ($(OPENJDK_TARGET_OS), windows)
664
665 $(eval $(call SetupNativeCompilation,BUILD_JABSWITCH, \
666 SRC := $(JDK_TOPDIR)/src/closed/windows/native/sun/bridge, \
667 INCLUDE_FILES := jabswitch.cpp, \
668 LANG := C++, \
669 CFLAGS := $(filter-out -Zc:wchar_t-, $(CFLAGS_JDKEXE)) -Zc:wchar_t \
670 -analyze- -Od -Gd -D_WINDOWS \
671 -D_UNICODE -DUNICODE -RTC1 -EHsc, \
672 LDFLAGS := $(LDFLAGS_JDKEXE) \
673 Advapi32.lib Version.lib User32.lib, \
674 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jabswitch, \
675 OUTPUT_DIR := $(JDK_OUTPUTDIR)/bin, \
676 PROGRAM := jabswitch, \
677 DEBUG_SYMBOLS := true, \
678 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/AccessBridgeStatusWindow.rc, \
ptbrunet0dc55502014-02-27 16:11:08 -0600679 RC_FLAGS := $(RC_FLAGS) \
680 -D "JDK_FNAME=jabswitch.exe" \
681 -D "JDK_INTERNAL_NAME=jabswitch" \
682 -D "JDK_FTYPE=0x01L", \
ihse554e46f2013-11-14 11:19:32 +0100683 MANIFEST := $(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/jabswitch.manifest))
684
685 BUILD_LAUNCHERS += $(BUILD_JABSWITCH)
686
687 endif
688endif
689
690##########################################################################################
691
692$(BUILD_LAUNCHERS): $(JDK_TOPDIR)/make/CompileLaunchers.gmk
693
694all: $(BUILD_LAUNCHERS)
695
696.PHONY: all