blob: 7e71e10bbd14f0ac0d10a31fa467f7927e0e0d97 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001#
2# Copyright 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation. Sun designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Sun in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22# CA 95054 USA or visit www.sun.com if you need additional information or
23# have any questions.
24#
25
26#
27# Makefile for building simple launchers
28#
29
30BUILDDIR = ..
31PACKAGE = launcher
32PRODUCT = sun
33include $(BUILDDIR)/common/Defs.gmk
34
35# The PROGRAM and MAIN_CLASS must be defined
36ifndef PROGRAM
37 build: no_program
38 no_program:
39 $(ECHO) "No PROGRAM name defined"
40 exit 1
41endif
42ifndef MAIN_CLASS
43 build: no_main
44 no_main:
45 $(ECHO) "No MAIN_CLASS name defined"
46 exit 1
47endif
48
49# Some tools need the wildcard expansion option
50ifeq ($(PROGRAM),apt)
51 WILDCARDS=true
52 NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
53endif
54ifeq ($(PROGRAM),javac)
55 WILDCARDS=true
56 MAIN_JAVA_ARGS += -J-Xss4m -J-ea:com.sun.tools...
57 NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
58endif
59ifeq ($(PROGRAM),javadoc)
60 WILDCARDS=true
61 NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
62endif
63ifeq ($(PROGRAM),javap)
64 WILDCARDS=true
65 NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
66endif
67ifeq ($(PROGRAM),javah)
68 WILDCARDS=true
69 NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
70endif
71ifeq ($(PROGRAM),serialver)
72 WILDCARDS=true
73endif
74
75# GUI tools need X11
76ifeq ($(PROGRAM),appletviewer)
77 GUI_TOOL=true
78endif
79ifeq ($(PROGRAM),policytool)
80 GUI_TOOL=true
81endif
82
83# SA tools
84ifeq ($(PROGRAM),jstack)
85 SA_TOOL=true
86endif
87ifeq ($(PROGRAM),jsadebugd)
88 SA_TOOL=true
89endif
90ifeq ($(PROGRAM),jinfo)
91 SA_TOOL=true
92endif
93ifeq ($(PROGRAM),jmap)
94 SA_TOOL=true
95endif
96
97# special idlj launcher
98ifeq ($(PROGRAM),orbd)
99 IDLJ_TOOL=true
100endif
101ifeq ($(PROGRAM),servertool)
102 IDLJ_TOOL=true
103endif
104ifeq ($(PROGRAM),tnameserv)
105 IDLJ_TOOL=true
106endif
107
108# idlj itself only
109ifeq ($(PROGRAM),idlj)
110 ifndef STANDALONE_CORBA_WS
111 FILES_c = $(SHARE_SRC)/native/bin/$(PROGRAM).c \
112 $(SHARE_SRC)/native/bin/utility.c
113 endif
114endif
115
116# rmic only
117ifeq ($(PROGRAM),rmic)
118 ifdef STANDALONE_CORBA_WS
119 FILES_c = $(SHARE_SRC)/native/bin/$(PROGRAM).c \
120 $(SHARE_SRC)/native/bin/utility.c
121 endif
122 WILDCARDS=true
123endif
124
125# IDLJ_TOOL only uses different source files
126ifeq ($(IDLJ_TOOL),true)
127 ifdef STANDALONE_CORBA_WS
128 FILES_c = $(SHARE_SRC)/native/bin/idlj.c \
129 $(SHARE_SRC)/native/bin/utility.c
130 endif
131endif
132
133# jdb only
134ifeq ($(PROGRAM),jdb)
135 # Override the default APP_CLASSPATH to pick up sa-jdi.jar also.
136 # Default is defined in src/[solaris,windows]/bin/java_md.h
137 # PROGRAM, JAVA_ARGS, and APP_CLASSPATH are used in src/share/bin/java.c
138 # SA is currently not available on windows (for any ARCH), or linux-ia64:
139 ifneq ($(ARCH), ia64)
140 JDB_CLASSPATH = "{ \"/lib/tools.jar\", \"/lib/sa-jdi.jar\", \"/classes\" }"
141 OTHER_CPPFLAGS += -DAPP_CLASSPATH=$(JDB_CLASSPATH)
142 endif
143endif
144
145# jconsole only
146ifeq ($(PROGRAM),jconsole)
147 JCONSOLE_CLASSPATH = "{ \"/lib/jconsole.jar\", \"/lib/tools.jar\", \"/classes\" }"
148 OTHER_CPPFLAGS += -DAPP_CLASSPATH=$(JCONSOLE_CLASSPATH)
149 ifeq ($(PLATFORM), windows)
150 OTHER_CPPFLAGS += -DJAVAW
151 LDLIBS_COMMON += user32.lib
152 MAIN_JAVA_ARGS += -J-Djconsole.showOutputViewer
153 endif
154endif
155
156# GUI tools
157ifeq ($(GUI_TOOL),true)
158 ifneq ($(PLATFORM), windows)
159 # Anything with a GUI needs X11 to be linked in.
160 OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11
161 endif
162endif
163
164# SA tools need special app classpath
165ifeq ($(SA_TOOL),true)
166 SA_CLASSPATH = "{ \"/lib/tools.jar\", \"/lib/sa-jdi.jar\", \"/classes\"}"
167 OTHER_CPPFLAGS += -DAPP_CLASSPATH=$(SA_CLASSPATH)
168endif
169
170# Wildcards
171ifeq ($(WILDCARDS),true)
172 OTHER_CPPFLAGS += -DEXPAND_CLASSPATH_WILDCARDS
173endif
174
175# Always tell native code what the main class is
176OTHER_CPPFLAGS += -DMAIN_CLASS=\"$(MAIN_CLASS)\"
177
178# Construct initializer for initial arguments to java
179ALL_ARGS = -J-ms8m $(MAIN_JAVA_ARGS) $(MAIN_CLASS) $(MAIN_ARGS)
180JAVA_ARGS = "{ $(ALL_ARGS:%=\"%\",) }"
181
182# Always report launcher info
183build: launcher_info
184
185# Print info macro
186define printLauncherSetting
187if [ "$2" != "" ] ; then $(PRINTF) "%-16s %s\n" "$1:" "$2"; fi
188endef
189
190# Report basic information about this launcher
191launcher_info:
192 @$(ECHO) "========================================================="
193 @$(call printLauncherSetting,LAUNCHER,$(PROGRAM))
194 @$(call printLauncherSetting,MAIN_CLASS,$(MAIN_CLASS))
195 @$(call printLauncherSetting,MAIN_JAVA_ARGS,$(MAIN_JAVA_ARGS))
196 @$(call printLauncherSetting,MAIN_ARGS,$(MAIN_ARGS))
197 @$(call printLauncherSetting,ALL_ARGS,$(ALL_ARGS))
198 @$(ECHO) "========================================================="
199
200#
201# Rules for building a program
202#
203include $(BUILDDIR)/common/Program.gmk
204