0N/A#
4680N/A# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
2362N/A# published by the Free Software Foundation. Oracle designates this
0N/A# particular file as subject to the "Classpath" exception as provided
2362N/A# by Oracle in the LICENSE file that accompanied this code.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
0N/A#
0N/A
0N/A#
0N/A# Java Launcher Infrastructure Library (libjli)
0N/A#
0N/A# This library provides shared support for the Java launcher in all of
0N/A# its manifestations (java, javaw, javac, ...).
0N/A#
0N/ABUILDDIR = ../..
0N/ALIBRARY = jli
0N/APRODUCT = java
0N/A
0N/A#
0N/A# Must be included before Defs.gmk to be functional.
0N/A#
0N/A# Note that for Windows, both a dynamic and static version are built.
0N/A# Doing the compiles with the static library specified can be overridden
0N/A# by the link step, but not the reverse.
0N/A#
0N/AMS_RUNTIME_STATIC = true
0N/A
0N/Ainclude $(BUILDDIR)/common/Defs.gmk
0N/A
4632N/Aifneq ($(SYSTEM_ZLIB),true)
4680N/A ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
5353N/Aelse # SYSTEM_ZLIB
5353N/A OTHER_CFLAGS += $(ZLIB_CFLAGS)
4680N/Aendif #SYSTEM_ZLIB
0N/ALAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin
4680N/A
4680N/A# set the platform specific directory for macosx, also this platform shares
4680N/A# substantial family ties with its siblings (solaris and linux), thus we add
4680N/A# solaris src path to its compilation dependencies.
4680N/Aifeq ($(PLATFORM), macosx)
4680N/A LAUNCHER_PLATFORM_SRC = $(BUILDDIR)/../src/macosx/bin
4680N/A LAUNCHER_SOLARIS_PLATFORM_SRC = $(BUILDDIR)/../src/solaris/bin
4680N/Aelse # !MACOSX
4680N/A LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin
4680N/Aendif #PLATFORM
0N/A
1772N/Aifeq ($(ZERO_BUILD), true)
4680N/A ERGO_FAMILY=zero
4680N/Aelse # !ZERO_BUILD
4680N/A ifneq (,$(findstring $(ARCH_FAMILY), amd64 x86_64))
4680N/A ERGO_FAMILY=i586
4680N/A else # !X86 FAMILY
4680N/A ERGO_FAMILY=$(ARCH_FAMILY)
4680N/A endif #ARCH_FAMILY
4680N/Aendif # ZERO_BUILD
0N/A
0N/A#
0N/A# Files to compile.
0N/A#
4680N/AFILES_c = java.c \
4680N/A splashscreen_stubs.c \
4680N/A parse_manifest.c \
4680N/A version_comp.c \
4680N/A wildcard.c \
4680N/A jli_util.c
4632N/A
4632N/Aifneq ($(SYSTEM_ZLIB),true)
4680N/A FILES_c += inflate.c \
4680N/A inftrees.c \
4680N/A inffast.c \
4680N/A zadler32.c \
4680N/A zcrc32.c \
4680N/A zutil.c
4680N/Aendif # SYSTEM_ZLIB
0N/A
4680N/A# add platform specific files
4680N/Aifeq ($(PLATFORM), windows)
5270N/A FILES_c += java_md.c \
5270N/A cmdtoargs.c
4680N/Aelse # NIXES
4680N/A FILES_c += java_md_common.c
4680N/A ifeq ($(PLATFORM), macosx)
4680N/A FILES_c += java_md_macosx.c
4680N/A else # SOLARIS/LINUX
4680N/A FILES_c += java_md_solinux.c
4680N/A FILES_c += ergo.c
4680N/A ERGO_ARCH_FILE = ergo_$(ERGO_FAMILY).c
4680N/A # if the architecture specific ergo file exists then
4680N/A # use it, else use the generic definitions from ergo.c
4680N/A ifneq ($(wildcard $(LAUNCHER_PLATFORM_SRC)/$(ERGO_ARCH_FILE)),)
4680N/A FILES_c += $(ERGO_ARCH_FILE)
4680N/A else # !ERGO_ARCH_FILE
4680N/A OTHER_CPPFLAGS += -DUSE_GENERIC_ERGO
4680N/A endif # ERGO_ARCH_FILE
4680N/A endif #MACOSX
4680N/Aendif #WINDOWS
0N/A
0N/A# Names of arch directories
0N/ALIBARCH_DEFINES = -DLIBARCHNAME='"$(LIBARCH)"'
0N/Aifeq ($(PLATFORM), solaris)
0N/A LIBARCH_DEFINES += -DLIBARCH32NAME='"$(LIBARCH32)"'
0N/A LIBARCH_DEFINES += -DLIBARCH64NAME='"$(LIBARCH64)"'
4680N/Aendif # PLATFORM
0N/A
4632N/Aifeq ($(PLATFORM), macosx)
4632N/A OTHER_CPPFLAGS += $(LIBARCH_DEFINES) -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
4680N/Aelse # ! MACOSX
4632N/A OTHER_CPPFLAGS += $(LIBARCH_DEFINES)
4680N/Aendif #PLATFORM
0N/A
0N/Aifneq ($(PLATFORM), windows) # UNIX systems
4680N/A ifeq ($(PLATFORM), macosx)
4680N/A LIB_LOCATION = $(LIBDIR)/jli
4680N/A else # SOLARIS/LINUX
4680N/A LD_RUNPATH_EXTRAS += ..
4680N/A LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli
4680N/A # Note: it is important to keep this order, meaning -lc as the
4680N/A # last library, otherwise it could cause compatibility issues
4680N/A # by pulling in SUNW_private symbols from libc
4680N/A LDLIBS = -ldl -lc
4680N/A ifeq ($(USE_PTHREADS),true)
4680N/A LDLIBS += -lpthread
4680N/A endif # USE_PTHREADS
4680N/A endif # PLATFORM
4632N/Aendif # PLATFORM
4632N/A
0N/Aifeq ($(PLATFORM), windows)
4680N/A EXTRA_LIBS = advapi32.lib \
4680N/A comctl32.lib \
4680N/A user32.lib
4680N/A JAVALIB =
4680N/A OTHER_LCF = -export:JLI_Launch \
4680N/A -export:JLI_ManifestIterate \
4680N/A -export:JLI_SetTraceLauncher \
4680N/A -export:JLI_ReportErrorMessage \
4680N/A -export:JLI_ReportErrorMessageSys \
4680N/A -export:JLI_ReportMessage \
5270N/A -export:JLI_ReportExceptionDescription \
5270N/A -export:JLI_MemAlloc \
5270N/A -export:JLI_CmdToArgs \
5270N/A -export:JLI_GetStdArgc \
5270N/A -export:JLI_GetStdArgs
4680N/Aendif # PLATFORM
0N/A
0N/AOTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)
0N/AOTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC)
4632N/Aifneq ($(SYSTEM_ZLIB),true)
4632N/A OTHER_INCLUDES += -I$(ZIP_SRC)
4680N/Aelse # !SYSTEM_ZLIB
5353N/A LDLIBS += $(ZLIB_LIBS)
4680N/Aendif # SYSTEM_ZLIB
0N/A
0N/A#
0N/A# Library to compile.
0N/A#
0N/Ainclude $(BUILDDIR)/common/Mapfile-vers.gmk
0N/Ainclude $(BUILDDIR)/common/Library.gmk
0N/A
0N/A#
0N/A# On Windows, some executable objects need to be statically linked against
0N/A# the jli library. Hence, we need both a standard library (archive) and
0N/A# an import library (associated with a dll). These both usually have the
0N/A# extension .LIB, so they need to be placed in different directories. The
0N/A# import library is build (as usual) in the $(OBJDIR) directory while the
0N/A# standard library is built in a "static" subdirectory. The standard library
0N/A# is not delivered as part of the product, but is only needed as part of
0N/A# the build process. The import library is built by the standard rules
0N/A# in Library.gmk. The additional rules which follow build the standard
0N/A# library.
0N/A#
0N/Aifeq ($(PLATFORM), windows)
4680N/A STATIC_LIBRARY = $(OBJDIR)/static/$(LIBPREFIX)$(LIBRARY).lib
0N/A
4680N/A $(STATIC_LIBRARY): $(FILES_o)
0N/A @$(prep-target)
0N/A $(LIBEXE) -nologo -out:$@ $(FILES_o)
0N/A
4680N/A library:: $(STATIC_LIBRARY)
4680N/Aendif # PLATFORM
0N/A
4632N/Aifeq ($(PLATFORM), macosx)
4680N/A # Some Obj-C code is embedded in java_md_macosx.c, we stipulate so, using
4680N/A # "-x" option. Not doing so will cause the compiler to choose the language
4680N/A # based on the filename suffix, also "-Os" optimizes the file for size.
4680N/A CFLAGS_$(VARIANT)/java_md_macosx.o = -Os -x objective-c
4680N/A # Needed for linking the various launchers
4680N/A LDFLAGS += -framework Cocoa -framework Security \
4680N/A -framework ApplicationServices
4680N/A # Add solaris sources containing common logic to the header path
4680N/A OTHER_INCLUDES += -I$(LAUNCHER_SOLARIS_PLATFORM_SRC)
4680N/Aendif # PLATFORM
4632N/A
4632N/ASTATIC_LIBRARY_DIR = $(OBJDIR)/static
4632N/ASTATIC_LIBRARY_NAME = lib$(LIBRARY).a
4632N/ASTATIC_LIBRARY = $(STATIC_LIBRARY_DIR)/$(STATIC_LIBRARY_NAME)
4632N/A
4632N/A$(STATIC_LIBRARY_DIR): | $(OBJDIR)
4632N/A @$(MKDIR) $(STATIC_LIBRARY_DIR)
4632N/A
4632N/A$(STATIC_LIBRARY): $(STATIC_LIBRARY_DIR)
4632N/A @$(prep-target)
4632N/A $(AR) $(ARFLAGS) $@ $(FILES_o)
4632N/A
4632N/Alibrary:: $(STATIC_LIBRARY)
4632N/A
4632N/Avpath %.c $(LAUNCHER_SHARE_SRC) $(LAUNCHER_PLATFORM_SRC)
4632N/Aifneq ($(SYSTEM_ZLIB),true)
4632N/A vpath %.c $(ZIP_SRC)
4680N/Aelse # !SYSTEM_ZLIB
4680N/A #
4680N/A # Add to ambient vpath so we pick up the library files, for macos we add
4680N/A # solaris sources which contains the common logic for all nixes
4680N/A #
4680N/A ifeq ($(PLATFORM), macosx)
4680N/A vpath %.c $(LAUNCHER_SHARE_SRC) $(ZIP_SRC) $(LAUNCHER_PLATFORM_SRC) \
4680N/A $(LAUNCHER_SOLARIS_PLATFORM_SRC)
4680N/A else # !MACOSX
4680N/A vpath %.c $(LAUNCHER_SHARE_SRC) $(ZIP_SRC) $(LAUNCHER_PLATFORM_SRC)
4680N/A endif # MACOSX
4680N/Aendif # SYSTEM_LIB