1 #
   2 # Copyright 2005-2008 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 # Java Launcher Infrastructure Library (libjli)
  28 #
  29 # This library provides shared support for the Java launcher in all of
  30 # its manifestations (java, javaw, javac, ...).
  31 #
  32 BUILDDIR = ../..
  33 LIBRARY = jli
  34 PRODUCT = java
  35 
  36 #
  37 # Must be included before Defs.gmk to be functional.
  38 #
  39 # Note that for Windows, both a dynamic and static version are built.
  40 # Doing the compiles with the static library specified can be overridden
  41 # by the link step, but not the reverse.
  42 #
  43 MS_RUNTIME_STATIC = true
  44 
  45 include $(BUILDDIR)/common/Defs.gmk
  46 
  47 ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
  48 LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin
  49 LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin
  50 
  51 ifeq ($(ZERO_BUILD), true)
  52 ERGO_FAMILY=zero
  53 else
  54 ifeq ($(ARCH_FAMILY), amd64)
  55 ERGO_FAMILY=i586
  56 else
  57 ERGO_FAMILY=$(ARCH_FAMILY)
  58 endif
  59 endif
  60 
  61 
  62 #
  63 # Files to compile.
  64 #
  65 FILES_c = \
  66         java.c \
  67         splashscreen_stubs.c \
  68         java_md.c \
  69         parse_manifest.c \
  70         version_comp.c \
  71         wildcard.c \
  72         jli_util.c \
  73         inflate.c \
  74         inftrees.c \
  75         inffast.c \
  76         zadler32.c \
  77         zcrc32.c \
  78         zutil.c
  79 
  80 ifneq ($(PLATFORM), windows)
  81 
  82 FILES_c += \
  83         $(CTARGDIR)ergo.c \
  84         $(CTARGDIR)ergo_$(ERGO_FAMILY).c
  85 endif
  86 
  87 
  88 # Names of arch directories
  89 LIBARCH_DEFINES = -DLIBARCHNAME='"$(LIBARCH)"'
  90 ifeq ($(PLATFORM), solaris)
  91   LIBARCH_DEFINES += -DLIBARCH32NAME='"$(LIBARCH32)"'
  92   LIBARCH_DEFINES += -DLIBARCH64NAME='"$(LIBARCH64)"'
  93 endif
  94 
  95 OTHER_CPPFLAGS += $(LIBARCH_DEFINES)
  96 
  97 
  98 ifneq ($(PLATFORM), windows)    # UNIX systems
  99         LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli
 100         # Note: its important to keep this order meaning -lc is the
 101         # last library otherwise it could cause compatibility issues
 102         # by pulling in SUNW_private symbols from libc
 103         LDLIBS = -ldl -lc
 104 ifeq ($(USE_PTHREADS),true)
 105         LDLIBS += -lpthread
 106 endif # USE_PTHREADS 
 107 endif # PLATFORM
 108 
 109 ifeq ($(PLATFORM), windows)
 110         EXTRA_LIBS = advapi32.lib \
 111                      comctl32.lib \
 112                      user32.lib
 113 
 114         JAVALIB =
 115         OTHER_LCF =  -export:JLI_Launch \
 116                      -export:JLI_ManifestIterate \
 117                      -export:JLI_SetTraceLauncher \
 118                      -export:JLI_ReportErrorMessage \
 119                      -export:JLI_ReportErrorMessageSys \
 120                      -export:JLI_ReportMessage \
 121                      -export:JLI_ReportExceptionDescription
 122 
 123 endif
 124 
 125 OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)
 126 OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC)
 127 OTHER_INCLUDES += -I$(ZIP_SRC)
 128 
 129 #
 130 # Library to compile.
 131 #
 132 include $(BUILDDIR)/common/Mapfile-vers.gmk
 133 include $(BUILDDIR)/common/Library.gmk
 134 
 135 #
 136 # On Windows, some executable objects need to be statically linked against
 137 # the jli library.  Hence, we need both a standard library (archive) and
 138 # an import library (associated with a dll).  These both usually have the
 139 # extension .LIB, so they need to be placed in different directories.  The
 140 # import library is build (as usual) in the $(OBJDIR) directory while the
 141 # standard library is built in a "static" subdirectory.  The standard library
 142 # is not delivered as part of the product, but is only needed as part of
 143 # the build process.  The import library is built by the standard rules
 144 # in Library.gmk.  The additional rules which follow build the standard
 145 # library.
 146 #
 147 ifeq ($(PLATFORM), windows)
 148 
 149 STATIC_LIBRARY_DIR = $(OBJDIR)/static
 150 STATIC_LIBRARY_NAME = $(LIBPREFIX)$(LIBRARY).lib
 151 STATIC_LIBRARY = $(STATIC_LIBRARY_DIR)/$(STATIC_LIBRARY_NAME)
 152 
 153 $(STATIC_LIBRARY_DIR): $(OBJDIR)
 154         @$(prep-target)
 155         @$(MKDIR) $(STATIC_LIBRARY_DIR)
 156 
 157 $(STATIC_LIBRARY): $(STATIC_LIBRARY_DIR)
 158         @$(prep-target)
 159         $(LIBEXE) -nologo -out:$@ $(FILES_o)
 160 
 161 library:: $(STATIC_LIBRARY)
 162 
 163 endif   # PLATFORM
 164 
 165 #
 166 # Add to ambient vpath so we pick up the library files
 167 #
 168 vpath %.c $(LAUNCHER_SHARE_SRC) $(ZIP_SRC) $(LAUNCHER_PLATFORM_SRC)