CompileLaunchers.gmk 24.3 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
#
# 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.
#

26
default: all
O
ohair 已提交
27 28 29 30 31 32 33 34

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

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

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

O
ohair 已提交
38 39 40
# Build tools
include Tools.gmk

41
BUILD_LAUNCHERS =
O
ohair 已提交
42

43
# When building a legacy overlay image (on solaris 64 bit), the launchers
O
ohair 已提交
44
# need to be built with a different rpath and a different output dir.
45 46 47
ifeq ($(OVERLAY_IMAGES), true)
  ORIGIN_ROOT := /../..
  OUTPUT_SUBDIR := $(OPENJDK_TARGET_CPU_ISADIR)
O
ohair 已提交
48
else
49
  ORIGIN_ROOT := /..
O
ohair 已提交
50 51 52
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
53
  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
O
ohair 已提交
54
else
L
Merge  
lana 已提交
55
  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli)
O
ohair 已提交
56 57 58 59 60 61 62
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.
#
63
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
L
Merge  
lana 已提交
64
  ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR))
O
ohair 已提交
65 66 67
endif

define SetupLauncher
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 98
  # 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)
      ifneq ($$(findstring privileged, $$($1_PLIST_FILE)), )
        $1_CODESIGN := true
      endif
O
ohair 已提交
99 100
    endif

101 102 103
    $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)
O
ohair 已提交
104
        $1_LDFLAGS_SUFFIX += -pthread
105
  endif
O
ohair 已提交
106

107 108 109
  ifeq ($(USE_EXTERNAL_LIBZ), true)
    $1_LDFLAGS_SUFFIX += -lz
  endif
O
ohair 已提交
110

111 112 113 114
  $1_OUTPUT_DIR_ARG := $9
  ifeq (, $$($1_OUTPUT_DIR_ARG))
    $1_OUTPUT_DIR_ARG := $(JDK_OUTPUTDIR)/bin
  endif
O
ohair 已提交
115

116 117 118 119 120 121 122
  # 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
O
ohair 已提交
123

124 125 126 127
  $1_CFLAGS := $(CFLAGS_JDKEXE)
  ifeq ($(10), true)
    $1_CFLAGS := $(filter-out -MD, $(CFLAGS_JDKEXE))
  endif
O
ohair 已提交
128

129 130 131 132 133
  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
O
ohair 已提交
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 180 181 182 183 184 185
  $(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, \
      MANIFEST := $(JDK_TOPDIR)/src/windows/resource/java.manifest, \
      CODESIGN := $$($1_CODESIGN))

  BUILD_LAUNCHERS += $$(BUILD_LAUNCHER_$1)

  ifeq ($(OPENJDK_TARGET_OS), macosx)
    $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjli_static.a
  endif
O
ohair 已提交
186

187 188 189 190
  ifeq ($(OPENJDK_TARGET_OS), windows)
    $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
        $$($1_WINDOWS_JLI_LIB)
  endif
O
ohair 已提交
191 192 193 194
endef

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

195 196 197 198
XLIBS := $(X_LIBS) -lX11
ifeq ($(OPENJDK_TARGET_OS), macosx)
  DPACKAGEPATH := -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
  XLIBS :=
O
ohair 已提交
199 200 201
endif

ifdef OPENJDK
202
  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
O
ohair 已提交
203
else
204
  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
O
ohair 已提交
205 206 207 208 209
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.
210 211 212 213
$(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))
O
ohair 已提交
214 215 216 217 218 219 220 221

$(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)

222 223 224 225 226
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))
O
ohair 已提交
227 228 229 230
endif


ifndef BUILD_HEADLESS_ONLY
231 232 233
  $(eval $(call SetupLauncher,appletviewer, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',, \
      $(XLIBS)))
O
ohair 已提交
234 235
endif

236
$(eval $(call SetupLauncher,extcheck, \
O
ohair 已提交
237 238
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.extcheck.Main"$(COMMA) }'))

239
$(eval $(call SetupLauncher,idlj, \
O
ohair 已提交
240 241
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }'))

242
$(eval $(call SetupLauncher,jar, \
O
ohair 已提交
243 244
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))

245
$(eval $(call SetupLauncher,jarsigner, \
246
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
O
ohair 已提交
247

248
$(eval $(call SetupLauncher,javac, \
O
ohair 已提交
249 250 251 252
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))

253 254 255 256 257
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) }'))
O
ohair 已提交
258 259
endif

260
$(eval $(call SetupLauncher,javadoc, \
O
ohair 已提交
261 262 263 264
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))

265
$(eval $(call SetupLauncher,javah, \
O
ohair 已提交
266 267 268 269
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))

270
$(eval $(call SetupLauncher,javap, \
O
ohair 已提交
271 272 273 274
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))

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

280 281
BUILD_LAUNCHER_jconsole_CFLAGS_windows := -DJAVAW
BUILD_LAUNCHER_jconsole_LDFLAGS_windows := user32.lib
O
ohair 已提交
282

283
$(eval $(call SetupLauncher,jconsole, \
O
ohair 已提交
284 285 286
    -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" }'))

287
$(eval $(call SetupLauncher,jdb, \
O
ohair 已提交
288 289 290
    -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" }'))

291
$(eval $(call SetupLauncher,jhat, \
O
ohair 已提交
292 293
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))

294
$(eval $(call SetupLauncher,jinfo, \
O
ohair 已提交
295
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
296 297 298
        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
        "sun.tools.jinfo.JInfo"$(COMMA) }' \
O
ohair 已提交
299 300 301
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

302
$(eval $(call SetupLauncher,jmap, \
O
ohair 已提交
303
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
304 305 306
        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
        "sun.tools.jmap.JMap"$(COMMA) }' \
O
ohair 已提交
307 308 309
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

310
$(eval $(call SetupLauncher,jps, \
O
ohair 已提交
311 312
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }'))

313
$(eval $(call SetupLauncher,jrunscript, \
O
ohair 已提交
314 315
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))

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

319
$(eval $(call SetupLauncher,jsadebugd, \
O
ohair 已提交
320 321 322 323
    -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))

324
$(eval $(call SetupLauncher,jstack, \
O
ohair 已提交
325
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
326 327 328
        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
        "sun.tools.jstack.JStack"$(COMMA) }' \
O
ohair 已提交
329 330 331
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

332
$(eval $(call SetupLauncher,jstat, \
O
ohair 已提交
333 334
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }'))

335
$(eval $(call SetupLauncher,jstatd, \
O
ohair 已提交
336 337
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))

338
$(eval $(call SetupLauncher,keytool, \
K
Merge  
katleman 已提交
339
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.keytool.Main"$(COMMA) }'))
O
ohair 已提交
340

341
$(eval $(call SetupLauncher,native2ascii, \
O
ohair 已提交
342 343 344
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))

ifndef BUILD_HEADLESS_ONLY
345 346 347
  $(eval $(call SetupLauncher,policytool, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
      $(XLIBS)))
O
ohair 已提交
348 349
endif

350
$(eval $(call SetupLauncher,rmic, \
O
ohair 已提交
351 352 353
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))

354
$(eval $(call SetupLauncher,schemagen, \
O
ohair 已提交
355 356
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }'))

357
$(eval $(call SetupLauncher,serialver, \
O
ohair 已提交
358 359 360
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))

361
$(eval $(call SetupLauncher,xjc, \
O
ohair 已提交
362 363
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))

364
$(eval $(call SetupLauncher,wsgen, \
O
ohair 已提交
365 366
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }'))

367
$(eval $(call SetupLauncher,wsimport, \
O
ohair 已提交
368 369
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))

370 371 372 373 374 375
$(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) }'))
O
ohair 已提交
376

377
$(eval $(call SetupLauncher,servertool, \
O
ohair 已提交
378 379
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }'))

380 381 382 383 384 385
$(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) }'))
O
ohair 已提交
386

387 388
$(eval $(call SetupLauncher,pack200, \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) "--pack" }'))
O
ohair 已提交
389

390 391
$(eval $(call SetupLauncher,rmid, \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }'))
O
ohair 已提交
392

393 394
$(eval $(call SetupLauncher,rmiregistry, \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }'))
O
ohair 已提交
395

396 397
$(eval $(call SetupLauncher,jcmd, \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
O
ohair 已提交
398

399 400 401
ifeq ($(OPENJDK_TARGET_OS), windows)
  $(eval $(call SetupLauncher,kinit, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }'))
O
ohair 已提交
402

403 404
  $(eval $(call SetupLauncher,klist, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }'))
O
ohair 已提交
405

406 407
  $(eval $(call SetupLauncher,ktab, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
O
ohair 已提交
408 409 410 411 412 413
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)
414 415
  UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
  UNPACKEXE_ZIPOBJS := -lz
O
ohair 已提交
416
else
417 418 419 420 421 422 423 424 425 426 427
  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)
O
ohair 已提交
428 429 430 431

endif

ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
432 433
  UNPACKEXE_CFLAGS += -xregs=no%appl
  UNPACKEXE_LDFLAGS_solaris += -xmemalign=4s
O
ohair 已提交
434 435
endif

436 437 438
UNPACKEXE_LANG := C
ifeq ($(OPENJDK_TARGET_OS), solaris)
  UNPACKEXE_LANG := C++
O
ohair 已提交
439 440 441
endif
# On windows, unpack200 is linked completely differently to all other
# executables, using the compiler with the compiler arguments.
442
# It's also linked incrementally, producing a .ilk file that needs to
O
ohair 已提交
443
# be kept away.
444 445 446 447
ifeq ($(OPENJDK_TARGET_OS), windows)
  BUILD_UNPACKEXE_LDEXE := $(CC)
  EXE_OUT_OPTION_save := $(EXE_OUT_OPTION)
  EXE_OUT_OPTION := -Fe
O
ohair 已提交
448
endif
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 479 480 481
$(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", \
    DEBUG_SYMBOLS := true, \
    MANIFEST := $(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))

ifeq ($(OPENJDK_TARGET_OS), windows)
  EXE_OUT_OPTION := $(EXE_OUT_OPTION_save)
O
ohair 已提交
482 483 484 485
endif

ifneq ($(USE_EXTERNAL_LIBZ), true)

486
  $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
O
ohair 已提交
487 488 489 490

endif

# Build into object dir and copy executable afterwards to avoid .ilk file in
491
# image. The real fix would be clean up linking of unpack200 using
O
ohair 已提交
492 493 494
# -link -incremental:no
# like all other launchers.
$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
495
	$(call install-file)
O
ohair 已提交
496 497 498 499 500 501

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

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


502
BUILD_JEXEC :=
O
ohair 已提交
503 504 505 506 507 508 509 510 511 512 513 514 515
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)
516 517 518
  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
    BUILD_JEXEC := 1
  endif
O
ohair 已提交
519 520 521
endif

ifeq ($(OPENJDK_TARGET_OS), linux)
522
  BUILD_JEXEC := 1
O
ohair 已提交
523 524 525 526 527 528 529
endif # OPENJDK_TARGET_OS

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

530 531 532 533 534 535 536 537 538 539 540
  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
O
ohair 已提交
541 542 543 544
endif

#
# Note that the two Makefile's seems to contradict each other,
545
# and that src/macosx/bin/jexec.c seems unused
O
ohair 已提交
546
#
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
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), \
      DEBUG_SYMBOLS := true, \
      PROGRAM := jexec))

  BUILD_LAUNCHERS += $(BUILD_JEXEC)
O
ohair 已提交
565 566 567 568 569 570 571
endif

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

#
# The java-rmi.cgi script in bin/ only gets delivered in certain situations
#
572
JAVA_RMI_CGI := $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
O
ohair 已提交
573 574 575 576
ifeq ($(OPENJDK_TARGET_OS), linux)
  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
C
cl 已提交
577
  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
O
ohair 已提交
578 579
endif

580
# TODO:
O
ohair 已提交
581 582
# 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
583 584
# 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
O
ohair 已提交
585 586
# makefiles for now. Should probably just be deleted.
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
587 588 589
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))))
O
ohair 已提交
590
else
591
  $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
592
	$(call install-file)
O
ohair 已提交
593 594 595
	$(CHMOD) a+x $@
endif

596 597 598 599 600 601 602 603
##########################################################################################

BUILD_JSPAWNHELPER :=
BUILD_JSPAWNHELPER_SRC := $(JDK_TOPDIR)/src/solaris/native/java/lang
BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
LINK_JSPAWNHELPER_OBJECTS := $(JDK_OUTPUTDIR)/objs/libjava/childproc.o
LINK_JSPAWNHELPER_FLAGS :=

604 605
ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris), )
  BUILD_JSPAWNHELPER := 1
606 607 608
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
609
  BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib
610 611 612
endif

ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
613
  LINK_JSPAWNHELPER_FLAGS += -m64
614 615 616
endif

ifeq ($(BUILD_JSPAWNHELPER), 1)
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
  $(eval $(call SetupNativeCompilation,BUILD_JSPAWNHELPER, \
      SRC := $(BUILD_JSPAWNHELPER_SRC), \
      INCLUDE_FILES := jspawnhelper.c, \
      LANG := C, \
      OPTIMIZATION := LOW, \
      CFLAGS := $(CFLAGS_JDKEXE), \
      LDFLAGS := $(LDFLAGS_JDKEXE) $(LINK_JSPAWNHELPER_FLAGS), \
      LDFLAGS_SUFFIX := $(LINK_JSPAWNHELPER_OBJECTS), \
      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jspawnhelper, \
      OUTPUT_DIR := $(BUILD_JSPAWNHELPER_DST_DIR), \
      PROGRAM := jspawnhelper))

  $(BUILD_JSPAWNHELPER): $(LINK_JSPAWNHELPER_OBJECTS)

  BUILD_LAUNCHERS += $(BUILD_JSPAWNHELPER)
632 633
endif

634 635 636 637
##########################################################################################
# jabswitch

ifndef OPENJDK
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655
  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))
656 657 658

    BUILD_LAUNCHERS += $(BUILD_JABSWITCH)

659
  endif
660 661
endif

O
ohair 已提交
662 663
##########################################################################################

664
$(BUILD_LAUNCHERS): $(JDK_TOPDIR)/makefiles/CompileLaunchers.gmk
O
ohair 已提交
665 666 667 668

all: $(BUILD_LAUNCHERS)

.PHONY: all