CompileLaunchers.gmk 25.3 KB
Newer Older
O
ohair 已提交
1
#
2
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
O
ohair 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# 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

K
Merge  
kvn 已提交
107 108 109
  ifeq ($(OPENJDK_TARGET_OS), aix)
    $1_LDFLAGS_SUFFIX += -L$(JDK_OUTPUTDIR)/objs -ljli_static
  endif
110

111 112 113
  ifeq ($(USE_EXTERNAL_LIBZ), true)
    $1_LDFLAGS_SUFFIX += -lz
  endif
O
ohair 已提交
114

115 116 117 118
  $1_OUTPUT_DIR_ARG := $9
  ifeq (, $$($1_OUTPUT_DIR_ARG))
    $1_OUTPUT_DIR_ARG := $(JDK_OUTPUTDIR)/bin
  endif
O
ohair 已提交
119

120 121 122 123 124 125 126
  # 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 已提交
127

128 129 130 131
  $1_CFLAGS := $(CFLAGS_JDKEXE)
  ifeq ($(10), true)
    $1_CFLAGS := $(filter-out -MD, $(CFLAGS_JDKEXE))
  endif
O
ohair 已提交
132

K
Merge  
kvn 已提交
133 134 135 136
  # The linker on older SuSE distros (e.g. on SLES 10) complains with:
  # "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
  # if feeded with a version script which contains named tags.
  ifeq ($(USING_BROKEN_SUSE_LD),yes)
K
Merge  
kvn 已提交
137 138
    ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), )
      $1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous
O
ohair 已提交
139
    else
K
Merge  
kvn 已提交
140
      $1_MAPFILE :=
O
ohair 已提交
141
    endif
142
  else
K
Merge  
kvn 已提交
143 144
    ifneq ($(wildcard $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), )
      $1_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
K
Merge  
kvn 已提交
145 146
    else
      $1_MAPFILE :=
O
ohair 已提交
147
    endif
148
  endif
O
ohair 已提交
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 186 187 188 189 190 191 192 193 194 195 196 197
  $(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)

K
Merge  
kvn 已提交
198
  ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
199 200
    $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjli_static.a
  endif
O
ohair 已提交
201

202 203 204 205
  ifeq ($(OPENJDK_TARGET_OS), windows)
    $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
        $$($1_WINDOWS_JLI_LIB)
  endif
O
ohair 已提交
206 207 208 209
endef

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

210 211 212 213
XLIBS := $(X_LIBS) -lX11
ifeq ($(OPENJDK_TARGET_OS), macosx)
  DPACKAGEPATH := -DPACKAGE_PATH='"$(PACKAGE_PATH)"'
  XLIBS :=
O
ohair 已提交
214 215 216
endif

ifdef OPENJDK
217
  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/windows/resource/icons"
O
ohair 已提交
218
else
219
  JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
O
ohair 已提交
220 221 222 223 224
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.
225 226 227 228
$(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 已提交
229 230 231 232 233 234 235 236

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

237 238 239 240 241
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 已提交
242 243 244 245
endif


ifndef BUILD_HEADLESS_ONLY
246 247 248
  $(eval $(call SetupLauncher,appletviewer, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',, \
      $(XLIBS)))
O
ohair 已提交
249 250
endif

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

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

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

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

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

268 269 270 271 272
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 已提交
273 274
endif

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

280
$(eval $(call SetupLauncher,javah, \
O
ohair 已提交
281 282 283 284
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))

285
$(eval $(call SetupLauncher,javap, \
O
ohair 已提交
286 287 288 289
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))

290
$(eval $(call SetupLauncher,jdeps, \
291 292 293 294
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))

295 296
BUILD_LAUNCHER_jconsole_CFLAGS_windows := -DJAVAW
BUILD_LAUNCHER_jconsole_LDFLAGS_windows := user32.lib
O
ohair 已提交
297

298
$(eval $(call SetupLauncher,jconsole, \
O
ohair 已提交
299 300 301
    -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" }'))

302
$(eval $(call SetupLauncher,jdb, \
O
ohair 已提交
303 304 305
    -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" }'))

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

309
$(eval $(call SetupLauncher,jinfo, \
O
ohair 已提交
310
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
311 312 313
        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
        "sun.tools.jinfo.JInfo"$(COMMA) }' \
O
ohair 已提交
314 315 316
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

317
$(eval $(call SetupLauncher,jmap, \
O
ohair 已提交
318
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
319 320 321
        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
        "sun.tools.jmap.JMap"$(COMMA) }' \
O
ohair 已提交
322 323 324
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

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

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

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

334
$(eval $(call SetupLauncher,jsadebugd, \
O
ohair 已提交
335 336 337 338
    -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))

339
$(eval $(call SetupLauncher,jstack, \
O
ohair 已提交
340
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
341 342 343
        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
        "sun.tools.jstack.JStack"$(COMMA) }' \
O
ohair 已提交
344 345 346
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

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

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

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

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

ifndef BUILD_HEADLESS_ONLY
360 361 362
  $(eval $(call SetupLauncher,policytool, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
      $(XLIBS)))
O
ohair 已提交
363 364
endif

365
$(eval $(call SetupLauncher,rmic, \
O
ohair 已提交
366 367 368
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))

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

372
$(eval $(call SetupLauncher,serialver, \
O
ohair 已提交
373 374 375
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))

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

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

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

385 386 387 388 389 390
$(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 已提交
391

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

395 396 397 398 399 400
$(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 已提交
401

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

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

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

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

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

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

421 422
  $(eval $(call SetupLauncher,ktab, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
O
ohair 已提交
423 424 425 426 427 428
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)
429 430
  UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
  UNPACKEXE_ZIPOBJS := -lz
O
ohair 已提交
431
else
C
coffeys 已提交
432
  UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
433 434 435 436 437 438 439 440 441 442
  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 已提交
443 444 445

endif

446 447 448
UNPACKEXE_LANG := C
ifeq ($(OPENJDK_TARGET_OS), solaris)
  UNPACKEXE_LANG := C++
O
ohair 已提交
449 450 451
endif
# On windows, unpack200 is linked completely differently to all other
# executables, using the compiler with the compiler arguments.
452
# It's also linked incrementally, producing a .ilk file that needs to
O
ohair 已提交
453
# be kept away.
454 455 456 457
ifeq ($(OPENJDK_TARGET_OS), windows)
  BUILD_UNPACKEXE_LDEXE := $(CC)
  EXE_OUT_OPTION_save := $(EXE_OUT_OPTION)
  EXE_OUT_OPTION := -Fe
O
ohair 已提交
458
endif
459 460 461 462

# The linker on older SuSE distros (e.g. on SLES 10) complains with:
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
# if feeded with a version script which contains named tags.
K
Merge  
kvn 已提交
463
ifeq ($(USING_BROKEN_SUSE_LD), yes)
K
Merge  
kvn 已提交
464
  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200.anonymous
465
else
K
Merge  
kvn 已提交
466
  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200
467 468
endif

469 470 471 472 473 474 475 476 477 478 479
$(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, \
K
Merge  
kvn 已提交
480
    MAPFILE := $(UNPACK_MAPFILE),\
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
    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 已提交
502 503 504 505
endif

ifneq ($(USE_EXTERNAL_LIBZ), true)

506
  $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
O
ohair 已提交
507 508 509 510

endif

# Build into object dir and copy executable afterwards to avoid .ilk file in
511
# image. The real fix would be clean up linking of unpack200 using
O
ohair 已提交
512 513 514
# -link -incremental:no
# like all other launchers.
$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
515
	$(call install-file)
O
ohair 已提交
516 517 518 519 520 521

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

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


522
BUILD_JEXEC :=
O
ohair 已提交
523 524 525 526 527 528 529 530 531 532 533 534 535
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)
536 537 538
  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
    BUILD_JEXEC := 1
  endif
O
ohair 已提交
539 540 541
endif

ifeq ($(OPENJDK_TARGET_OS), linux)
542
  BUILD_JEXEC := 1
O
ohair 已提交
543 544 545 546 547 548 549
endif # OPENJDK_TARGET_OS

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

550 551 552 553 554 555 556 557 558 559 560
  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 已提交
561 562 563 564
endif

#
# Note that the two Makefile's seems to contradict each other,
565
# and that src/macosx/bin/jexec.c seems unused
O
ohair 已提交
566
#
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
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 已提交
585 586 587 588 589 590 591
endif

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

#
# The java-rmi.cgi script in bin/ only gets delivered in certain situations
#
592
JAVA_RMI_CGI := $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
O
ohair 已提交
593 594 595 596
ifeq ($(OPENJDK_TARGET_OS), linux)
  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
C
cl 已提交
597
  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
O
ohair 已提交
598 599
endif

600
# TODO:
O
ohair 已提交
601 602
# 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
603 604
# 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 已提交
605 606
# makefiles for now. Should probably just be deleted.
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
607 608
ifeq ($(OPENJDK_TARGET_OS), windows)
  $(eval $(call SetupLauncher,java-rmi, , \
I
ihse 已提交
609
      $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/make/java/main/java/mapfile-$(OPENJDK_TARGET_CPU))))
O
ohair 已提交
610
else
611
  $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
612
	$(call install-file)
O
ohair 已提交
613 614 615
	$(CHMOD) a+x $@
endif

616 617 618 619 620 621 622 623
##########################################################################################

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 :=

624
ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
625
  BUILD_JSPAWNHELPER := 1
626 627 628
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
629
  BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib
630 631 632
endif

ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
633
  LINK_JSPAWNHELPER_FLAGS += $(COMPILER_TARGET_BITS_FLAG)64
634 635 636
endif

ifeq ($(BUILD_JSPAWNHELPER), 1)
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
  $(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)
652 653
endif

654 655 656
##########################################################################################
# jabswitch

657 658 659
  ifeq ($(OPENJDK_TARGET_OS), windows)

    $(eval $(call SetupNativeCompilation,BUILD_JABSWITCH, \
660
      SRC := $(JDK_TOPDIR)/src/windows/native/sun/bridge, \
661 662 663 664 665 666 667 668 669 670 671
        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, \
672
      VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/native/sun/bridge/AccessBridgeStatusWindow.rc, \
673 674 675 676
        RC_FLAGS := $(RC_FLAGS) \
            -D "JDK_FNAME=jabswitch.exe" \
            -D "JDK_INTERNAL_NAME=jabswitch" \
            -D "JDK_FTYPE=0x01L", \
677
      MANIFEST := $(JDK_TOPDIR)/src/windows/native/sun/bridge/jabswitch.manifest))
678 679 680

    BUILD_LAUNCHERS += $(BUILD_JABSWITCH)

681
  endif
682

O
ohair 已提交
683 684
##########################################################################################

I
ihse 已提交
685
$(BUILD_LAUNCHERS): $(JDK_TOPDIR)/make/CompileLaunchers.gmk
O
ohair 已提交
686 687 688 689

all: $(BUILD_LAUNCHERS)

.PHONY: all