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