#
# Copyright (c) 2004, 2005, 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 = 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),apt)
WILDCARDS=true
NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
endif
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
endif
ifeq ($(PROGRAM),jinfo)
SA_TOOL=true
endif
ifeq ($(PROGRAM),jmap)
SA_TOOL=true
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)
JDB_CLASSPATH = { "/lib/tools.jar", "/lib/sa-jdi.jar", "/classes" }
OTHER_CPPFLAGS += -DAPP_CLASSPATH='$(JDB_CLASSPATH)'
endif
endif
# jconsole only
ifeq ($(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
endif
endif
# GUI tools
ifeq ($(GUI_TOOL),true)
ifneq ($(PLATFORM), windows)
# Anything with a GUI needs X11 to be linked in.
OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11
endif
endif
# SA tools need special app classpath
ifeq ($(SA_TOOL),true)
SA_CLASSPATH = { "/lib/tools.jar", "/lib/sa-jdi.jar", "/classes" }
OTHER_CPPFLAGS += -DAPP_CLASSPATH='$(SA_CLASSPATH)'
endif
# Wildcards
ifeq ($(WILDCARDS),true)
OTHER_CPPFLAGS += -DEXPAND_CLASSPATH_WILDCARDS
endif
# Always tell native code what the main class is
OTHER_CPPFLAGS += -DMAIN_CLASS='"$(MAIN_CLASS)"'
# Construct initializer for initial arguments to java
ALL_ARGS = -J-ms8m $(MAIN_JAVA_ARGS) $(MAIN_CLASS) $(MAIN_ARGS)
JAVA_ARGS = { $(ALL_ARGS:%="%",) }
# 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