CompileLaunchers.gmk 25.8 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 340 341 342 343 344 345 346 347 348
$(eval $(call SetupLauncher,hsdb, \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.HSDB"$(COMMA) }' \
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

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

349
$(eval $(call SetupLauncher,jstack, \
O
ohair 已提交
350
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \
351 352 353
        "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \
        "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \
        "sun.tools.jstack.JStack"$(COMMA) }' \
O
ohair 已提交
354 355 356
    -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
    ,,,,,,,,,Info-privileged.plist))

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

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

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

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

ifndef BUILD_HEADLESS_ONLY
370 371 372
  $(eval $(call SetupLauncher,policytool, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
      $(XLIBS)))
O
ohair 已提交
373 374
endif

375
$(eval $(call SetupLauncher,rmic, \
O
ohair 已提交
376 377 378
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))

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

382
$(eval $(call SetupLauncher,serialver, \
O
ohair 已提交
383 384 385
    -DEXPAND_CLASSPATH_WILDCARDS \
    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))

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

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

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

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

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

405 406 407 408 409 410
$(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 已提交
411

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

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

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

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

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

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

431 432
  $(eval $(call SetupLauncher,ktab, \
      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
O
ohair 已提交
433 434 435 436 437 438
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)
439 440
  UNPACKEXE_CFLAGS := -DSYSTEM_ZLIB
  UNPACKEXE_ZIPOBJS := -lz
O
ohair 已提交
441
else
C
coffeys 已提交
442
  UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
443 444 445 446 447 448 449 450 451 452
  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 已提交
453 454 455

endif

456 457 458
UNPACKEXE_LANG := C
ifeq ($(OPENJDK_TARGET_OS), solaris)
  UNPACKEXE_LANG := C++
O
ohair 已提交
459 460 461
endif
# On windows, unpack200 is linked completely differently to all other
# executables, using the compiler with the compiler arguments.
462
# It's also linked incrementally, producing a .ilk file that needs to
O
ohair 已提交
463
# be kept away.
464 465 466 467
ifeq ($(OPENJDK_TARGET_OS), windows)
  BUILD_UNPACKEXE_LDEXE := $(CC)
  EXE_OUT_OPTION_save := $(EXE_OUT_OPTION)
  EXE_OUT_OPTION := -Fe
O
ohair 已提交
468
endif
469 470 471 472

# 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 已提交
473
ifeq ($(USING_BROKEN_SUSE_LD), yes)
K
Merge  
kvn 已提交
474
  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200.anonymous
475
else
K
Merge  
kvn 已提交
476
  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200
477 478
endif

479 480 481 482 483 484 485 486 487 488 489
$(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 已提交
490
    MAPFILE := $(UNPACK_MAPFILE),\
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
    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 已提交
512 513 514 515
endif

ifneq ($(USE_EXTERNAL_LIBZ), true)

516
  $(BUILD_UNPACKEXE): $(UNPACKEXE_ZIPOBJS)
O
ohair 已提交
517 518 519 520

endif

# Build into object dir and copy executable afterwards to avoid .ilk file in
521
# image. The real fix would be clean up linking of unpack200 using
O
ohair 已提交
522 523 524
# -link -incremental:no
# like all other launchers.
$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
525
	$(call install-file)
O
ohair 已提交
526 527 528 529 530 531

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

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


532
BUILD_JEXEC :=
O
ohair 已提交
533 534 535 536 537 538 539 540 541 542 543 544 545
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)
546 547 548
  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
    BUILD_JEXEC := 1
  endif
O
ohair 已提交
549 550 551
endif

ifeq ($(OPENJDK_TARGET_OS), linux)
552
  BUILD_JEXEC := 1
O
ohair 已提交
553 554 555 556 557 558 559
endif # OPENJDK_TARGET_OS

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

560 561 562 563 564 565 566 567 568 569 570
  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 已提交
571 572 573 574
endif

#
# Note that the two Makefile's seems to contradict each other,
575
# and that src/macosx/bin/jexec.c seems unused
O
ohair 已提交
576
#
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
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 已提交
595 596 597 598 599 600 601
endif

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

#
# The java-rmi.cgi script in bin/ only gets delivered in certain situations
#
602
JAVA_RMI_CGI := $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
O
ohair 已提交
603 604 605 606
ifeq ($(OPENJDK_TARGET_OS), linux)
  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
C
cl 已提交
607
  BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
O
ohair 已提交
608 609
endif

610
# TODO:
O
ohair 已提交
611 612
# 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
613 614
# 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 已提交
615 616
# makefiles for now. Should probably just be deleted.
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052
617 618
ifeq ($(OPENJDK_TARGET_OS), windows)
  $(eval $(call SetupLauncher,java-rmi, , \
I
ihse 已提交
619
      $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/make/java/main/java/mapfile-$(OPENJDK_TARGET_CPU))))
O
ohair 已提交
620
else
621
  $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/solaris/bin/java-rmi.cgi.sh
622
	$(call install-file)
O
ohair 已提交
623 624 625
	$(CHMOD) a+x $@
endif

626 627 628 629 630 631 632 633
##########################################################################################

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

634
ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
635
  BUILD_JSPAWNHELPER := 1
636 637 638
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
639
  BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib
640 641 642
endif

ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
643
  LINK_JSPAWNHELPER_FLAGS += $(COMPILER_TARGET_BITS_FLAG)64
644 645 646
endif

ifeq ($(BUILD_JSPAWNHELPER), 1)
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
  $(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)
662 663
endif

664 665 666
##########################################################################################
# jabswitch

667 668 669
  ifeq ($(OPENJDK_TARGET_OS), windows)

    $(eval $(call SetupNativeCompilation,BUILD_JABSWITCH, \
670
      SRC := $(JDK_TOPDIR)/src/windows/native/sun/bridge, \
671 672 673 674 675 676 677 678 679 680 681
        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, \
682
      VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/native/sun/bridge/AccessBridgeStatusWindow.rc, \
683 684 685 686
        RC_FLAGS := $(RC_FLAGS) \
            -D "JDK_FNAME=jabswitch.exe" \
            -D "JDK_INTERNAL_NAME=jabswitch" \
            -D "JDK_FTYPE=0x01L", \
687
      MANIFEST := $(JDK_TOPDIR)/src/windows/native/sun/bridge/jabswitch.manifest))
688 689 690

    BUILD_LAUNCHERS += $(BUILD_JABSWITCH)

691
  endif
692

O
ohair 已提交
693 694
##########################################################################################

I
ihse 已提交
695
$(BUILD_LAUNCHERS): $(JDK_TOPDIR)/make/CompileLaunchers.gmk
O
ohair 已提交
696 697 698 699

all: $(BUILD_LAUNCHERS)

.PHONY: all