1 #
   2 # Copyright (c) 2011, 2013, 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 # Include custom extensions if available.
  27 -include $(CUSTOM_MAKE_DIR)/lib/CoreLibraries.gmk
  28 
  29 WIN_VERIFY_LIB := $(JDK_OUTPUTDIR)/objs/libverify/verify.lib
  30 
  31 ##########################################################################################
  32 
  33 BUILD_LIBFDLIBM_OPTIMIZATION := NONE
  34 
  35 ifeq ($(OPENJDK_TARGET_OS), solaris)
  36   BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
  37 endif
  38 
  39 ifeq ($(OPENJDK_TARGET_OS), linux)
  40   ifeq ($(OPENJDK_TARGET_CPU), ppc64)
  41     BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
  42   else ifeq ($(OPENJDK_TARGET_CPU), ppc64le)
  43     BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
  44   endif
  45 endif
  46 
  47 ifneq ($(OPENJDK_TARGET_OS), macosx)
  48   # Unfortunately, '-ffp-contract' is only available since gcc 4.6. For ppc64le
  49   # that's no problem since ppc64le support only appeared in gcc 4.8.3. But on
  50   # ppc64 (big endian) we traditionally compiled with gcc 4.3 which only knows
  51   # '-mno-fused-madd'. However, that's still not enough to get the float
  52   # computations right - we additionally have to supply '-fno-strict-aliasing'.
  53   $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM, \
  54       STATIC_LIBRARY := fdlibm, \
  55       OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
  56       SRC := $(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src, \
  57       LANG := C, \
  58       OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
  59       CFLAGS := $(CFLAGS_JDKLIB) \
  60           -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include, \
  61       CFLAGS_windows_debug := -DLOGGING, \
  62       CFLAGS_aix := -qfloat=nomaf, \
  63       CFLAGS_linux_ppc64 := -mno-fused-madd -fno-strict-aliasing, \
  64       CFLAGS_linux_ppc64le := -ffp-contract=off, \
  65       ARFLAGS := $(ARFLAGS), \
  66       OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
  67       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
  68 
  69 else
  70 
  71   # On macosx the old build does partial (incremental) linking of fdlibm instead of
  72   # a plain static library.
  73   $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC, \
  74       LIBRARY := fdlibm, \
  75       OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
  76       SRC := $(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src, \
  77       LANG := C, \
  78       CFLAGS := $(CFLAGS_JDKLIB) \
  79           -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include, \
  80       LDFLAGS := -nostdlib -r -arch x86_64, \
  81       OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
  82       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
  83 
  84   BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
  85   $(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
  86         $(call install-file)
  87 
  88 endif
  89 
  90 BUILD_LIBRARIES += $(BUILD_LIBFDLIBM)
  91 
  92 ##########################################################################################
  93 
  94 BUILD_LIBVERIFY_SRC := check_code.c check_format.c
  95 
  96 ifeq ($(OPENJDK_TARGET_OS), solaris)
  97   ifneq ($(OPENJDK_TARGET_CPU), x86_64)
  98     BUILD_LIBVERIFY_REORDER := $(JDK_TOPDIR)/make/mapfiles/libverify/reorder-$(OPENJDK_TARGET_CPU)
  99   endif
 100 endif
 101 
 102 LIBVERIFY_OPTIMIZATION := HIGH
 103 ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
 104   ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
 105     LIBVERIFY_OPTIMIZATION := LOW
 106   endif
 107 endif
 108 
 109 $(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \
 110     LIBRARY := verify, \
 111     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 112     SRC := $(JDK_TOPDIR)/src/share/native/common, \
 113     INCLUDE_FILES := $(BUILD_LIBVERIFY_SRC), \
 114     LANG := C, \
 115     OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
 116     CFLAGS := $(CFLAGS_JDKLIB), \
 117     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libverify/mapfile-vers, \
 118     LDFLAGS := $(LDFLAGS_JDKLIB) \
 119         $(call SET_SHARED_LIBRARY_ORIGIN), \
 120     LDFLAGS_SUFFIX_posix := -ljvm -lc, \
 121     LDFLAGS_SUFFIX_windows := jvm.lib, \
 122     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 123     RC_FLAGS := $(RC_FLAGS) \
 124         -D "JDK_FNAME=verify.dll" \
 125         -D "JDK_INTERNAL_NAME=verify" \
 126         -D "JDK_FTYPE=0x2L", \
 127     REORDER := $(BUILD_LIBVERIFY_REORDER), \
 128     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libverify, \
 129     DEBUG_SYMBOLS := true))
 130 
 131 BUILD_LIBRARIES += $(BUILD_LIBVERIFY)
 132 
 133 ##########################################################################################
 134 
 135 # Allow a custom makefile to add extra src dirs
 136 LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/lang \
 137     $(JDK_TOPDIR)/src/share/native/java/lang \
 138     $(JDK_TOPDIR)/src/share/native/java/lang/reflect \
 139     $(JDK_TOPDIR)/src/share/native/java/io \
 140     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
 141     $(JDK_TOPDIR)/src/share/native/java/nio \
 142     $(JDK_TOPDIR)/src/share/native/java/security \
 143     $(JDK_TOPDIR)/src/share/native/common \
 144     $(JDK_TOPDIR)/src/share/native/sun/misc \
 145     $(JDK_TOPDIR)/src/share/native/sun/reflect \
 146     $(JDK_TOPDIR)/src/share/native/java/util \
 147     $(JDK_TOPDIR)/src/share/native/java/util/concurrent/atomic \
 148     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
 149     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/util
 150 
 151 ifeq ($(OPENJDK_TARGET_OS), windows)
 152   LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/util/locale/provider
 153 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 154   LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/util/locale/provider
 155 endif
 156 
 157 ifeq ($(OPENJDK_TARGET_OS), windows)
 158   LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/provider \
 159       $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/io
 160 endif
 161 
 162 # Make it possible to override this variable
 163 LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
 164 
 165 LIBJAVA_CFLAGS := $(foreach dir, $(LIBJAVA_SRC_DIRS), -I$(dir)) \
 166     -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include \
 167     -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
 168 
 169 LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
 170     -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
 171     -DJDK_MICRO_VERSION='"$(JDK_MICRO_VERSION)"' \
 172      -DJDK_BUILD_NUMBER='"$(JDK_BUILD_NUMBER)"'  \
 173      $(VERSION_CFLAGS)
 174 
 175 ifneq (, $(JDK_UPDATE_VERSION))
 176   LIBJAVA_CFLAGS += -DJDK_UPDATE_VERSION='"$(JDK_UPDATE_VERSION)"'
 177 endif
 178 
 179 LIBJAVA_EXCLUDE_FILES := check_code.c check_format.c jspawnhelper.c
 180 
 181 ifneq ($(OPENJDK_TARGET_OS), macosx)
 182   LIBJAVA_EXCLUDE_FILES += java_props_macosx.c
 183 else
 184   BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
 185   BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
 186 endif
 187 
 188 ifeq ($(OPENJDK_TARGET_OS), windows)
 189   LIBJAVA_EXCLUDE_FILES += \
 190       UNIXProcess_md.c \
 191       UnixFileSystem_md.c \
 192       FileSystemPreferences.c
 193 else
 194   LIBJAVA_EXCLUDE_FILES += \
 195       ProcessImpl_md.c \
 196       WinNTFileSystem_md.c \
 197       dirent_md.c \
 198       WindowsPreferences.c \
 199       sun/security/provider/WinCAPISeedGenerator.c \
 200       sun/io/Win32ErrorMode.c
 201 endif
 202 
 203 ifeq ($(OPENJDK_TARGET_OS), solaris)
 204   ifneq ($(OPENJDK_TARGET_CPU), x86_64)
 205     LIBJAVA_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjava/reorder-$(OPENJDK_TARGET_CPU)
 206   endif
 207 endif
 208 
 209 $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
 210     LIBRARY := java, \
 211     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 212     SRC := $(LIBJAVA_SRC_DIRS), \
 213     EXCLUDES := fdlibm/src zip, \
 214     EXCLUDE_FILES := $(LIBJAVA_EXCLUDE_FILES), \
 215     LANG := C, \
 216     OPTIMIZATION := HIGH, \
 217     CFLAGS := $(CFLAGS_JDKLIB) \
 218         $(LIBJAVA_CFLAGS), \
 219     MAPFILE := $(LIBJAVA_MAPFILE), \
 220     LDFLAGS := $(LDFLAGS_JDKLIB) \
 221         $(call SET_SHARED_LIBRARY_ORIGIN), \
 222     LDFLAGS_SUFFIX_posix := -ljvm -lverify, \
 223     LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \
 224     LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
 225     LDFLAGS_SUFFIX_aix := $(LIBDL) $(BUILD_LIBFDLIBM) -lm,\
 226     LDFLAGS_SUFFIX_macosx := -L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
 227         -framework CoreFoundation \
 228         -framework Foundation \
 229         -framework Security -framework SystemConfiguration, \
 230     LDFLAGS_SUFFIX_windows := -export:winFileHandleOpen -export:handleLseek \
 231         -export:getErrorString \
 232         jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
 233         shell32.lib delayimp.lib -DELAYLOAD:shell32.dll \
 234         advapi32.lib version.lib, \
 235     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 236     RC_FLAGS := $(RC_FLAGS) \
 237         -D "JDK_FNAME=java.dll" \
 238         -D "JDK_INTERNAL_NAME=java" \
 239         -D "JDK_FTYPE=0x2L", \
 240     REORDER := $(LIBJAVA_REORDER), \
 241     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava, \
 242     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 243 
 244 BUILD_LIBRARIES += $(BUILD_LIBJAVA)
 245 
 246 $(BUILD_LIBJAVA): $(LIBJLI_BINARY)
 247 
 248 $(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
 249 
 250 $(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
 251 
 252 ##########################################################################################
 253 
 254 BUILD_LIBZIP_EXCLUDES :=
 255 ifeq ($(USE_EXTERNAL_LIBZ), true)
 256   LIBZ := -lz
 257   LIBZIP_EXCLUDES += zlib
 258 else
 259   ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
 260 endif
 261 
 262 BUILD_LIBZIP_REORDER :=
 263 ifeq ($(OPENJDK_TARGET_OS), solaris)
 264   ifneq ($(OPENJDK_TARGET_CPU), x86_64)
 265     BUILD_LIBZIP_REORDER := $(JDK_TOPDIR)/make/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
 266   endif
 267 endif
 268 
 269 ifeq ($(LIBZIP_CAN_USE_MMAP), true)
 270   BUILD_LIBZIP_MMAP := -DUSE_MMAP
 271 endif
 272 
 273 $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
 274     LIBRARY := zip, \
 275     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 276     LANG := C, \
 277     OPTIMIZATION := LOW, \
 278     SRC := $(JDK_TOPDIR)/src/share/native/java/util/zip, \
 279     EXCLUDES := $(LIBZIP_EXCLUDES), \
 280     CFLAGS := $(CFLAGS_JDKLIB) \
 281         $(ZLIB_CPPFLAGS) \
 282         -I$(JDK_TOPDIR)/src/share/native/java/io \
 283         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io, \
 284     CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
 285     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
 286     REORDER := $(BUILD_LIBZIP_REORDER), \
 287     LDFLAGS := $(LDFLAGS_JDKLIB) \
 288         $(call SET_SHARED_LIBRARY_ORIGIN) \
 289         $(EXPORT_ZIP_FUNCS), \
 290     LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
 291         -export:ZIP_ReadEntry -export:ZIP_GetNextEntry -export:ZIP_CRC32 jvm.lib \
 292         $(WIN_JAVA_LIB), \
 293     LDFLAGS_SUFFIX_linux := -ljvm -ljava $(LIBZ), \
 294     LDFLAGS_SUFFIX_solaris := -ljvm -ljava $(LIBZ) -lc, \
 295     LDFLAGS_SUFFIX_aix := -ljvm -ljava $(LIBZ),\
 296     LDFLAGS_SUFFIX_macosx := $(LIBZ) -ljava -ljvm, \
 297     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 298     RC_FLAGS := $(RC_FLAGS) \
 299         -D "JDK_FNAME=zip.dll" \
 300         -D "JDK_INTERNAL_NAME=zip" \
 301         -D "JDK_FTYPE=0x2L", \
 302     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libzip, \
 303     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 304 
 305 
 306 $(BUILD_LIBZIP): $(BUILD_LIBJAVA)
 307 
 308 BUILD_LIBRARIES += $(BUILD_LIBZIP)
 309 
 310 ##########################################################################################
 311 
 312 $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
 313     LIBRARY := unpack, \
 314     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 315     SRC := $(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack, \
 316     EXCLUDE_FILES := main.cpp, \
 317     LANG := C++, \
 318     OPTIMIZATION := LOW, \
 319     CFLAGS := $(CXXFLAGS_JDKLIB) \
 320         -DNO_ZLIB -DUNPACK_JNI -DFULL, \
 321     CFLAGS_release := -DPRODUCT, \
 322     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers, \
 323     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 324         $(call SET_SHARED_LIBRARY_ORIGIN), \
 325     LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \
 326         jvm.lib $(WIN_JAVA_LIB), \
 327     LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \
 328     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \
 329     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 330     RC_FLAGS := $(RC_FLAGS) \
 331         -D "JDK_FNAME=unpack.dll" \
 332         -D "JDK_INTERNAL_NAME=unpack" \
 333         -D "JDK_FTYPE=0x2L", \
 334     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 335 
 336 $(BUILD_LIBUNPACK): $(BUILD_LIBJAVA)
 337 
 338 BUILD_LIBRARIES += $(BUILD_LIBUNPACK)
 339 
 340 ifeq ($(OPENJDK_TARGET_OS), windows)
 341   $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.map: $(BUILD_LIBUNPACK)
 342         $(ECHO) Copying $(@F)
 343         $(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.map, $<) $@
 344 
 345   $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.pdb: $(BUILD_LIBUNPACK)
 346         $(ECHO) Copying $(@F)
 347         $(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.pdb, $<) $@
 348 endif
 349 
 350 ##########################################################################################
 351 
 352 BUILD_LIBJLI_SRC_DIRS := $(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin
 353 LIBJLI_CFLAGS := $(CFLAGS_JDKLIB) $(foreach dir, $(BUILD_LIBJLI_SRC_DIRS), -I$(dir))
 354 
 355 BUILD_LIBJLI_FILES := \
 356     java.c \
 357     splashscreen_stubs.c \
 358     parse_manifest.c \
 359     version_comp.c \
 360     wildcard.c \
 361     jli_util.c
 362 
 363 ifeq ($(JVM_VARIANT_ZERO), true)
 364   ERGO_FAMILY := zero
 365 else
 366   ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
 367     ERGO_FAMILY := i586
 368   else
 369     ERGO_FAMILY := $(OPENJDK_TARGET_CPU_ARCH)
 370   endif
 371 endif
 372 
 373 ifeq ($(OPENJDK_TARGET_OS), macosx)
 374   LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
 375   BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/bin
 376   BUILD_LIBJLI_FILES += java_md_common.c java_md_macosx.c
 377 
 378   BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
 379   BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
 380 endif
 381 
 382 ifeq ($(OPENJDK_TARGET_OS), windows)
 383   BUILD_LIBJLI_FILES += java_md.c \
 384       cmdtoargs.c
 385   # Staticically link with c runtime on windows.
 386   LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
 387   # Supply the name of the C runtime lib.
 388   LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
 389   ifneq ($(MSVCP_DLL), )
 390     LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
 391   endif
 392 else ifneq ($(OPENJDK_TARGET_OS), macosx)
 393 
 394   BUILD_LIBJLI_FILES += java_md_common.c
 395   BUILD_LIBJLI_FILES += java_md_solinux.c ergo.c
 396 
 397   ERGO_ARCH_FILE = ergo_$(ERGO_FAMILY).c
 398 
 399   # if the architecture specific ergo file exists then
 400   # use it, else use the generic definitions from ergo.c
 401   ifneq ($(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(ERGO_ARCH_FILE)), )
 402     BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE)
 403   else # !ERGO_ARCH_FILE
 404     LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
 405   endif # ERGO_ARCH_FILE
 406 endif #WINDOWS
 407 
 408 # Append defines depending on target platform
 409 LIBJLI_CFLAGS += $(OPENJDK_TARGET_CPU_JLI_CFLAGS)
 410 
 411 ifeq ($(OPENJDK_TARGET_OS), macosx)
 412   LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
 413 endif
 414 
 415 ifneq ($(USE_EXTERNAL_LIBZ), true)
 416   BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
 417   LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
 418   BUILD_LIBJLI_FILES += \
 419       inflate.c \
 420       inftrees.c \
 421       inffast.c \
 422       zadler32.c \
 423       zcrc32.c \
 424       zutil.c
 425 endif
 426 
 427 ifeq ($(OPENJDK_TARGET_OS), windows)
 428   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
 429 else
 430   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
 431 endif
 432 
 433 $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
 434     LIBRARY := jli, \
 435     OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
 436     SRC := $(BUILD_LIBJLI_SRC_DIRS), \
 437     INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
 438     LANG := C, \
 439     OPTIMIZATION := HIGH, \
 440     CFLAGS := $(LIBJLI_CFLAGS), \
 441     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
 442     LDFLAGS := $(LDFLAGS_JDKLIB) \
 443         $(call SET_SHARED_LIBRARY_ORIGIN), \
 444     LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 445     LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 446     LDFLAGS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
 447     LDFLAGS_SUFFIX_solaris := $(LIBZ) $(LIBDL) -lc, \
 448     LDFLAGS_SUFFIX_linux := $(LIBZ) $(LIBDL) -lc -lpthread, \
 449     LDFLAGS_SUFFIX_aix := $(LIBZ) $(LIBDL),\
 450     LDFLAGS_SUFFIX_macosx := $(LIBZ), \
 451     LDFLAGS_SUFFIX_windows := \
 452         -export:JLI_Launch \
 453         -export:JLI_ManifestIterate \
 454         -export:JLI_SetTraceLauncher \
 455         -export:JLI_ReportErrorMessage \
 456         -export:JLI_ReportErrorMessageSys \
 457         -export:JLI_ReportMessage \
 458         -export:JLI_ReportExceptionDescription \
 459         -export:JLI_MemAlloc \
 460         -export:JLI_CmdToArgs \
 461         -export:JLI_GetStdArgc \
 462         -export:JLI_GetStdArgs \
 463         advapi32.lib \
 464         comctl32.lib \
 465         user32.lib, \
 466     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 467     RC_FLAGS := $(RC_FLAGS) \
 468         -D "JDK_FNAME=jli.dll" \
 469         -D "JDK_INTERNAL_NAME=jli" \
 470         -D "JDK_FTYPE=0x2L", \
 471     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli, \
 472     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 473 
 474 BUILD_LIBRARIES += $(BUILD_LIBJLI)
 475 
 476 # On windows, the static library has the same suffix as the import library created by
 477 # with the shared library, so the static library is given a different name. No harm
 478 # in doing it for all platform to reduce complexity.
 479 ifeq ($(OPENJDK_TARGET_OS), windows)
 480   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
 481       STATIC_LIBRARY := jli_static, \
 482       OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
 483       SRC := $(BUILD_LIBJLI_SRC_DIRS), \
 484       INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
 485       LANG := C, \
 486       OPTIMIZATION := HIGH, \
 487       CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
 488       ARFLAGS := $(ARFLAGS), \
 489       OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
 490       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 491 
 492   BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
 493 
 494 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 495   #
 496   # On macosx they do partial (incremental) linking of libjli_static.a
 497   # code it here...rather than add support to NativeCompilation
 498   # as this is first time I see it
 499   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
 500       LIBRARY := jli_static, \
 501       OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
 502       SRC := $(BUILD_LIBJLI_SRC_DIRS), \
 503       INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
 504       LANG := C, \
 505       OPTIMIZATION := HIGH, \
 506       CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
 507       LDFLAGS := -nostdlib -r, \
 508       OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
 509       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 510 
 511   $(JDK_OUTPUTDIR)/objs/libjli_static.a: $(BUILD_LIBJLI_STATIC)
 512         $(call install-file)
 513 
 514   BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
 515 
 516 else ifeq ($(OPENJDK_TARGET_OS), aix)
 517   # AIX also requires a static libjli because the compiler doesn't support '-rpath'
 518   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC,\
 519       STATIC_LIBRARY:=jli_static,\
 520       OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs,\
 521       SRC:=$(BUILD_LIBJLI_SRC_DIRS),\
 522       INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
 523       LANG:=C,\
 524       OPTIMIZATION:=HIGH, \
 525       CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
 526       ARFLAGS:=$(ARFLAGS),\
 527       OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
 528 
 529   BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
 530 
 531 endif
 532 
 533 ##########################################################################################
 534 
 535 $(eval $(call SetupNativeCompilation,BUILD_LIBNPT, \
 536     LIBRARY := npt, \
 537     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 538     SRC := $(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
 539     LANG := C, \
 540     OPTIMIZATION := LOW, \
 541     CFLAGS := $(CFLAGS_JDKLIB) \
 542         -I$(JDK_TOPDIR)/src/share/npt \
 543         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
 544     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnpt/mapfile-vers, \
 545     LDFLAGS := $(LDFLAGS_JDKLIB) \
 546         $(call SET_SHARED_LIBRARY_ORIGIN), \
 547     LDFLAGS_macosx := -liconv, \
 548     LDFLAGS_SUFFIX_windows := -export:nptInitialize -export:nptTerminate, \
 549     LDFLAGS_SUFFIX_solaris := -lc, \
 550     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 551     RC_FLAGS := $(RC_FLAGS) \
 552         -D "JDK_FNAME=npt.dll" \
 553         -D "JDK_INTERNAL_NAME=npt" \
 554         -D "JDK_FTYPE=0x2L", \
 555     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnpt, \
 556     DEBUG_SYMBOLS := true))
 557 
 558 BUILD_LIBRARIES += $(BUILD_LIBNPT)