Makefile.launcher 5.4 KB
Newer Older
D
duke 已提交
1
#
2
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6
# 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
7
# published by the Free Software Foundation.  Oracle designates this
D
duke 已提交
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
D
duke 已提交
10 11 12 13 14 15 16 17 18 19 20
#
# 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.
#
21 22 23
# 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.
D
duke 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#

#
# Makefile for building simple launchers
#

BUILDDIR = ..
PACKAGE = launcher
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

# The PROGRAM and MAIN_CLASS must be defined
ifndef PROGRAM
  build: no_program
  no_program:
	$(ECHO) "No PROGRAM name defined"
	exit 1
endif
ifndef MAIN_CLASS
  build: no_main
  no_main:
	$(ECHO) "No MAIN_CLASS name defined"
	exit 1
endif

# Some tools need the wildcard expansion option
ifeq ($(PROGRAM),javac)
  WILDCARDS=true
  MAIN_JAVA_ARGS += -J-Xss4m -J-ea:com.sun.tools...
  NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
endif
ifeq ($(PROGRAM),javadoc)
  WILDCARDS=true
  NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
endif
ifeq ($(PROGRAM),javap)
  WILDCARDS=true
  NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
endif
ifeq ($(PROGRAM),javah)
  WILDCARDS=true
  NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
endif
ifeq ($(PROGRAM),serialver)
  WILDCARDS=true
endif

# GUI tools need X11
ifeq ($(PROGRAM),appletviewer)
  GUI_TOOL=true
endif
ifeq ($(PROGRAM),policytool)
  GUI_TOOL=true
endif

# SA tools
ifeq ($(PROGRAM),jstack)
  SA_TOOL=true
endif
ifeq ($(PROGRAM),jsadebugd)
  SA_TOOL=true
85
  INFO_PLIST_FILE=Info-privileged.plist
D
duke 已提交
86 87 88
endif
ifeq ($(PROGRAM),jinfo)
  SA_TOOL=true
89
  INFO_PLIST_FILE=Info-privileged.plist
D
duke 已提交
90 91 92
endif
ifeq ($(PROGRAM),jmap)
  SA_TOOL=true
93
  INFO_PLIST_FILE=Info-privileged.plist
D
duke 已提交
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
endif

# special idlj launcher
ifeq ($(PROGRAM),orbd)
  IDLJ_TOOL=true
endif
ifeq ($(PROGRAM),servertool)
  IDLJ_TOOL=true
endif
ifeq ($(PROGRAM),tnameserv)
  IDLJ_TOOL=true
endif

# idlj itself only
ifeq ($(PROGRAM),idlj)
  ifndef STANDALONE_CORBA_WS
    FILES_c = $(SHARE_SRC)/native/bin/$(PROGRAM).c \
	      $(SHARE_SRC)/native/bin/utility.c
  endif
endif

# rmic only
ifeq ($(PROGRAM),rmic)
  ifdef STANDALONE_CORBA_WS
    FILES_c = $(SHARE_SRC)/native/bin/$(PROGRAM).c \
	      $(SHARE_SRC)/native/bin/utility.c
  endif
  WILDCARDS=true
endif

# IDLJ_TOOL only uses different source files
ifeq ($(IDLJ_TOOL),true)
  ifdef STANDALONE_CORBA_WS
    FILES_c = $(SHARE_SRC)/native/bin/idlj.c  \
	      $(SHARE_SRC)/native/bin/utility.c
  endif
endif

# jdb only
ifeq ($(PROGRAM),jdb)
  # Override the default APP_CLASSPATH to pick up sa-jdi.jar also.
  #   Default is defined in src/[solaris,windows]/bin/java_md.h
  #   PROGRAM, JAVA_ARGS, and APP_CLASSPATH are used in src/share/bin/java.c
  #   SA is currently not available on windows (for any ARCH), or linux-ia64:
  ifneq ($(ARCH), ia64)
139 140
    JDB_CLASSPATH = { "/lib/tools.jar", "/lib/sa-jdi.jar", "/classes" }
    OTHER_CPPFLAGS += -DAPP_CLASSPATH='$(JDB_CLASSPATH)'
D
duke 已提交
141 142 143 144 145
  endif
endif

# jconsole only
ifeq ($(PROGRAM),jconsole)
146 147
  JCONSOLE_CLASSPATH = { "/lib/jconsole.jar", "/lib/tools.jar", "/classes" }
  OTHER_CPPFLAGS += -DAPP_CLASSPATH='$(JCONSOLE_CLASSPATH)'
D
duke 已提交
148 149 150 151 152 153 154 155 156 157
  ifeq ($(PLATFORM), windows)
    OTHER_CPPFLAGS += -DJAVAW
    LDLIBS_COMMON  += user32.lib
    MAIN_JAVA_ARGS += -J-Djconsole.showOutputViewer
  endif
endif

# GUI tools
ifeq ($(GUI_TOOL),true)
  ifneq ($(PLATFORM), windows)
158 159 160 161
    ifneq ($(PLATFORM), macosx)
      # Anything with a GUI needs X11 to be linked in.
      OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11
    endif
D
duke 已提交
162 163 164 165 166
  endif
endif

# SA tools need special app classpath
ifeq ($(SA_TOOL),true)
167 168
  SA_CLASSPATH = { "/lib/tools.jar", "/lib/sa-jdi.jar", "/classes" }
  OTHER_CPPFLAGS += -DAPP_CLASSPATH='$(SA_CLASSPATH)'
D
duke 已提交
169 170 171 172 173 174 175 176
endif

# Wildcards
ifeq ($(WILDCARDS),true)
  OTHER_CPPFLAGS += -DEXPAND_CLASSPATH_WILDCARDS
endif

# Always tell native code what the main class is
177
OTHER_CPPFLAGS += -DMAIN_CLASS='"$(MAIN_CLASS)"'
D
duke 已提交
178 179 180

# Construct initializer for initial arguments to java
ALL_ARGS = -J-ms8m $(MAIN_JAVA_ARGS) $(MAIN_CLASS) $(MAIN_ARGS)
181
JAVA_ARGS = { $(ALL_ARGS:%="%",)  }
D
duke 已提交
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205

# Always report launcher info
build: launcher_info

# Print info macro
define printLauncherSetting
if [ "$2" != "" ] ; then $(PRINTF) "%-16s %s\n" "$1:" "$2"; fi
endef

# Report basic information about this launcher
launcher_info:
	@$(ECHO) "========================================================="
	@$(call printLauncherSetting,LAUNCHER,$(PROGRAM))
	@$(call printLauncherSetting,MAIN_CLASS,$(MAIN_CLASS))
	@$(call printLauncherSetting,MAIN_JAVA_ARGS,$(MAIN_JAVA_ARGS))
	@$(call printLauncherSetting,MAIN_ARGS,$(MAIN_ARGS))
	@$(call printLauncherSetting,ALL_ARGS,$(ALL_ARGS))
	@$(ECHO) "========================================================="

#
# Rules for building a program
#
include $(BUILDDIR)/common/Program.gmk