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