## Copyright (c) 2004, 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.### Makefile for building simple launchers#BUILDDIR = ..PACKAGE = launcherPRODUCT = suninclude $(BUILDDIR)/common/Defs.gmk# The PROGRAM and MAIN_CLASS must be definedifndef PROGRAM build: no_program no_program: $(ECHO) "No PROGRAM name defined" exit 1endififndef MAIN_CLASS build: no_main no_main: $(ECHO) "No MAIN_CLASS name defined" exit 1endif# Some tools need the wildcard expansion optionifeq ($(PROGRAM),javac) WILDCARDS=true MAIN_JAVA_ARGS += -J-Xss4m -J-ea:com.sun.tools... NEVER_ACT_AS_SERVER_CLASS_MACHINE=trueendififeq ($(PROGRAM),javadoc) WILDCARDS=true NEVER_ACT_AS_SERVER_CLASS_MACHINE=trueendififeq ($(PROGRAM),javap) WILDCARDS=true NEVER_ACT_AS_SERVER_CLASS_MACHINE=trueendififeq ($(PROGRAM),javah) WILDCARDS=true NEVER_ACT_AS_SERVER_CLASS_MACHINE=trueendififeq ($(PROGRAM),serialver) WILDCARDS=trueendif# GUI tools need X11ifeq ($(PROGRAM),appletviewer) GUI_TOOL=trueendififeq ($(PROGRAM),policytool) GUI_TOOL=trueendif# SA toolsifeq ($(PROGRAM),jstack) SA_TOOL=trueendififeq ($(PROGRAM),jsadebugd) SA_TOOL=true INFO_PLIST_FILE=Info-privileged.plistendififeq ($(PROGRAM),jinfo) SA_TOOL=true INFO_PLIST_FILE=Info-privileged.plistendififeq ($(PROGRAM),jmap) SA_TOOL=true INFO_PLIST_FILE=Info-privileged.plistendif# special idlj launcherifeq ($(PROGRAM),orbd) IDLJ_TOOL=trueendififeq ($(PROGRAM),servertool) IDLJ_TOOL=trueendififeq ($(PROGRAM),tnameserv) IDLJ_TOOL=trueendif# idlj itself onlyifeq ($(PROGRAM),idlj) ifndef STANDALONE_CORBA_WS FILES_c = $(SHARE_SRC)/native/bin/$(PROGRAM).c \ $(SHARE_SRC)/native/bin/utility.c endifendif# rmic onlyifeq ($(PROGRAM),rmic) ifdef STANDALONE_CORBA_WS FILES_c = $(SHARE_SRC)/native/bin/$(PROGRAM).c \ $(SHARE_SRC)/native/bin/utility.c endif WILDCARDS=trueendif# IDLJ_TOOL only uses different source filesifeq ($(IDLJ_TOOL),true) ifdef STANDALONE_CORBA_WS FILES_c = $(SHARE_SRC)/native/bin/idlj.c \ $(SHARE_SRC)/native/bin/utility.c endifendif# jdb onlyifeq ($(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) JDB_CLASSPATH = { "/lib/tools.jar", "/lib/sa-jdi.jar", "/classes" } OTHER_CPPFLAGS += -DAPP_CLASSPATH='$(JDB_CLASSPATH)' endifendif# jconsole onlyifeq ($(PROGRAM),jconsole) JCONSOLE_CLASSPATH = { "/lib/jconsole.jar", "/lib/tools.jar", "/classes" } OTHER_CPPFLAGS += -DAPP_CLASSPATH='$(JCONSOLE_CLASSPATH)' ifeq ($(PLATFORM), windows) OTHER_CPPFLAGS += -DJAVAW LDLIBS_COMMON += user32.lib MAIN_JAVA_ARGS += -J-Djconsole.showOutputViewer endifendif# GUI toolsifeq ($(GUI_TOOL),true) ifneq ($(PLATFORM), windows) ifneq ($(PLATFORM), macosx) # Anything with a GUI needs X11 to be linked in. OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 endif endifendif# SA tools need special app classpathifeq ($(SA_TOOL),true) SA_CLASSPATH = { "/lib/tools.jar", "/lib/sa-jdi.jar", "/classes" } OTHER_CPPFLAGS += -DAPP_CLASSPATH='$(SA_CLASSPATH)'endif# Wildcardsifeq ($(WILDCARDS),true) OTHER_CPPFLAGS += -DEXPAND_CLASSPATH_WILDCARDSendif# Always tell native code what the main class isOTHER_CPPFLAGS += -DMAIN_CLASS='"$(MAIN_CLASS)"'# Construct initializer for initial arguments to javaALL_ARGS = -J-ms8m $(MAIN_JAVA_ARGS) $(MAIN_CLASS) $(MAIN_ARGS)JAVA_ARGS = { $(ALL_ARGS:%="%",) }# Always report launcher infobuild: launcher_info# Print info macrodefine printLauncherSettingif [ "$2" != "" ] ; then $(PRINTF) "%-16s %s\n" "$1:" "$2"; fiendef# Report basic information about this launcherlauncher_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