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