blob: ce651675bad534990de2d2ff9d2916faf8308111 [file] [log] [blame]
ohair46fcac92012-09-18 11:29:24 -07001#
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
26defalt: 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# Build tools
36include Tools.gmk
37
38BUILD_LAUNCHERS=
39
40# When building a legacy overlay image (on solaris 64 bit), the launchers
41# need to be built with a different rpath and a different output dir.
42ifeq ($(OVERLAY_IMAGES),true)
43 ORIGIN_ROOT:=/../..
44 OUTPUT_SUBDIR:=$(OPENJDK_TARGET_CPU_ISADIR)
45else
46 ORIGIN_ROOT:=/..
47endif
48
49ifeq ($(OPENJDK_TARGET_OS), macosx)
50 ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN)
51else
52 ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) \
53 $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
54endif
55
56#
57# Applications expect to be able to link against libjawt without invoking
58# System.loadLibrary("jawt") first. This was the behaviour described in the
59# devloper documentation of JAWT and what worked with OpenJDK6.
60#
61ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris),)
62 ORIGIN_ARG+=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)) \
63 $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR))
64endif
65
66define SetupLauncher
67 # TODO: Fix mapfile on solaris. Won't work with ld as linker.
68 # Parameter 1 is the name of the launcher (java,javac,jar...)
69 # Parameter 2 is extra CFLAGS
70 # Parameter 3 is extra LDFLAGS
71 # Parameter 4 is extra LDFLAGS_SUFFIX_posix
72 # Parameter 5 is extra LDFLAGS_SUFFIX_windows
73 # Parameter 6 is optional Windows JLI library (full path)
74 # Parameter 7 is optional Windows resource (RC) flags
75 # Parameter 8 is optional Windows version resource file (.rc)
76 # Parameter 9 is different output dir
77 # Parameter 10 if set, link statically with c runtime on windows.
78 # Parameter 11 if set, override plist file on macosx.
79
80 $1_WINDOWS_JLI_LIB:=$(JDK_OUTPUTDIR)/objs/libjli/jli.lib
81 ifneq ($6,)
82 $1_WINDOWS_JLI_LIB:=$6
83 endif
84 $1_VERSION_INFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc
85 ifneq ($8,)
86 $1_VERSION_INFO_RESOURCE:=$8
87 endif
88
89 $1_LDFLAGS := $3
90 $1_LDFLAGS_SUFFIX :=
91 ifeq ($(OPENJDK_TARGET_OS), macosx)
92 $1_PLIST_FILE:=Info-cmdline.plist
93 ifneq ($(11),)
94 $1_PLIST_FILE:=$(11)
95 endif
96
97 $1_LDFLAGS += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
98 -framework Cocoa -framework Security -framework ApplicationServices \
99 -sectcreate __TEXT __info_plist $(JDK_TOPDIR)/src/macosx/lib/$$($1_PLIST_FILE)
100 $1_LDFLAGS_SUFFIX += -pthread
101 endif
102
103 ifeq ($(USE_EXTERNAL_LIBZ), true)
104 $1_LDFLAGS_SUFFIX += -lz
105 endif
106
107 $1_OUTPUT_DIR_ARG:=$9
108 ifeq (,$$($1_OUTPUT_DIR_ARG))
109 $1_OUTPUT_DIR_ARG:=$(JDK_OUTPUTDIR)/bin
110 endif
111
112 # TODO: maybe it's better to move this if-statement out of this function
113 ifeq ($1,java)
114 $1_OPTIMIZATION_ARG:=HIGH
115 $1_LDFLAGS_solaris:=-R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR)
116 else
117 $1_OPTIMIZATION_ARG:=LOW
118 endif
119
120 $1_CFLAGS:=$(CFLAGS_JDKEXE)
121 ifeq ($(10),true)
122 $1_CFLAGS:=$(filter-out -MD,$(CFLAGS_JDKEXE))
123 endif
124
125 $(call SetupNativeCompilation,BUILD_LAUNCHER_$1,\
126 SRC:=$(JDK_TOPDIR)/src/share/bin,\
127 INCLUDE_FILES:=main.c,\
128 LANG:=C,\
129 OPTIMIZATION:=$$($1_OPTIMIZATION_ARG), \
130 CFLAGS:=$$($1_CFLAGS) \
131 -I$(JDK_TOPDIR)/src/share/bin \
132 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin \
133 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/bin \
134 -DFULL_VERSION='"$(FULL_VERSION)"' \
135 -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
136 -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
137 -DLIBARCHNAME='"$(OPENJDK_TARGET_CPU_LEGACY)"' \
138 -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
139 -DPROGNAME='"$1"' $(DPACKAGEPATH) \
140 $2,\
141 CFLAGS_linux:=-fPIC,\
142 CFLAGS_solaris:=-KPIC -DHAVE_GETHRTIME,\
143 LDFLAGS:=$(LDFLAGS_JDKEXE) \
144 $(ORIGIN_ARG) \
145 $$($1_LDFLAGS),\
146 LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_NAME,$1),\
147 LDFLAGS_linux:=-lpthread \
148 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)),\
149 LDFLAGS_solaris:=$$($1_LDFLAGS_solaris) \
150 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)),\
151 MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU), \
152 LDFLAGS_SUFFIX:=$(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX),\
153 LDFLAGS_SUFFIX_posix:=$4,\
154 LDFLAGS_SUFFIX_windows:=$$($1_WINDOWS_JLI_LIB) \
155 $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5,\
156 LDFLAGS_SUFFIX_linux:=-L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
157 LDFLAGS_SUFFIX_solaris:=-L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
158 OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/$1_objs$(OUTPUT_SUBDIR),\
159 OUTPUT_DIR:=$$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR),\
160 PROGRAM:=$1,\
161 DEBUG_SYMBOLS:=true,\
162 VERSIONINFO_RESOURCE:=$$($1_VERSION_INFO_RESOURCE),\
163 RC_FLAGS:=$(RC_FLAGS)\
164 /D "JDK_FNAME=$1$(EXE_SUFFIX)" \
165 /D "JDK_INTERNAL_NAME=$1" \
166 /D "JDK_FTYPE=0x1L" \
167 $7,\
168 MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/java.manifest)
169
170 BUILD_LAUNCHERS += $$(BUILD_LAUNCHER_$1)
171
172 ifeq ($(OPENJDK_TARGET_OS),macosx)
173 $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjli_static.a
174 endif
175
176 ifeq ($(OPENJDK_TARGET_OS),windows)
177 $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
178 $$($1_WINDOWS_JLI_LIB)
179 endif
180endef
181
182##########################################################################################
183
184XLIBS:=$(X_LIBS) -lX11
185ifeq ($(OPENJDK_TARGET_OS),macosx)
186 DPACKAGEPATH:=-DPACKAGE_PATH='"$(PACKAGE_PATH)"'
187 XLIBS:=
188endif
189
190ifdef OPENJDK
191 JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
192else
193 JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
194endif
195
196# On windows, the debuginfo files get the same name as for java.dll. Build
197# into another dir and copy selectively so debuginfo for java.dll isn't
198# overwritten.
199$(eval $(call SetupLauncher,java,\
200 -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
201 $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
202 $(JDK_TOPDIR)/src/windows/resource/java.rc,$(JDK_OUTPUTDIR)/objs/java_objs,true))
203
204$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
205 $(MKDIR) -p $(@D)
206 $(RM) $@
207 $(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
208
209BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
210
211ifeq ($(OPENJDK_TARGET_OS),windows)
212 $(eval $(call SetupLauncher,javaw,\
213 -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
214 $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
215 $(JDK_TOPDIR)/src/windows/resource/java.rc,,true))
216endif
217
218
219ifndef BUILD_HEADLESS_ONLY
220$(eval $(call SetupLauncher,appletviewer,\
221 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',,\
222 $(XLIBS)))
223endif
224
225$(eval $(call SetupLauncher,extcheck,\
226 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.extcheck.Main"$(COMMA) }'))
227
228$(eval $(call SetupLauncher,idlj,\
229 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))
230
231$(eval $(call SetupLauncher,jar,\
232 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
233
234$(eval $(call SetupLauncher,jarsigner,\
235 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.JarSigner"$(COMMA) }'))
236
237$(eval $(call SetupLauncher,javac,\
238 -DEXPAND_CLASSPATH_WILDCARDS \
239 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
240 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))
241
242$(eval $(call SetupLauncher,javadoc,\
243 -DEXPAND_CLASSPATH_WILDCARDS \
244 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
245 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
246
247$(eval $(call SetupLauncher,javah,\
248 -DEXPAND_CLASSPATH_WILDCARDS \
249 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
250 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))
251
252$(eval $(call SetupLauncher,javap,\
253 -DEXPAND_CLASSPATH_WILDCARDS \
254 -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
255 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
256
257BUILD_LAUNCHER_jconsole_CFLAGS_windows:=-DJAVAW
258BUILD_LAUNCHER_jconsole_LDFLAGS_windows:=user32.lib
259
260$(eval $(call SetupLauncher,jconsole,\
261 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
262 -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))
263
264$(eval $(call SetupLauncher,jdb,\
265 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
266 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
267
268$(eval $(call SetupLauncher,jhat,\
269 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))
270
271$(eval $(call SetupLauncher,jinfo,\
272 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
273 "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
274 "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
275 "sun.tools.jinfo.JInfo"$(COMMA) }' \
276 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
277 ,,,,,,,,,Info-privileged.plist))
278
279$(eval $(call SetupLauncher,jmap,\
280 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
281 "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
282 "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
283 "sun.tools.jmap.JMap"$(COMMA) }' \
284 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
285 ,,,,,,,,,Info-privileged.plist))
286
287$(eval $(call SetupLauncher,jps,\
288 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))
289
290$(eval $(call SetupLauncher,jrunscript,\
291 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
292
293$(eval $(call SetupLauncher,jsadebugd,\
294 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
295 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
296 ,,,,,,,,,Info-privileged.plist))
297
298$(eval $(call SetupLauncher,jstack,\
299 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
300 "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
301 "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
302 "sun.tools.jstack.JStack"$(COMMA) }' \
303 -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
304 ,,,,,,,,,Info-privileged.plist))
305
306$(eval $(call SetupLauncher,jstat,\
307 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))
308
309$(eval $(call SetupLauncher,jstatd,\
310 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
311
312$(eval $(call SetupLauncher,keytool,\
313 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.KeyTool"$(COMMA) }'))
314
315$(eval $(call SetupLauncher,native2ascii,\
316 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
317
318ifndef BUILD_HEADLESS_ONLY
319$(eval $(call SetupLauncher,policytool,\
320 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',,\
321 $(XLIBS)))
322endif
323
324$(eval $(call SetupLauncher,rmic,\
325 -DEXPAND_CLASSPATH_WILDCARDS \
326 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
327
328$(eval $(call SetupLauncher,schemagen,\
329 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))
330
331$(eval $(call SetupLauncher,serialver,\
332 -DEXPAND_CLASSPATH_WILDCARDS \
333 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
334
335$(eval $(call SetupLauncher,xjc,\
336 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
337
338$(eval $(call SetupLauncher,wsgen,\
339 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))
340
341$(eval $(call SetupLauncher,wsimport,\
342 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
343
344$(eval $(call SetupLauncher,orbd,\
345 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
346 "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
347 "-J-Dcom.sun.CORBA.activation.Port=1049"$(COMMA) \
348 "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
349 "com.sun.corba.se.impl.activation.ORBD"$(COMMA) }'))
350
351$(eval $(call SetupLauncher,servertool,\
352 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))
353
354$(eval $(call SetupLauncher,tnameserv,\
355 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
356 "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
357 "-J-Djava.util.logging.LoggingPermission=contol"$(COMMA) \
358 "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
359 "com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))
360
361$(eval $(call SetupLauncher,pack200,\
362 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) "--pack" }'))
363
364$(eval $(call SetupLauncher,rmid,\
365 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
366
367$(eval $(call SetupLauncher,rmiregistry,\
368 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
369
370$(eval $(call SetupLauncher,jcmd,\
371 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
372
373ifeq ($(OPENJDK_TARGET_OS),windows)
374 $(eval $(call SetupLauncher,kinit,\
375 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
376
377 $(eval $(call SetupLauncher,klist,\
378 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
379
380 $(eval $(call SetupLauncher,ktab,\
381 -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
382endif
383
384##########################################################################################
385# The order of the object files on the link command line affects the size of the resulting
386# binary (at least on linux) which causes the size to differ between old and new build.
387ifeq ($(USE_EXTERNAL_LIBZ), true)
388UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
389UNPACKEXE_ZIPOBJS := -lz
390else
391UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
392UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
393 $(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
394 $(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
395 $(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
396 $(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
397 $(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
398 $(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
399 $(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
400 $(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
401 $(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
402
403endif
404
405ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
406 UNPACKEXE_CFLAGS += -xregs=no%appl
407endif
408
409UNPACKEXE_LANG:=C
410ifeq ($(OPENJDK_TARGET_OS),solaris)
411 UNPACKEXE_LANG:=C++
412endif
413
414$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE,\
415 SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack,\
416 EXCLUDE_FILES:=jni.cpp,\
417 LANG:=$(UNPACKEXE_LANG),\
418 OPTIMIZATION := LOW, \
419 CFLAGS:=$(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE)\
420 -DFULL, \
421 CFLAGS_release:=-DPRODUCT,\
422 CFLAGS_linux:=-fPIC,\
423 CFLAGS_solaris := -KPIC, \
424 CFLAGS_macosx := -fPIC, \
425 MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers-unpack200, \
426 LDFLAGS:=$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
427 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
428 $(call SET_SHARED_LIBRARY_ORIGIN) \
429 $(UNPACKEXE_ZIPOBJS),\
430 LDFLAGS_linux:=-lc,\
431 LDFLAGS_SUFFIX:=$(LIBCXX),\
432 LDFLAGS_SUFFIX_solaris:=-lc,\
433 OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR),\
434 OUTPUT_DIR:=$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR),\
435 PROGRAM:=unpack200,\
436 VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
437 RC_FLAGS:=$(RC_FLAGS)\
438 /D "JDK_FNAME=unpack200.exe" \
439 /D "JDK_INTERNAL_NAME=unpack200" \
440 /D "JDK_FTYPE=0x1L",\
441 MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))
442
443ifneq ($(USE_EXTERNAL_LIBZ), true)
444
445$(BUILD_UNPACKEXE) : $(UNPACKEXE_ZIPOBJS)
446
447endif
448
449BUILD_LAUNCHERS += $(BUILD_UNPACKEXE)
450
451##########################################################################################
452
453
454BUILD_JEXEC :=
455BUILD_JEXEC_SRC :=
456BUILD_JEXEC_INC :=
457BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
458
459#
460# UNHANDLED:
461# - COMPILE_APPROACH = normal
462#
463
464#
465# jdk/make/java/Makefile
466#
467ifeq ($(OPENJDK_TARGET_OS), solaris)
468 ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
469 BUILD_JEXEC := 1
470 endif
471endif
472
473ifeq ($(OPENJDK_TARGET_OS), linux)
474 BUILD_JEXEC := 1
475endif # OPENJDK_TARGET_OS
476
477#
478# jdk/make/java/jexec/Makefile
479#
480ifeq ($(BUILD_JEXEC), 1)
481
482 ifeq ($(OPENJDK_TARGET_OS),windows)
483 else ifeq ($(OPENJDK_TARGET_OS),macosx)
484 BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/macosx/bin
485 else
486 BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/solaris/bin
487 endif
488
489 ifeq ($(OPENJDK_TARGET_OS), linux)
490 BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
491 BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
492 endif
493endif
494
495#
496# Note that the two Makefile's seems to contradict each other,
497# and that src/macosx/bin/jexec.c seems unused
498#
499ifneq ($(BUILD_JEXEC_SRC),)
500 $(eval $(call SetupNativeCompilation,BUILD_JEXEC,\
501 SRC:=$(BUILD_JEXEC_SRC),\
502 INCLUDE_FILES:=jexec.c,\
503 LANG:=C,\
504 OPTIMIZATION := LOW, \
505 CFLAGS:=$(CFLAGS_JDKEXE)\
506 $(BUILD_JEXEC_INC), \
507 CFLAGS_linux:=-fPIC,\
508 CFLAGS_solaris:=-KPIC,\
509 LDFLAGS:=$(LDFLAGS_JDKEXE) \
510 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
511 OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jexec_obj,\
512 OUTPUT_DIR:=$(BUILD_JEXEC_DST_DIR),\
513 PROGRAM:=jexec))
514
515 BUILD_LAUNCHERS += $(BUILD_JEXEC)
516endif
517
518##########################################################################################
519
520#
521# The java-rmi.cgi script in bin/ only gets delivered in certain situations
522#
523JAVA_RMI_CGI:=$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
524ifeq ($(OPENJDK_TARGET_OS), linux)
525 BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
526endif
527ifeq ($(OPENJDK_TARGET_OS), solaris)
528 ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
529 BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
530 endif
531endif
532
533# TODO:
534# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all
535# this time anyway. Since jdk6, it has been built from the wrong source and resulted
536# in a copy of the standard java launcher named "java-rmi.exe" ending up in the final
537# images bin dir. This weird behavior is mimicked here in the converted makefiles for
538# now. Should probably just be deleted.
539# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
540ifeq ($(OPENJDK_TARGET_OS),windows)
541 $(eval $(call SetupLauncher,java-rmi,\
542 -DEXPAND_CLASSPATH_WILDCARDS,\
543 $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/makefiles/java/main/java/mapfile-$(OPENJDK_TARGET_CPU))))
544else
545 $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
546 $(MKDIR) -p $(@D)
547 $(CP) $< $@
548 $(CHMOD) a+x $@
549endif
550
551##########################################################################################
552
553$(BUILD_LAUNCHERS) : $(JDK_TOPDIR)/makefiles/CompileLaunchers.gmk
554
555all: $(BUILD_LAUNCHERS)
556
557.PHONY: all