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