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 
 174 ifneq (, $(JDK_UPDATE_VERSION))
 175   LIBJAVA_CFLAGS += -DJDK_UPDATE_VERSION='"$(JDK_UPDATE_VERSION)"'
 176 endif
 177 
 178 LIBJAVA_EXCLUDE_FILES := check_code.c check_format.c jspawnhelper.c
 179 
 180 ifneq ($(OPENJDK_TARGET_OS), macosx)
 181   LIBJAVA_EXCLUDE_FILES += java_props_macosx.c
 182 else
 183   BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
 184   BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
 185 endif
 186 
 187 ifeq ($(OPENJDK_TARGET_OS), windows)
 188   LIBJAVA_EXCLUDE_FILES += \
 189       UNIXProcess_md.c \
 190       UnixFileSystem_md.c \
 191       FileSystemPreferences.c
 192 else
 193   LIBJAVA_EXCLUDE_FILES += \
 194       ProcessImpl_md.c \
 195       WinNTFileSystem_md.c \
 196       dirent_md.c \
 197       WindowsPreferences.c \
 198       sun/security/provider/WinCAPISeedGenerator.c \
 199       sun/io/Win32ErrorMode.c
 200 endif
 201 
 202 ifeq ($(OPENJDK_TARGET_OS), solaris)
 203   ifneq ($(OPENJDK_TARGET_CPU), x86_64)
 204     LIBJAVA_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjava/reorder-$(OPENJDK_TARGET_CPU)
 205   endif
 206 endif
 207 
 208 $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
 209     LIBRARY := java, \
 210     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 211     SRC := $(LIBJAVA_SRC_DIRS), \
 212     EXCLUDES := fdlibm/src zip, \
 213     EXCLUDE_FILES := $(LIBJAVA_EXCLUDE_FILES), \
 214     LANG := C, \
 215     OPTIMIZATION := HIGH, \
 216     CFLAGS := $(CFLAGS_JDKLIB) \
 217         $(LIBJAVA_CFLAGS), \
 218     MAPFILE := $(LIBJAVA_MAPFILE), \
 219     LDFLAGS := $(LDFLAGS_JDKLIB) \
 220         $(call SET_SHARED_LIBRARY_ORIGIN), \
 221     LDFLAGS_SUFFIX_posix := -ljvm -lverify, \
 222     LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \
 223     LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
 224     LDFLAGS_SUFFIX_aix := $(LIBDL) $(BUILD_LIBFDLIBM) -lm,\
 225     LDFLAGS_SUFFIX_macosx := -L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
 226         -framework CoreFoundation \
 227         -framework Foundation \
 228         -framework Security -framework SystemConfiguration, \
 229     LDFLAGS_SUFFIX_windows := -export:winFileHandleOpen -export:handleLseek \
 230         -export:getErrorString \
 231         jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
 232         shell32.lib delayimp.lib -DELAYLOAD:shell32.dll \
 233         advapi32.lib version.lib, \
 234     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 235     RC_FLAGS := $(RC_FLAGS) \
 236         -D "JDK_FNAME=java.dll" \
 237         -D "JDK_INTERNAL_NAME=java" \
 238         -D "JDK_FTYPE=0x2L", \
 239     REORDER := $(LIBJAVA_REORDER), \
 240     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava, \
 241     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 242 
 243 BUILD_LIBRARIES += $(BUILD_LIBJAVA)
 244 
 245 $(BUILD_LIBJAVA): $(LIBJLI_BINARY)
 246 
 247 $(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
 248 
 249 $(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
 250 
 251 ##########################################################################################
 252 
 253 BUILD_LIBZIP_EXCLUDES :=
 254 ifeq ($(USE_EXTERNAL_LIBZ), true)
 255   LIBZ := -lz
 256   LIBZIP_EXCLUDES += zlib
 257 else
 258   ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
 259 endif
 260 
 261 BUILD_LIBZIP_REORDER :=
 262 ifeq ($(OPENJDK_TARGET_OS), solaris)
 263   ifneq ($(OPENJDK_TARGET_CPU), x86_64)
 264     BUILD_LIBZIP_REORDER := $(JDK_TOPDIR)/make/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
 265   endif
 266 endif
 267 
 268 ifeq ($(LIBZIP_CAN_USE_MMAP), true)
 269   BUILD_LIBZIP_MMAP := -DUSE_MMAP
 270 endif
 271 
 272 $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
 273     LIBRARY := zip, \
 274     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 275     LANG := C, \
 276     OPTIMIZATION := LOW, \
 277     SRC := $(JDK_TOPDIR)/src/share/native/java/util/zip, \
 278     EXCLUDES := $(LIBZIP_EXCLUDES), \
 279     CFLAGS := $(CFLAGS_JDKLIB) \
 280         $(ZLIB_CPPFLAGS) \
 281         -I$(JDK_TOPDIR)/src/share/native/java/io \
 282         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io, \
 283     CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
 284     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
 285     REORDER := $(BUILD_LIBZIP_REORDER), \
 286     LDFLAGS := $(LDFLAGS_JDKLIB) \
 287         $(call SET_SHARED_LIBRARY_ORIGIN) \
 288         $(EXPORT_ZIP_FUNCS), \
 289     LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
 290         -export:ZIP_ReadEntry -export:ZIP_GetNextEntry -export:ZIP_CRC32 jvm.lib \
 291         $(WIN_JAVA_LIB), \
 292     LDFLAGS_SUFFIX_linux := -ljvm -ljava $(LIBZ), \
 293     LDFLAGS_SUFFIX_solaris := -ljvm -ljava $(LIBZ) -lc, \
 294     LDFLAGS_SUFFIX_aix := -ljvm -ljava $(LIBZ),\
 295     LDFLAGS_SUFFIX_macosx := $(LIBZ) -ljava -ljvm, \
 296     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 297     RC_FLAGS := $(RC_FLAGS) \
 298         -D "JDK_FNAME=zip.dll" \
 299         -D "JDK_INTERNAL_NAME=zip" \
 300         -D "JDK_FTYPE=0x2L", \
 301     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libzip, \
 302     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 303 
 304 
 305 $(BUILD_LIBZIP): $(BUILD_LIBJAVA)
 306 
 307 BUILD_LIBRARIES += $(BUILD_LIBZIP)
 308 
 309 ##########################################################################################
 310 
 311 $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
 312     LIBRARY := unpack, \
 313     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 314     SRC := $(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack, \
 315     EXCLUDE_FILES := main.cpp, \
 316     LANG := C++, \
 317     OPTIMIZATION := LOW, \
 318     CFLAGS := $(CXXFLAGS_JDKLIB) \
 319         -DNO_ZLIB -DUNPACK_JNI -DFULL, \
 320     CFLAGS_release := -DPRODUCT, \
 321     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers, \
 322     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 323         $(call SET_SHARED_LIBRARY_ORIGIN), \
 324     LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \
 325         jvm.lib $(WIN_JAVA_LIB), \
 326     LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \
 327     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \
 328     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 329     RC_FLAGS := $(RC_FLAGS) \
 330         -D "JDK_FNAME=unpack.dll" \
 331         -D "JDK_INTERNAL_NAME=unpack" \
 332         -D "JDK_FTYPE=0x2L", \
 333     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 334 
 335 $(BUILD_LIBUNPACK): $(BUILD_LIBJAVA)
 336 
 337 BUILD_LIBRARIES += $(BUILD_LIBUNPACK)
 338 
 339 ifeq ($(OPENJDK_TARGET_OS), windows)
 340   $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.map: $(BUILD_LIBUNPACK)
 341         $(ECHO) Copying $(@F)
 342         $(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.map, $<) $@
 343 
 344   $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.pdb: $(BUILD_LIBUNPACK)
 345         $(ECHO) Copying $(@F)
 346         $(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.pdb, $<) $@
 347 endif
 348 
 349 ##########################################################################################
 350 
 351 BUILD_LIBJLI_SRC_DIRS := $(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin
 352 LIBJLI_CFLAGS := $(CFLAGS_JDKLIB) $(foreach dir, $(BUILD_LIBJLI_SRC_DIRS), -I$(dir))
 353 
 354 BUILD_LIBJLI_FILES := \
 355     java.c \
 356     splashscreen_stubs.c \
 357     parse_manifest.c \
 358     version_comp.c \
 359     wildcard.c \
 360     jli_util.c
 361 
 362 ifeq ($(JVM_VARIANT_ZERO), true)
 363   ERGO_FAMILY := zero
 364 else
 365   ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
 366     ERGO_FAMILY := i586
 367   else
 368     ERGO_FAMILY := $(OPENJDK_TARGET_CPU_ARCH)
 369   endif
 370 endif
 371 
 372 ifeq ($(OPENJDK_TARGET_OS), macosx)
 373   LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
 374   BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/bin
 375   BUILD_LIBJLI_FILES += java_md_common.c java_md_macosx.c
 376 
 377   BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
 378   BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
 379 endif
 380 
 381 ifeq ($(OPENJDK_TARGET_OS), windows)
 382   BUILD_LIBJLI_FILES += java_md.c \
 383       cmdtoargs.c
 384   # Staticically link with c runtime on windows.
 385   LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
 386   # Supply the name of the C runtime lib.
 387   LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
 388   ifneq ($(MSVCP_DLL), )
 389     LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
 390   endif
 391 else ifneq ($(OPENJDK_TARGET_OS), macosx)
 392 
 393   BUILD_LIBJLI_FILES += java_md_common.c
 394   BUILD_LIBJLI_FILES += java_md_solinux.c ergo.c
 395 
 396   ERGO_ARCH_FILE = ergo_$(ERGO_FAMILY).c
 397 
 398   # if the architecture specific ergo file exists then
 399   # use it, else use the generic definitions from ergo.c
 400   ifneq ($(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(ERGO_ARCH_FILE)), )
 401     BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE)
 402   else # !ERGO_ARCH_FILE
 403     LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
 404   endif # ERGO_ARCH_FILE
 405 endif #WINDOWS
 406 
 407 # Append defines depending on target platform
 408 LIBJLI_CFLAGS += $(OPENJDK_TARGET_CPU_JLI_CFLAGS)
 409 
 410 ifeq ($(OPENJDK_TARGET_OS), macosx)
 411   LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
 412 endif
 413 
 414 ifneq ($(USE_EXTERNAL_LIBZ), true)
 415   BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib
 416   LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
 417   BUILD_LIBJLI_FILES += \
 418       inflate.c \
 419       inftrees.c \
 420       inffast.c \
 421       zadler32.c \
 422       zcrc32.c \
 423       zutil.c
 424 endif
 425 
 426 ifeq ($(OPENJDK_TARGET_OS), windows)
 427   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
 428 else
 429   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
 430 endif
 431 
 432 $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
 433     LIBRARY := jli, \
 434     OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
 435     SRC := $(BUILD_LIBJLI_SRC_DIRS), \
 436     INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
 437     LANG := C, \
 438     OPTIMIZATION := HIGH, \
 439     CFLAGS := $(LIBJLI_CFLAGS), \
 440     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
 441     LDFLAGS := $(LDFLAGS_JDKLIB) \
 442         $(call SET_SHARED_LIBRARY_ORIGIN), \
 443     LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 444     LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 445     LDFLAGS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
 446     LDFLAGS_SUFFIX_solaris := $(LIBZ) $(LIBDL) -lc, \
 447     LDFLAGS_SUFFIX_linux := $(LIBZ) $(LIBDL) -lc -lpthread, \
 448     LDFLAGS_SUFFIX_aix := $(LIBZ) $(LIBDL),\
 449     LDFLAGS_SUFFIX_macosx := $(LIBZ), \
 450     LDFLAGS_SUFFIX_windows := \
 451         -export:JLI_Launch \
 452         -export:JLI_ManifestIterate \
 453         -export:JLI_SetTraceLauncher \
 454         -export:JLI_ReportErrorMessage \
 455         -export:JLI_ReportErrorMessageSys \
 456         -export:JLI_ReportMessage \
 457         -export:JLI_ReportExceptionDescription \
 458         -export:JLI_MemAlloc \
 459         -export:JLI_CmdToArgs \
 460         -export:JLI_GetStdArgc \
 461         -export:JLI_GetStdArgs \
 462         advapi32.lib \
 463         comctl32.lib \
 464         user32.lib, \
 465     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 466     RC_FLAGS := $(RC_FLAGS) \
 467         -D "JDK_FNAME=jli.dll" \
 468         -D "JDK_INTERNAL_NAME=jli" \
 469         -D "JDK_FTYPE=0x2L", \
 470     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli, \
 471     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 472 
 473 BUILD_LIBRARIES += $(BUILD_LIBJLI)
 474 
 475 # On windows, the static library has the same suffix as the import library created by
 476 # with the shared library, so the static library is given a different name. No harm
 477 # in doing it for all platform to reduce complexity.
 478 ifeq ($(OPENJDK_TARGET_OS), windows)
 479   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
 480       STATIC_LIBRARY := jli_static, \
 481       OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
 482       SRC := $(BUILD_LIBJLI_SRC_DIRS), \
 483       INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
 484       LANG := C, \
 485       OPTIMIZATION := HIGH, \
 486       CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
 487       ARFLAGS := $(ARFLAGS), \
 488       OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
 489       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 490 
 491   BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
 492 
 493 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 494   #
 495   # On macosx they do partial (incremental) linking of libjli_static.a
 496   # code it here...rather than add support to NativeCompilation
 497   # as this is first time I see it
 498   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
 499       LIBRARY := jli_static, \
 500       OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
 501       SRC := $(BUILD_LIBJLI_SRC_DIRS), \
 502       INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
 503       LANG := C, \
 504       OPTIMIZATION := HIGH, \
 505       CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
 506       LDFLAGS := -nostdlib -r, \
 507       OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
 508       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 509 
 510   $(JDK_OUTPUTDIR)/objs/libjli_static.a: $(BUILD_LIBJLI_STATIC)
 511         $(call install-file)
 512 
 513   BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
 514 
 515 else ifeq ($(OPENJDK_TARGET_OS), aix)
 516   # AIX also requires a static libjli because the compiler doesn't support '-rpath'
 517   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC,\
 518       STATIC_LIBRARY:=jli_static,\
 519       OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs,\
 520       SRC:=$(BUILD_LIBJLI_SRC_DIRS),\
 521       INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
 522       LANG:=C,\
 523       OPTIMIZATION:=HIGH, \
 524       CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
 525       ARFLAGS:=$(ARFLAGS),\
 526       OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
 527 
 528   BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
 529 
 530 endif
 531 
 532 ##########################################################################################
 533 
 534 $(eval $(call SetupNativeCompilation,BUILD_LIBNPT, \
 535     LIBRARY := npt, \
 536     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 537     SRC := $(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
 538     LANG := C, \
 539     OPTIMIZATION := LOW, \
 540     CFLAGS := $(CFLAGS_JDKLIB) \
 541         -I$(JDK_TOPDIR)/src/share/npt \
 542         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
 543     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnpt/mapfile-vers, \
 544     LDFLAGS := $(LDFLAGS_JDKLIB) \
 545         $(call SET_SHARED_LIBRARY_ORIGIN), \
 546     LDFLAGS_macosx := -liconv, \
 547     LDFLAGS_SUFFIX_windows := -export:nptInitialize -export:nptTerminate, \
 548     LDFLAGS_SUFFIX_solaris := -lc, \
 549     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
 550     RC_FLAGS := $(RC_FLAGS) \
 551         -D "JDK_FNAME=npt.dll" \
 552         -D "JDK_INTERNAL_NAME=npt" \
 553         -D "JDK_FTYPE=0x2L", \
 554     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnpt, \
 555     DEBUG_SYMBOLS := true))
 556 
 557 BUILD_LIBRARIES += $(BUILD_LIBNPT)