CompileLaunchers.gmk 22.9 KB
Newer Older
O
ohair 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

defalt: all

include $(SPEC)
include MakeBase.gmk
include NativeCompilation.gmk

# Setup the java compilers for the JDK build.
include Setup.gmk

35 36 37
# Prepare the find cache. Only used on windows.
$(eval $(call FillCacheFind,$(JDK_TOPDIR)/src/share/bin))

O
ohair 已提交
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
# Build tools
include Tools.gmk

BUILD_LAUNCHERS=

# When building a legacy overlay image (on solaris 64 bit), the launchers 
# need to be built with a different rpath and a different output dir.
ifeq ($(OVERLAY_IMAGES),true)
    ORIGIN_ROOT:=/../..
    OUTPUT_SUBDIR:=$(OPENJDK_TARGET_CPU_ISADIR)
else
    ORIGIN_ROOT:=/..
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
    ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN)
else
    ORIGIN_ARG:=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) \
                $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
endif

#
# Applications expect to be able to link against libjawt without invoking
# System.loadLibrary("jawt") first. This was the behaviour described in the
# devloper documentation of JAWT and what worked with OpenJDK6.
#
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris),)
    ORIGIN_ARG+=$(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)) \
                $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)) 
endif

define SetupLauncher
    # TODO: Fix mapfile on solaris. Won't work with ld as linker.
    # Parameter 1 is the name of the launcher (java,javac,jar...)
    # Parameter 2 is extra CFLAGS
    # Parameter 3 is extra LDFLAGS
    # Parameter 4 is extra LDFLAGS_SUFFIX_posix
    # Parameter 5 is extra LDFLAGS_SUFFIX_windows
    # Parameter 6 is optional Windows JLI library (full path)
    # Parameter 7 is optional Windows resource (RC) flags
    # Parameter 8 is optional Windows version resource file (.rc)
    # Parameter 9  is different output dir
    # Parameter 10 if set, link statically with c runtime on windows.
    # Parameter 11 if set, override plist file on macosx.

    $1_WINDOWS_JLI_LIB:=$(JDK_OUTPUTDIR)/objs/libjli/jli.lib
    ifneq ($6,)
        $1_WINDOWS_JLI_LIB:=$6
    endif
    $1_VERSION_INFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc
    ifneq ($8,)
        $1_VERSION_INFO_RESOURCE:=$8
    endif

    $1_LDFLAGS := $3
    $1_LDFLAGS_SUFFIX :=
    ifeq ($(OPENJDK_TARGET_OS), macosx)
        $1_PLIST_FILE:=Info-cmdline.plist
        ifneq ($(11),)
            $1_PLIST_FILE:=$(11)
98 99 100
            ifneq ($$(findstring privileged,$$($1_PLIST_FILE)),)
                $1_CODESIGN:=true
            endif
O
ohair 已提交
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
        endif

        $1_LDFLAGS += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
                      -framework Cocoa -framework Security -framework ApplicationServices \
                      -sectcreate __TEXT __info_plist $(JDK_TOPDIR)/src/macosx/lib/$$($1_PLIST_FILE)
        $1_LDFLAGS_SUFFIX += -pthread
    endif

    ifeq ($(USE_EXTERNAL_LIBZ), true)
        $1_LDFLAGS_SUFFIX += -lz
    endif

    $1_OUTPUT_DIR_ARG:=$9
    ifeq (,$$($1_OUTPUT_DIR_ARG))
        $1_OUTPUT_DIR_ARG:=$(JDK_OUTPUTDIR)/bin
    endif

    # TODO: maybe it's better to move this if-statement out of this function
    ifeq ($1,java)
        $1_OPTIMIZATION_ARG:=HIGH
	$1_LDFLAGS_solaris:=-R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR)
    else
        $1_OPTIMIZATION_ARG:=LOW
    endif

    $1_CFLAGS:=$(CFLAGS_JDKEXE)
    ifeq ($(10),true)
        $1_CFLAGS:=$(filter-out -MD,$(CFLAGS_JDKEXE))
    endif

    ifneq ($(wildcard $(JDK_TOPDIR)/makefiles/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)),)
        $1_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
    else
        $1_MAPFILE:=
    endif

    $(call SetupNativeCompilation,BUILD_LAUNCHER_$1,\
	SRC:=$(JDK_TOPDIR)/src/share/bin,\
	INCLUDE_FILES:=main.c,\
	LANG:=C,\
	OPTIMIZATION:=$$($1_OPTIMIZATION_ARG), \
	CFLAGS:=$$($1_CFLAGS) \
		-I$(JDK_TOPDIR)/src/share/bin \
		-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin \
		-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS)/bin \
                -DFULL_VERSION='"$(FULL_VERSION)"' \
                -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
                -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
		-DLIBARCHNAME='"$(OPENJDK_TARGET_CPU_LEGACY)"' \
		-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
		-DPROGNAME='"$1"' $(DPACKAGEPATH) \
		$2,\
	CFLAGS_linux:=-fPIC,\
        CFLAGS_solaris:=-KPIC -DHAVE_GETHRTIME,\
	LDFLAGS:=$(LDFLAGS_JDKEXE) \
                 $(ORIGIN_ARG) \
		 $$($1_LDFLAGS),\
	LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_NAME,$1),\
	LDFLAGS_linux:=-lpthread \
                       $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)),\
	LDFLAGS_solaris:=$$($1_LDFLAGS_solaris) \
                       $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)),\
	MAPFILE := $$($1_MAPFILE), \
        LDFLAGS_SUFFIX:=$(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX),\
	LDFLAGS_SUFFIX_posix:=$4,\
	LDFLAGS_SUFFIX_windows:=$$($1_WINDOWS_JLI_LIB) \
			       $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5,\
	LDFLAGS_SUFFIX_linux:=-L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
	LDFLAGS_SUFFIX_solaris:=-L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
	OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/$1_objs$(OUTPUT_SUBDIR),\
	OUTPUT_DIR:=$$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR),\
	PROGRAM:=$1,\
	DEBUG_SYMBOLS:=true,\
	VERSIONINFO_RESOURCE:=$$($1_VERSION_INFO_RESOURCE),\
	RC_FLAGS:=$(RC_FLAGS)\
		  -D "JDK_FNAME=$1$(EXE_SUFFIX)" \
		  -D "JDK_INTERNAL_NAME=$1" \
		  -D "JDK_FTYPE=0x1L" \
		  $7,\
180 181
	MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/java.manifest,\
	CODESIGN:=$$($1_CODESIGN))
O
ohair 已提交
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247

    BUILD_LAUNCHERS += $$(BUILD_LAUNCHER_$1)

    ifeq ($(OPENJDK_TARGET_OS),macosx)
        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjli_static.a
    endif

    ifeq ($(OPENJDK_TARGET_OS),windows)
        $$(BUILD_LAUNCHER_$1) : $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
				$$($1_WINDOWS_JLI_LIB)
    endif    	 
endef

##########################################################################################

XLIBS:=$(X_LIBS) -lX11
ifeq ($(OPENJDK_TARGET_OS),macosx)
    DPACKAGEPATH:=-DPACKAGE_PATH='"$(PACKAGE_PATH)"'
    XLIBS:=
endif

ifdef OPENJDK
    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
else
    JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
endif

# On windows, the debuginfo files get the same name as for java.dll. Build
# into another dir and copy selectively so debuginfo for java.dll isn't
# overwritten.
$(eval $(call SetupLauncher,java,\
    -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
    $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
    $(JDK_TOPDIR)/src/windows/resource/java.rc,$(JDK_OUTPUTDIR)/objs/java_objs,true))

$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@

BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)

ifeq ($(OPENJDK_TARGET_OS),windows)
    $(eval $(call SetupLauncher,javaw,\
        -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib,\
        $(JDK_OUTPUTDIR)/objs/jli_static.lib,$(JAVA_RC_FLAGS),\
        $(JDK_TOPDIR)/src/windows/resource/java.rc,,true))
endif


ifndef BUILD_HEADLESS_ONLY
$(eval $(call SetupLauncher,appletviewer,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',,\
    $(XLIBS)))
endif

$(eval $(call SetupLauncher,extcheck,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.extcheck.Main"$(COMMA) }'))

$(eval $(call SetupLauncher,idlj,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))

$(eval $(call SetupLauncher,jar,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))

$(eval $(call SetupLauncher,jarsigner,\
248
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
O
ohair 已提交
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276

$(eval $(call SetupLauncher,javac,\
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))

ifeq ($(ENABLE_SJAVAC),yes)
$(eval $(call SetupLauncher,sjavac,\
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }'))
endif

$(eval $(call SetupLauncher,javadoc,\
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))

$(eval $(call SetupLauncher,javah,\
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))

$(eval $(call SetupLauncher,javap,\
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))

277 278 279 280 281
$(eval $(call SetupLauncher,jdeps,\
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))

O
ohair 已提交
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
BUILD_LAUNCHER_jconsole_CFLAGS_windows:=-DJAVAW
BUILD_LAUNCHER_jconsole_LDFLAGS_windows:=user32.lib

$(eval $(call SetupLauncher,jconsole,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
    -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))

$(eval $(call SetupLauncher,jdb,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))

$(eval $(call SetupLauncher,jhat,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))

$(eval $(call SetupLauncher,jinfo,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
		   "sun.tools.jinfo.JInfo"$(COMMA) }' \
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

$(eval $(call SetupLauncher,jmap,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
		   "sun.tools.jmap.JMap"$(COMMA) }' \
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

$(eval $(call SetupLauncher,jps,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))

$(eval $(call SetupLauncher,jrunscript,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))

J
jjg 已提交
318 319 320
$(eval $(call SetupLauncher,jjs,\
    -DJAVA_ARGS='{  "-J-ms8m"$(COMMA) "jdk.nashorn.tools.Shell"$(COMMA) }'))

O
ohair 已提交
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
$(eval $(call SetupLauncher,jsadebugd,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

$(eval $(call SetupLauncher,jstack,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
		   "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
		   "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
		   "sun.tools.jstack.JStack"$(COMMA) }' \
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

$(eval $(call SetupLauncher,jstat,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))

$(eval $(call SetupLauncher,jstatd,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))

$(eval $(call SetupLauncher,keytool,\
K
Merge  
katleman 已提交
341
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.keytool.Main"$(COMMA) }'))
O
ohair 已提交
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478

$(eval $(call SetupLauncher,native2ascii,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))

ifndef BUILD_HEADLESS_ONLY
$(eval $(call SetupLauncher,policytool,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',,\
    $(XLIBS)))
endif

$(eval $(call SetupLauncher,rmic,\
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))

$(eval $(call SetupLauncher,schemagen,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))

$(eval $(call SetupLauncher,serialver,\
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))

$(eval $(call SetupLauncher,xjc,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))

$(eval $(call SetupLauncher,wsgen,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))

$(eval $(call SetupLauncher,wsimport,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))

$(eval $(call SetupLauncher,orbd,\
    -DJAVA_ARGS='{ 	"-J-ms8m"$(COMMA) \
			"-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
			"-J-Dcom.sun.CORBA.activation.Port=1049"$(COMMA) \
			"-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
			"com.sun.corba.se.impl.activation.ORBD"$(COMMA) }'))

$(eval $(call SetupLauncher,servertool,\
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))

$(eval $(call SetupLauncher,tnameserv,\
    -DJAVA_ARGS='{ 	"-J-ms8m"$(COMMA) \
			"-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \
			"-J-Djava.util.logging.LoggingPermission=contol"$(COMMA) \
			"-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
			"com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))

$(eval $(call SetupLauncher,pack200,\
    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) "--pack" }'))

$(eval $(call SetupLauncher,rmid,\
    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))

$(eval $(call SetupLauncher,rmiregistry,\
    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))

$(eval $(call SetupLauncher,jcmd,\
    -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))

ifeq ($(OPENJDK_TARGET_OS),windows)
    $(eval $(call SetupLauncher,kinit,\
        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))

    $(eval $(call SetupLauncher,klist,\
        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))

    $(eval $(call SetupLauncher,ktab,\
        -DJAVA_ARGS='{	"-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
endif

##########################################################################################
# The order of the object files on the link command line affects the size of the resulting
# binary (at least on linux) which causes the size to differ between old and new build.
ifeq ($(USE_EXTERNAL_LIBZ), true)
UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
UNPACKEXE_ZIPOBJS := -lz
else
UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
UNPACKEXE_ZIPOBJS := 	$(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
		     	$(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
			$(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
			$(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
			$(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
			$(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
			$(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
			$(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
			$(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
			$(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)

endif

ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
    UNPACKEXE_CFLAGS += -xregs=no%appl
    UNPACKEXE_LDFLAGS_solaris += -xmemalign=4s
endif

UNPACKEXE_LANG:=C
ifeq ($(OPENJDK_TARGET_OS),solaris)
    UNPACKEXE_LANG:=C++
endif
# On windows, unpack200 is linked completely differently to all other
# executables, using the compiler with the compiler arguments.
# It's also linked incrementally, producing a .ilk file that needs to 
# be kept away.
ifeq ($(OPENJDK_TARGET_OS),windows)
    BUILD_UNPACKEXE_LDEXE:=$(CC)
    EXE_OUT_OPTION_save:=$(EXE_OUT_OPTION)
    EXE_OUT_OPTION:=-Fe
endif
$(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE,\
                SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack,\
		EXCLUDE_FILES:=jni.cpp,\
		LANG:=$(UNPACKEXE_LANG),\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE)\
                        -DFULL, \
		CFLAGS_release:=-DPRODUCT,\
		CFLAGS_linux:=-fPIC,\
		CFLAGS_solaris:=-KPIC, \
		CFLAGS_macosx:=-fPIC, \
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers-unpack200,\
		LDFLAGS:=$(UNPACKEXE_ZIPOBJS),\
		LDFLAGS_windows:=$(CXXFLAGS_JDKEXE),\
		LDFLAGS_posix:=$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
			 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
		LDFLAGS_linux:=-lc,\
		LDFLAGS_solaris:=$(UNPACKEXE_LDFLAGS_solaris) -lc,\
		LDFLAGS_SUFFIX:=$(LIBCXX),\
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR),\
		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR),\
		PROGRAM:=unpack200,\
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
			  -D "JDK_FNAME=unpack200.exe" \
			  -D "JDK_INTERNAL_NAME=unpack200" \
			  -D "JDK_FTYPE=0x1L",\
479
	        DEBUG_SYMBOLS:=true,\
O
ohair 已提交
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
		MANIFEST:=$(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))

ifeq ($(OPENJDK_TARGET_OS),windows)
    EXE_OUT_OPTION:=$(EXE_OUT_OPTION_save)
endif

ifneq ($(USE_EXTERNAL_LIBZ), true)

$(BUILD_UNPACKEXE) : $(UNPACKEXE_ZIPOBJS)

endif

# Build into object dir and copy executable afterwards to avoid .ilk file in
# image. The real fix would be clean up linking of unpack200 using 
# -link -incremental:no
# like all other launchers.
$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
497
	$(call install-file)
O
ohair 已提交
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562

BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX)

##########################################################################################


BUILD_JEXEC := 
BUILD_JEXEC_SRC :=
BUILD_JEXEC_INC :=
BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)

#
# UNHANDLED:
# - COMPILE_APPROACH = normal
#

#
# jdk/make/java/Makefile
#
ifeq ($(OPENJDK_TARGET_OS), solaris)
	ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
		BUILD_JEXEC := 1
	endif
endif

ifeq ($(OPENJDK_TARGET_OS), linux)
	BUILD_JEXEC := 1
endif # OPENJDK_TARGET_OS

#
# jdk/make/java/jexec/Makefile
#
ifeq ($(BUILD_JEXEC), 1)

	ifeq ($(OPENJDK_TARGET_OS),windows)
	else ifeq ($(OPENJDK_TARGET_OS),macosx)
		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/macosx/bin
	else
		BUILD_JEXEC_SRC := $(JDK_TOPDIR)/src/solaris/bin
	endif

	ifeq ($(OPENJDK_TARGET_OS), linux)
                BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
		BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/share/bin
	endif
endif

#
# Note that the two Makefile's seems to contradict each other,
#   and that src/macosx/bin/jexec.c seems unused
#
ifneq ($(BUILD_JEXEC_SRC),)
        $(eval $(call SetupNativeCompilation,BUILD_JEXEC,\
		SRC:=$(BUILD_JEXEC_SRC),\
		INCLUDE_FILES:=jexec.c,\
		LANG:=C,\
		OPTIMIZATION := LOW, \
		CFLAGS:=$(CFLAGS_JDKEXE)\
                        $(BUILD_JEXEC_INC), \
		CFLAGS_linux:=-fPIC,\
		CFLAGS_solaris:=-KPIC,\
		LDFLAGS:=$(LDFLAGS_JDKEXE) \
			 $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jexec_obj,\
		OUTPUT_DIR:=$(BUILD_JEXEC_DST_DIR),\
563
		DEBUG_SYMBOLS:=true,\
O
ohair 已提交
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595
		PROGRAM:=jexec))

	BUILD_LAUNCHERS += $(BUILD_JEXEC)
endif

##########################################################################################

#
# The java-rmi.cgi script in bin/ only gets delivered in certain situations
#
JAVA_RMI_CGI:=$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
ifeq ($(OPENJDK_TARGET_OS), linux)
  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
    BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
  endif
endif

# TODO: 
# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all
# this time anyway. Since jdk6, it has been built from the wrong source and resulted
# in a (almost) copy of the standard java launcher named "java-rmi.exe" ending up in 
# the final images bin dir. This weird behavior is mimicked here in the converted 
# makefiles for now. Should probably just be deleted.
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
ifeq ($(OPENJDK_TARGET_OS),windows)
    $(eval $(call SetupLauncher,java-rmi,,\
        $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/makefiles/java/main/java/mapfile-$(OPENJDK_TARGET_CPU))))
else
    $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
596
	$(call install-file)
O
ohair 已提交
597 598 599
	$(CHMOD) a+x $@
endif

600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627
##########################################################################################
# jabswitch

ifndef OPENJDK
ifeq ($(OPENJDK_TARGET_OS),windows)

    $(eval $(call SetupNativeCompilation,BUILD_JABSWITCH,\
		SRC:=$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge,\
		INCLUDE_FILES:=jabswitch.cpp,\
		LANG:=C++,\
		CFLAGS:=$(filter-out -Zc:wchar_t-,$(CFLAGS_JDKEXE)) -Zc:wchar_t \
			-analyze- -Od -Gd -D_WINDOWS \
			-D_UNICODE -DUNICODE -RTC1 -EHsc,\
		LDFLAGS:=$(LDFLAGS_JDKEXE) \
			 Advapi32.lib Version.lib User32.lib,\
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/jabswitch,\
		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/bin,\
		PROGRAM:=jabswitch,\
		DEBUG_SYMBOLS:=true,\
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/AccessBridgeStatusWindow.rc,\
		RC_FLAGS:=$(RC_FLAGS),\
		MANIFEST:=$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/jabswitch.manifest))

    BUILD_LAUNCHERS += $(BUILD_JABSWITCH)

endif
endif

O
ohair 已提交
628 629 630 631 632 633 634
##########################################################################################

$(BUILD_LAUNCHERS) : $(JDK_TOPDIR)/makefiles/CompileLaunchers.gmk

all: $(BUILD_LAUNCHERS)

.PHONY: all