jdk/make/java/jli/Makefile
changeset 12047 320a714614e9
parent 9035 1255eb81cc2f
child 13411 224a28370893
equal deleted inserted replaced
12046:378aa3362868 12047:320a714614e9
     1 #
     1 #
     2 # Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     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
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    42 #
    42 #
    43 MS_RUNTIME_STATIC = true
    43 MS_RUNTIME_STATIC = true
    44 
    44 
    45 include $(BUILDDIR)/common/Defs.gmk
    45 include $(BUILDDIR)/common/Defs.gmk
    46 
    46 
    47 ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
    47 ifneq ($(SYSTEM_ZLIB),true)
       
    48   ZIP_SRC = $(SHARE_SRC)/native/java/util/zip/zlib-$(ZLIB_VERSION)
       
    49 endif #SYSTEM_ZLIB
    48 LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin
    50 LAUNCHER_SHARE_SRC = $(SHARE_SRC)/bin
    49 LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin
    51 
       
    52 # set the platform specific directory for macosx, also this platform shares
       
    53 # substantial family ties with its siblings (solaris and linux), thus we add
       
    54 # solaris src path to its compilation dependencies.
       
    55 ifeq ($(PLATFORM), macosx)
       
    56  LAUNCHER_PLATFORM_SRC = $(BUILDDIR)/../src/macosx/bin
       
    57  LAUNCHER_SOLARIS_PLATFORM_SRC  = $(BUILDDIR)/../src/solaris/bin
       
    58 else # !MACOSX
       
    59  LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)/bin
       
    60 endif #PLATFORM
    50 
    61 
    51 ifeq ($(ZERO_BUILD), true)
    62 ifeq ($(ZERO_BUILD), true)
    52 ERGO_FAMILY=zero
    63   ERGO_FAMILY=zero
    53 else
    64 else # !ZERO_BUILD
    54 ifeq ($(ARCH_FAMILY), amd64)
    65   ifneq (,$(findstring $(ARCH_FAMILY), amd64 x86_64))
    55 ERGO_FAMILY=i586
    66     ERGO_FAMILY=i586
    56 else
    67   else # !X86 FAMILY
    57 ERGO_FAMILY=$(ARCH_FAMILY)
    68     ERGO_FAMILY=$(ARCH_FAMILY)
    58 endif
    69   endif #ARCH_FAMILY
    59 endif
    70 endif # ZERO_BUILD
    60 
       
    61 
    71 
    62 #
    72 #
    63 # Files to compile.
    73 # Files to compile.
    64 #
    74 #
    65 FILES_c = \
    75 FILES_c = java.c \
    66 	java.c \
    76           splashscreen_stubs.c \
    67 	splashscreen_stubs.c \
    77           parse_manifest.c \
    68 	java_md.c \
    78           version_comp.c \
    69 	parse_manifest.c \
    79           wildcard.c \
    70 	version_comp.c \
    80           jli_util.c
    71 	wildcard.c \
    81 
    72 	jli_util.c \
    82 ifneq ($(SYSTEM_ZLIB),true)
    73 	inflate.c \
    83   FILES_c += inflate.c \
    74 	inftrees.c \
    84              inftrees.c \
    75 	inffast.c \
    85              inffast.c \
    76 	zadler32.c \
    86              zadler32.c \
    77 	zcrc32.c \
    87              zcrc32.c \
    78 	zutil.c
    88              zutil.c
    79 
    89 endif # SYSTEM_ZLIB
    80 ifneq ($(PLATFORM), windows)
    90 
    81   FILES_c += ergo.c 
    91 # add platform specific files
    82   ERGO_ARCH_FILE = ergo_$(ERGO_FAMILY).c
    92 ifeq ($(PLATFORM), windows)
    83   # if the architecture specific ergo file exists then
    93   FILES_c += java_md.c
    84   # use it, else use the generic definitions from ergo.c
    94 else # NIXES
    85   ifneq ($(wildcard $(LAUNCHER_PLATFORM_SRC)/$(ERGO_ARCH_FILE)),)
    95   FILES_c += java_md_common.c
    86     FILES_c += $(ERGO_ARCH_FILE)
    96   ifeq ($(PLATFORM), macosx)
    87   else
    97     FILES_c += java_md_macosx.c
    88     OTHER_CPPFLAGS += -DUSE_GENERIC_ERGO
    98   else # SOLARIS/LINUX
    89   endif
    99     FILES_c += java_md_solinux.c
    90 endif
   100     FILES_c += ergo.c 
       
   101     ERGO_ARCH_FILE = ergo_$(ERGO_FAMILY).c
       
   102     # if the architecture specific ergo file exists then
       
   103     # use it, else use the generic definitions from ergo.c
       
   104     ifneq ($(wildcard $(LAUNCHER_PLATFORM_SRC)/$(ERGO_ARCH_FILE)),)
       
   105       FILES_c += $(ERGO_ARCH_FILE)
       
   106     else # !ERGO_ARCH_FILE
       
   107       OTHER_CPPFLAGS += -DUSE_GENERIC_ERGO
       
   108     endif # ERGO_ARCH_FILE
       
   109   endif #MACOSX
       
   110 endif #WINDOWS
    91 
   111 
    92 # Names of arch directories
   112 # Names of arch directories
    93 LIBARCH_DEFINES = -DLIBARCHNAME='"$(LIBARCH)"'
   113 LIBARCH_DEFINES = -DLIBARCHNAME='"$(LIBARCH)"'
    94 ifeq ($(PLATFORM), solaris)
   114 ifeq ($(PLATFORM), solaris)
    95   LIBARCH_DEFINES += -DLIBARCH32NAME='"$(LIBARCH32)"'
   115   LIBARCH_DEFINES += -DLIBARCH32NAME='"$(LIBARCH32)"'
    96   LIBARCH_DEFINES += -DLIBARCH64NAME='"$(LIBARCH64)"'
   116   LIBARCH_DEFINES += -DLIBARCH64NAME='"$(LIBARCH64)"'
    97 endif
   117 endif # PLATFORM
    98 
   118 
    99 OTHER_CPPFLAGS += $(LIBARCH_DEFINES)
   119 ifeq ($(PLATFORM), macosx)
   100 
   120   OTHER_CPPFLAGS += $(LIBARCH_DEFINES) -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
       
   121 else # ! MACOSX
       
   122   OTHER_CPPFLAGS += $(LIBARCH_DEFINES)
       
   123 endif #PLATFORM
   101 
   124 
   102 ifneq ($(PLATFORM), windows)	# UNIX systems
   125 ifneq ($(PLATFORM), windows)	# UNIX systems
   103         LD_RUNPATH_EXTRAS += ..
   126   ifeq ($(PLATFORM), macosx)
   104 	LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli
   127     LIB_LOCATION = $(LIBDIR)/jli
   105 	# Note: its important to keep this order meaning -lc is the
   128   else # SOLARIS/LINUX
   106 	# last library otherwise it could cause compatibility issues
   129     LD_RUNPATH_EXTRAS += ..
   107 	# by pulling in SUNW_private symbols from libc
   130     LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli
   108 	LDLIBS = -ldl -lc
   131     # Note: it is important to keep this order, meaning -lc as the
   109 ifeq ($(USE_PTHREADS),true)
   132     # last library, otherwise it could cause compatibility issues
   110 	LDLIBS += -lpthread
   133     # by pulling in SUNW_private symbols from libc
   111 endif # USE_PTHREADS 
   134     LDLIBS = -ldl -lc
       
   135     ifeq ($(USE_PTHREADS),true)
       
   136       LDLIBS += -lpthread
       
   137     endif # USE_PTHREADS 
       
   138   endif # PLATFORM
   112 endif # PLATFORM
   139 endif # PLATFORM
   113 
   140 
   114 ifeq ($(PLATFORM), windows)
   141 ifeq ($(PLATFORM), windows)
   115 	EXTRA_LIBS = advapi32.lib \
   142   EXTRA_LIBS = advapi32.lib \
   116 		     comctl32.lib \
   143                comctl32.lib \
   117 		     user32.lib
   144                user32.lib
   118 
   145   JAVALIB =
   119 	JAVALIB =
   146   OTHER_LCF = -export:JLI_Launch \
   120 	OTHER_LCF =  -export:JLI_Launch \
   147               -export:JLI_ManifestIterate \
   121 		     -export:JLI_ManifestIterate \
   148               -export:JLI_SetTraceLauncher \
   122 		     -export:JLI_SetTraceLauncher \
   149               -export:JLI_ReportErrorMessage \
   123 		     -export:JLI_ReportErrorMessage \
   150               -export:JLI_ReportErrorMessageSys \
   124 		     -export:JLI_ReportErrorMessageSys \
   151               -export:JLI_ReportMessage \
   125 		     -export:JLI_ReportMessage \
   152               -export:JLI_ReportExceptionDescription
   126 		     -export:JLI_ReportExceptionDescription
   153 endif # PLATFORM
   127 
       
   128 endif
       
   129 
   154 
   130 OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)
   155 OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)
   131 OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC)
   156 OTHER_INCLUDES += -I$(LAUNCHER_PLATFORM_SRC)
   132 OTHER_INCLUDES += -I$(ZIP_SRC)
   157 ifneq ($(SYSTEM_ZLIB),true)
       
   158   OTHER_INCLUDES += -I$(ZIP_SRC)
       
   159 else # !SYSTEM_ZLIB
       
   160   LDLIBS += -lz
       
   161 endif # SYSTEM_ZLIB
   133 
   162 
   134 #
   163 #
   135 # Library to compile.
   164 # Library to compile.
   136 #
   165 #
   137 include $(BUILDDIR)/common/Mapfile-vers.gmk
   166 include $(BUILDDIR)/common/Mapfile-vers.gmk
   148 # the build process.  The import library is built by the standard rules
   177 # the build process.  The import library is built by the standard rules
   149 # in Library.gmk.  The additional rules which follow build the standard
   178 # in Library.gmk.  The additional rules which follow build the standard
   150 # library.
   179 # library.
   151 #
   180 #
   152 ifeq ($(PLATFORM), windows)
   181 ifeq ($(PLATFORM), windows)
   153 
   182   STATIC_LIBRARY = $(OBJDIR)/static/$(LIBPREFIX)$(LIBRARY).lib
   154 STATIC_LIBRARY = $(OBJDIR)/static/$(LIBPREFIX)$(LIBRARY).lib
   183 
   155 
   184   $(STATIC_LIBRARY): $(FILES_o)
   156 $(STATIC_LIBRARY): $(FILES_o)
       
   157 	@$(prep-target)
   185 	@$(prep-target)
   158 	$(LIBEXE) -nologo -out:$@ $(FILES_o)
   186 	$(LIBEXE) -nologo -out:$@ $(FILES_o)
   159 
   187 
       
   188   library:: $(STATIC_LIBRARY)
       
   189 endif # PLATFORM
       
   190 
       
   191 ifeq ($(PLATFORM), macosx)
       
   192   # Some Obj-C code is embedded in java_md_macosx.c, we stipulate so, using
       
   193   # "-x" option. Not doing so will cause the compiler to choose the language
       
   194   # based on the filename suffix, also "-Os" optimizes the file for size.
       
   195   CFLAGS_$(VARIANT)/java_md_macosx.o = -Os -x objective-c
       
   196   # Needed for linking the various launchers
       
   197   LDFLAGS += -framework Cocoa -framework Security \
       
   198              -framework ApplicationServices
       
   199   # Add solaris sources containing common logic to the header path
       
   200   OTHER_INCLUDES += -I$(LAUNCHER_SOLARIS_PLATFORM_SRC)
       
   201 endif # PLATFORM
       
   202 
       
   203 STATIC_LIBRARY_DIR = $(OBJDIR)/static
       
   204 STATIC_LIBRARY_NAME = lib$(LIBRARY).a
       
   205 STATIC_LIBRARY = $(STATIC_LIBRARY_DIR)/$(STATIC_LIBRARY_NAME)
       
   206 
       
   207 $(STATIC_LIBRARY_DIR): | $(OBJDIR)
       
   208 	@$(MKDIR) $(STATIC_LIBRARY_DIR)
       
   209 
       
   210 $(STATIC_LIBRARY): $(STATIC_LIBRARY_DIR)
       
   211 	@$(prep-target)
       
   212 	$(AR) $(ARFLAGS) $@ $(FILES_o)
       
   213 
   160 library:: $(STATIC_LIBRARY)
   214 library:: $(STATIC_LIBRARY)
   161 
   215 
   162 endif	# PLATFORM
   216 vpath %.c $(LAUNCHER_SHARE_SRC) $(LAUNCHER_PLATFORM_SRC)
   163 
   217 ifneq ($(SYSTEM_ZLIB),true)
   164 #
   218   vpath %.c $(ZIP_SRC)
   165 # Add to ambient vpath so we pick up the library files
   219 else # !SYSTEM_ZLIB
   166 #
   220   #
   167 vpath %.c $(LAUNCHER_SHARE_SRC) $(ZIP_SRC) $(LAUNCHER_PLATFORM_SRC)
   221   # Add to ambient vpath so we pick up the library files, for macos we add 
       
   222   # solaris sources which contains the common logic for all nixes
       
   223   #
       
   224   ifeq ($(PLATFORM), macosx)
       
   225     vpath %.c $(LAUNCHER_SHARE_SRC) $(ZIP_SRC) $(LAUNCHER_PLATFORM_SRC) \
       
   226           $(LAUNCHER_SOLARIS_PLATFORM_SRC)
       
   227   else # !MACOSX
       
   228     vpath %.c $(LAUNCHER_SHARE_SRC) $(ZIP_SRC) $(LAUNCHER_PLATFORM_SRC)
       
   229   endif # MACOSX
       
   230 endif # SYSTEM_LIB