1 #
   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 
  30 BUILDDIR = ..
  31 PACKAGE = launcher
  32 PRODUCT = sun
  33 include $(BUILDDIR)/common/Defs.gmk
  34 
  35 # The PROGRAM and MAIN_CLASS must be defined
  36 ifndef PROGRAM
  37   build: no_program
  38   no_program:
  39         $(ECHO) "No PROGRAM name defined"
  40         exit 1
  41 endif
  42 ifndef MAIN_CLASS
  43   build: no_main
  44   no_main:
  45         $(ECHO) "No MAIN_CLASS name defined"
  46         exit 1
  47 endif
  48 
  49 # Some tools need the wildcard expansion option
  50 ifeq ($(PROGRAM),apt)
  51   WILDCARDS=true
  52   NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
  53 endif
  54 ifeq ($(PROGRAM),javac)
  55   WILDCARDS=true
  56   MAIN_JAVA_ARGS += -J-Xss4m -J-ea:com.sun.tools...
  57   NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
  58 endif
  59 ifeq ($(PROGRAM),javadoc)
  60   WILDCARDS=true
  61   NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
  62 endif
  63 ifeq ($(PROGRAM),javap)
  64   WILDCARDS=true
  65   NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
  66 endif
  67 ifeq ($(PROGRAM),javah)
  68   WILDCARDS=true
  69   NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
  70 endif
  71 ifeq ($(PROGRAM),serialver)
  72   WILDCARDS=true
  73 endif
  74 
  75 # GUI tools need X11
  76 ifeq ($(PROGRAM),appletviewer)
  77   GUI_TOOL=true
  78 endif
  79 ifeq ($(PROGRAM),policytool)
  80   GUI_TOOL=true
  81 endif
  82 
  83 # SA tools
  84 ifeq ($(PROGRAM),jstack)
  85   SA_TOOL=true
  86 endif
  87 ifeq ($(PROGRAM),jsadebugd)
  88   SA_TOOL=true
  89 endif
  90 ifeq ($(PROGRAM),jinfo)
  91   SA_TOOL=true
  92 endif
  93 ifeq ($(PROGRAM),jmap)
  94   SA_TOOL=true
  95 endif
  96 
  97 # special idlj launcher
  98 ifeq ($(PROGRAM),orbd)
  99   IDLJ_TOOL=true
 100 endif
 101 ifeq ($(PROGRAM),servertool)
 102   IDLJ_TOOL=true
 103 endif
 104 ifeq ($(PROGRAM),tnameserv)
 105   IDLJ_TOOL=true
 106 endif
 107 
 108 # idlj itself only
 109 ifeq ($(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
 114 endif
 115 
 116 # rmic only
 117 ifeq ($(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
 123 endif
 124 
 125 # IDLJ_TOOL only uses different source files
 126 ifeq ($(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
 131 endif
 132 
 133 # jdb only
 134 ifeq ($(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
 143 endif
 144 
 145 # jconsole only
 146 ifeq ($(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
 154 endif
 155 
 156 # GUI tools
 157 ifeq ($(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
 162 endif
 163 
 164 # SA tools need special app classpath
 165 ifeq ($(SA_TOOL),true)
 166   SA_CLASSPATH = "{ \"/lib/tools.jar\", \"/lib/sa-jdi.jar\", \"/classes\"}"
 167   OTHER_CPPFLAGS += -DAPP_CLASSPATH=$(SA_CLASSPATH)
 168 endif
 169 
 170 # Wildcards
 171 ifeq ($(WILDCARDS),true)
 172   OTHER_CPPFLAGS += -DEXPAND_CLASSPATH_WILDCARDS
 173 endif
 174 
 175 # Always tell native code what the main class is
 176 OTHER_CPPFLAGS += -DMAIN_CLASS=\"$(MAIN_CLASS)\"
 177 
 178 # Construct initializer for initial arguments to java
 179 ALL_ARGS = -J-ms8m $(MAIN_JAVA_ARGS) $(MAIN_CLASS) $(MAIN_ARGS)
 180 JAVA_ARGS = "{ $(ALL_ARGS:%=\"%\",)  }"
 181 
 182 # Always report launcher info
 183 build: launcher_info
 184 
 185 # Print info macro
 186 define printLauncherSetting
 187 if [ "$2" != "" ] ; then $(PRINTF) "%-16s %s\n" "$1:" "$2"; fi
 188 endef
 189 
 190 # Report basic information about this launcher
 191 launcher_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 #
 203 include $(BUILDDIR)/common/Program.gmk
 204