@  rev 49621 : 8196516: libfontmanager must be built with LDFLAGS allowing unresolved symbols
|  Summary: Fixes build failures on some sustems with custom LDFLAGS settings.
~

   1 #
   2 # Copyright (c) 2011, 2018, 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 $(eval $(call IncludeCustomExtension, lib/Awt2dLibraries-pre.gmk))
  27 
  28 WIN_AWT_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt/awt.lib
  29 
  30 ################################################################################
  31 
  32 BUILD_LIBMLIB_SRC := $(TOPDIR)/src/java.desktop/share/native/libmlib_image \
  33     $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib
  34 BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
  35     $(addprefix -I, $(BUILD_LIBMLIB_SRC)) \
  36     -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libmlib_image
  37 
  38 BUILD_LIBMLIB_LDLIBS :=
  39 
  40 BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
  41 
  42 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
  43   BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
  44 endif
  45 
  46 ifneq ($(OPENJDK_TARGET_OS), windows)
  47   BUILD_LIBMLIB_LDLIBS += $(LIBM) $(LIBDL)
  48 endif
  49 
  50 $(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE, \
  51     NAME := mlib_image, \
  52     SRC := $(BUILD_LIBMLIB_SRC), \
  53     EXCLUDE_FILES := mlib_c_ImageBlendTable.c, \
  54     OPTIMIZATION := HIGHEST, \
  55     CFLAGS := $(CFLAGS_JDKLIB) \
  56         $(BUILD_LIBMLIB_CFLAGS), \
  57     LDFLAGS := $(LDFLAGS_JDKLIB) \
  58         $(call SET_SHARED_LIBRARY_ORIGIN), \
  59     LIBS := $(BUILD_LIBMLIB_LDLIBS) \
  60         $(JDKLIB_LIBS), \
  61 ))
  62 
  63 $(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
  64 
  65 TARGETS += $(BUILD_LIBMLIB_IMAGE)
  66 
  67 ################################################################################
  68 
  69 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
  70 
  71   LIBMLIB_IMAGE_V_SRC := $(TOPDIR)/src/java.desktop/share/native/libmlib_image \
  72       $(TOPDIR)/src/java.desktop/unix/native/libmlib_image \
  73       $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib \
  74       $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \
  75       #
  76   LIBMLIB_IMAGE_V_CFLAGS := $(TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il \
  77       $(addprefix -I, $(LIBMLIB_IMAGE_V_SRC)) \
  78       #
  79 
  80   BUILD_LIBMLIB_IMAGE_V_EXFILES := \
  81       awt_ImagingLib.c \
  82       mlib_c_ImageAffine_BC.c \
  83       mlib_c_ImageAffine_BC_S16.c \
  84       mlib_c_ImageAffine_BC_U16.c \
  85       mlib_c_ImageAffine_BL.c \
  86       mlib_c_ImageAffine_BL_S16.c \
  87       mlib_c_ImageAffine_BL_U16.c \
  88       mlib_c_ImageAffine_NN.c \
  89       mlib_c_ImageConvClearEdge.c \
  90       mlib_c_ImageConvCopyEdge.c \
  91       mlib_c_ImageConv_f.c \
  92       mlib_c_ImageConvVersion.c \
  93       mlib_c_ImageCopy.c \
  94       mlib_c_ImageLookUp.c \
  95       mlib_c_ImageLookUp_f.c \
  96       #
  97 
  98   LIBMLIB_IMAGE_V_CFLAGS += $(filter-out -DMLIB_NO_LIBSUNMATH, $(BUILD_LIBMLIB_CFLAGS))
  99 
 100   $(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE_V, \
 101       NAME := mlib_image_v, \
 102       SRC := $(LIBMLIB_IMAGE_V_SRC), \
 103       EXCLUDE_FILES := $(BUILD_LIBMLIB_IMAGE_V_EXFILES), \
 104       OPTIMIZATION := HIGHEST, \
 105       CFLAGS := -xarch=sparcvis \
 106           $(LIBMLIB_IMAGE_V_CFLAGS) \
 107           $(CFLAGS_JDKLIB), \
 108       LDFLAGS := $(LDFLAGS_JDKLIB) \
 109           $(call SET_SHARED_LIBRARY_ORIGIN), \
 110       LIBS := -ljava -ljvm $(BUILD_LIBMLIB_LDLIBS), \
 111   ))
 112 
 113   $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
 114 
 115   TARGETS += $(BUILD_LIBMLIB_IMAGE_V)
 116 
 117 endif
 118 
 119 ################################################################################
 120 
 121 LIBAWT_DIRS := $(TOPDIR)/src/java.desktop/share/native/libawt \
 122     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
 123     $(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 124     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 125     #
 126 
 127 ifeq ($(OPENJDK_TARGET_OS), aix)
 128   LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libawt
 129 endif
 130 
 131 ifeq ($(OPENJDK_TARGET_OS), windows)
 132   LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/awt/utility
 133 endif
 134 
 135 ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), )
 136   LIBAWT_EXFILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
 137 endif
 138 
 139 ifeq ($(OPENJDK_TARGET_OS), macosx)
 140   LIBAWT_EXFILES += initIDs.c awt/image/cvutils/img_colors.c
 141 endif
 142 
 143 LIBAWT_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 144     $(addprefix -I, $(shell find $(LIBAWT_DIRS) -type d)) \
 145     $(LIBJAVA_HEADER_FLAGS) \
 146     $(addprefix -I, $(BUILD_LIBMLIB_IMAGE_SRC)) \
 147     #
 148 
 149 LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS)
 150 
 151 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
 152   LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
 153   LIBAWT_CFLAGS += -xarch=sparcvis
 154 
 155   LIBAWT_CFLAGS += $(TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il
 156   LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib
 157   LIBAWT_EXFILES += java2d/loops/MapAccelFunc.c
 158 
 159   ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
 160     LIBAWT_ASFLAGS = -P -xarch=v9a
 161   else
 162     LIBAWT_ASFLAGS = -P -xarch=v8plusa
 163   endif
 164 else
 165   LIBAWT_EXCLUDES += \
 166       $(TOPDIR)/src/java.desktop/unix/native/libawt/awt/medialib \
 167       $(TOPDIR)/src/java.desktop/unix/native/libawt/java2d/loops \
 168       $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \
 169       #
 170 endif
 171 
 172 ifneq ($(OPENJDK_TARGET_OS), solaris)
 173   LIBAWT_CFLAGS += -DMLIB_NO_LIBSUNMATH
 174 endif
 175 
 176 ifeq ($(OPENJDK_TARGET_OS), windows)
 177   LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/font \
 178       $(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 179       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt/systemscale \
 180   # Why does libawt need java.base headers?
 181   LIBAWT_CFLAGS += -I$(TOPDIR)/src/java.desktop/share/native/common/font \
 182       -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 183       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
 184       -I$(TOPDIR)/src/java.desktop/windows/native/include \
 185       -I$(TOPDIR)/src/java.desktop/share/native/include \
 186       -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
 187       #
 188   LIBAWT_EXFILES += \
 189       java2d/d3d/D3DShaderGen.c \
 190       awt/image/cvutils/img_colors.c \
 191       #
 192 
 193   LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
 194   ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 195     LIBAWT_CFLAGS += -DMLIB_OS64BIT
 196   endif
 197 
 198   LIBAWT_RC_FLAGS ?= -I $(TOPDIR)/src/java.base/windows/native/launcher/icons
 199   LIBAWT_VERSIONINFO_RESOURCE := $(TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
 200 endif
 201 
 202 ifeq ($(OPENJDK_TARGET_OS), linux)
 203   # FIXME: This is probably not what we want to do, but keep it now for compatibility.
 204   LIBAWT_CFLAGS += $(EXPORT_ALL_SYMBOLS)
 205 endif
 206 
 207 # Turn off all warnings for debug_mem.c This is needed because the specific warning
 208 # about initializing a declared 'extern' cannot be turned off individually. Only
 209 # applies to debug builds.
 210 ifeq ($(TOOLCHAIN_TYPE), gcc)
 211   BUILD_LIBAWT_debug_mem.c_CFLAGS := -w
 212   # This option improves performance of MaskFill in Java2D by 20% for some gcc
 213   LIBAWT_CFLAGS += -fgcse-after-reload
 214 endif
 215 
 216 $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
 217     NAME := awt, \
 218     SRC := $(LIBAWT_DIRS), \
 219     EXCLUDES := $(LIBAWT_EXCLUDES), \
 220     EXCLUDE_FILES := $(LIBAWT_EXFILES), \
 221     OPTIMIZATION := LOW, \
 222     CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
 223     DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
 224         format-nonliteral parentheses, \
 225     DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
 226     DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
 227     DISABLED_WARNINGS_microsoft := 4297 4244 4267 4996, \
 228     ASFLAGS := $(LIBAWT_ASFLAGS), \
 229     LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
 230     LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \
 231     LDFLAGS_windows := -delayload:user32.dll -delayload:gdi32.dll \
 232         -delayload:shell32.dll -delayload:winmm.dll \
 233         -delayload:winspool.drv -delayload:imm32.dll \
 234         -delayload:ole32.dll -delayload:comdlg32.dll \
 235         -delayload:comctl32.dll -delayload:shlwapi.dll, \
 236     LIBS_unix := -ljvm -ljava $(LIBM), \
 237     LIBS_linux :=  $(LIBDL), \
 238     LIBS_solaris := $(LIBDL), \
 239     LIBS_aix := $(LIBDL),\
 240     LIBS_macosx := -lmlib_image \
 241         -framework Cocoa \
 242         -framework OpenGL \
 243         -framework JavaNativeFoundation \
 244         -framework JavaRuntimeSupport \
 245         -framework ApplicationServices \
 246         -framework AudioToolbox, \
 247     LIBS_windows := kernel32.lib user32.lib gdi32.lib winspool.lib \
 248         imm32.lib ole32.lib uuid.lib shell32.lib \
 249         comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
 250         delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib, \
 251     VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
 252     RC_FLAGS := $(RC_FLAGS) $(LIBAWT_RC_FLAGS) \
 253         -D "JDK_FNAME=awt.dll" \
 254         -D "JDK_INTERNAL_NAME=awt" \
 255         -D "JDK_FTYPE=0x2L", \
 256 ))
 257 
 258 $(BUILD_LIBAWT): $(call FindLib, java.base, java)
 259 
 260 ifeq ($(OPENJDK_TARGET_OS), macosx)
 261   $(BUILD_LIBAWT): $(BUILD_LIBMLIB_IMAGE)
 262 endif
 263 
 264 TARGETS += $(BUILD_LIBAWT)
 265 
 266 ################################################################################
 267 
 268 ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
 269   ifeq ($(ENABLE_HEADLESS_ONLY), false)
 270 
 271     LIBAWT_XAWT_DIRS := \
 272         $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
 273         $(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 274         $(TOPDIR)/src/java.desktop/share/native/common/awt/utility \
 275         $(TOPDIR)/src/java.desktop/share/native/common/font \
 276         $(TOPDIR)/src/java.desktop/share/native/common/java2d \
 277         $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d \
 278         $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 279         #
 280 
 281     ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
 282       LIBAWT_XAWT_DIRS += $(TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
 283     endif
 284 
 285     LIBAWT_XAWT_EXCLUDES := medialib
 286 
 287     LIBAWT_XAWT_CFLAGS := $(addprefix -I, $(shell $(FIND) $(LIBAWT_XAWT_DIRS) -type d)) \
 288         -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 289         -I$(TOPDIR)/src/java.desktop/share/native/include \
 290         -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
 291         -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
 292         -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 293         -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
 294         -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
 295         -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
 296         -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 297         -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
 298         -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
 299         $(LIBJAVA_HEADER_FLAGS)
 300         #
 301 
 302     LIBAWT_XAWT_CFLAGS += -DXAWT -DXAWT_HACK \
 303         -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
 304         $(FONTCONFIG_CFLAGS) \
 305         $(CUPS_CFLAGS)
 306 
 307     ifeq ($(OPENJDK_TARGET_OS), solaris)
 308       LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
 309     endif
 310 
 311     ifeq ($(OPENJDK_TARGET_OS), linux)
 312       ifeq ($(DISABLE_XRENDER), true)
 313         LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true
 314       endif
 315     endif
 316 
 317     LIBAWT_XAWT_LIBS := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm
 318 
 319     ifeq ($(OPENJDK_TARGET_OS), linux)
 320       LIBAWT_XAWT_LIBS += -lpthread
 321     endif
 322 
 323     ifeq ($(TOOLCHAIN_TYPE), gcc)
 324       # Turn off all warnings for the following files since they contain warnings
 325       # that cannot be turned of individually.
 326       # redefining a macro
 327       BUILD_LIBAWT_XAWT_gtk2_interface.c_CFLAGS := -w
 328       # comparison between pointer and integer
 329       BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
 330       # initializing a declared 'extern'
 331       BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
 332    endif
 333 
 334     $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_XAWT, \
 335         NAME := awt_xawt, \
 336         SRC := $(LIBAWT_XAWT_DIRS), \
 337         EXCLUDES := $(LIBAWT_XAWT_EXCLUDES), \
 338         OPTIMIZATION := LOW, \
 339         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
 340             $(X_CFLAGS), \
 341         WARNINGS_AS_ERRORS_xlc := false, \
 342         DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
 343             unused-result maybe-uninitialized format \
 344             format-security int-to-pointer-cast parentheses \
 345             implicit-fallthrough, \
 346         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
 347             E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
 348         LDFLAGS := $(LDFLAGS_JDKLIB) \
 349             $(call SET_SHARED_LIBRARY_ORIGIN) \
 350             -L$(INSTALL_LIBRARIES_HERE), \
 351         LIBS :=  $(X_LIBS) $(LIBAWT_XAWT_LIBS), \
 352         RC_FLAGS := $(RC_FLAGS) \
 353             -D "JDK_FNAME=xawt.dll" \
 354             -D "JDK_INTERNAL_NAME=xawt" \
 355             -D "JDK_FTYPE=0x2L", \
 356     ))
 357 
 358     $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
 359 
 360     $(BUILD_LIBAWT_XAWT): $(BUILD_LIBAWT)
 361 
 362     TARGETS += $(BUILD_LIBAWT_XAWT)
 363 
 364   endif
 365 endif
 366 
 367 ################################################################################
 368 
 369 LIBLCMS_SRC := $(TOPDIR)/src/java.desktop/share/native/liblcms
 370 LIBLCMS_CPPFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 371     -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 372     -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 373     $(LIBJAVA_HEADER_FLAGS) \
 374     #
 375 # The fast floor code loses precision.
 376 LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR
 377 
 378 ifeq ($(USE_EXTERNAL_LCMS), true)
 379   # If we're using an external library, we'll just need the wrapper part.
 380   # By including it explicitly, all other files will be excluded.
 381   BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
 382 else
 383   BUILD_LIBLCMS_INCLUDE_FILES :=
 384   # If we're using the bundled library, we'll need to include it in the
 385   # include path explicitly. Otherwise the system headers will be used.
 386   LIBLCMS_CPPFLAGS += $(addprefix -I, $(LIBLCMS_SRC))
 387 endif
 388 
 389 $(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \
 390     NAME := lcms, \
 391     SRC := $(LIBLCMS_SRC), \
 392     INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
 393     OPTIMIZATION := HIGHEST, \
 394     CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
 395         $(LIBLCMS_CPPFLAGS) \
 396         $(LCMS_CFLAGS), \
 397     CFLAGS_solaris := -xc99=no_lib, \
 398     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
 399     DISABLED_WARNINGS_gcc := format-nonliteral type-limits misleading-indentation, \
 400     DISABLED_WARNINGS_clang := tautological-compare, \
 401     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
 402     DISABLED_WARNINGS_microsoft := 4819, \
 403     LDFLAGS := $(LDFLAGS_JDKLIB) \
 404         $(call SET_SHARED_LIBRARY_ORIGIN), \
 405     LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 406     LIBS_unix := -lawt -ljvm -ljava $(LCMS_LIBS) $(LIBM), \
 407     LIBS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
 408 ))
 409 
 410 TARGETS += $(BUILD_LIBLCMS)
 411 
 412 $(BUILD_LIBLCMS): $(BUILD_LIBAWT)
 413 
 414 ################################################################################
 415 
 416 LIBJAVAJPEG_SRC += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
 417 
 418 # "DISABLED_WARNINGS_gcc := clobbered" rationale:
 419 # Suppress gcc warnings like "variable might be clobbered by 'longjmp'
 420 # or 'vfork'": this warning indicates that some variable is placed to
 421 # a register by optimized compiler and it's value might be lost on longjmp().
 422 # Recommended way to avoid such warning is to declare the variable as
 423 # volatile to prevent the optimization. However, this approach does not
 424 # work because we have to declare all variables as volatile in result.
 425 
 426 ifeq ($(USE_EXTERNAL_LIBJPEG), true)
 427   LIBJPEG_LIBS := -ljpeg
 428   BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
 429       imageioJPEG.c \
 430       jpegdecoder.c
 431   BUILD_LIBJAVAJPEG_HEADERS :=
 432 else
 433   LIBJPEG_LIBS :=
 434   BUILD_LIBJAVAJPEG_INCLUDE_FILES :=
 435   BUILD_LIBJAVAJPEG_HEADERS := $(addprefix -I, $(LIBJAVAJPEG_SRC))
 436 endif
 437 
 438 $(eval $(call SetupJdkLibrary, BUILD_LIBJAVAJPEG, \
 439     NAME := javajpeg, \
 440     SRC := $(LIBJAVAJPEG_SRC), \
 441     INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
 442     OPTIMIZATION := HIGHEST, \
 443     CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBJAVAJPEG_HEADERS) \
 444         $(LIBJAVA_HEADER_FLAGS) \
 445         -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
 446     DISABLED_WARNINGS_gcc := clobbered implicit-fallthrough shift-negative-value, \
 447     LDFLAGS := $(LDFLAGS_JDKLIB) \
 448         $(call SET_SHARED_LIBRARY_ORIGIN), \
 449     LIBS := $(LIBJPEG_LIBS) $(JDKLIB_LIBS), \
 450     LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \
 451 ))
 452 
 453 $(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java)
 454 
 455 TARGETS += $(BUILD_LIBJAVAJPEG)
 456 
 457 ################################################################################
 458 
 459 # Mac and Windows only use the native AWT lib, do not build libawt_headless
 460 ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
 461 
 462   LIBAWT_HEADLESS_DIRS := $(TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
 463       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 464       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d \
 465       $(TOPDIR)/src/java.desktop/share/native/common/java2d \
 466       $(TOPDIR)/src/java.desktop/share/native/common/font \
 467       #
 468 
 469   LIBAWT_HEADLESS_EXCLUDES := medialib
 470   LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 471       $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
 472       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
 473       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 474       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 475       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
 476       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
 477       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
 478       -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 479       -I$(TOPDIR)/src/java.desktop/share/native/common/font \
 480       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
 481       -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 482       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
 483       $(LIBJAVA_HEADER_FLAGS) \
 484       #
 485 
 486   $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_HEADLESS, \
 487       NAME := awt_headless, \
 488       SRC := $(LIBAWT_HEADLESS_DIRS), \
 489       EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
 490       OPTIMIZATION := LOW, \
 491       CFLAGS := $(CFLAGS_JDKLIB) \
 492           -DHEADLESS=true \
 493           -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
 494           $(CUPS_CFLAGS) \
 495           $(FONTCONFIG_CFLAGS) \
 496           $(X_CFLAGS) \
 497           $(LIBAWT_HEADLESS_CFLAGS), \
 498       DISABLED_WARNINGS_xlc := 1506-356, \
 499       DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
 500       LDFLAGS := $(LDFLAGS_JDKLIB) \
 501           $(call SET_SHARED_LIBRARY_ORIGIN), \
 502       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 503       LIBS_unix := -lawt -ljvm -ljava, \
 504       LIBS_linux := $(LIBM) $(LIBDL), \
 505       LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX), \
 506   ))
 507 
 508   # AIX warning explanation:
 509   # 1506-356 : (W) Compilation unit is empty.
 510   #            This happens during the headless build
 511 
 512   $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
 513 
 514   TARGETS += $(BUILD_LIBAWT_HEADLESS)
 515 
 516 endif
 517 
 518 ################################################################################
 519 
 520 ifeq ($(FREETYPE_TO_USE), system)
 521   LIBFREETYPE_CFLAGS := $(FREETYPE_CFLAGS)
 522   LIBFREETYPE_LIBS := $(FREETYPE_LIBS)
 523 else
 524   LIBFREETYPE_SRC := $(TOPDIR)/src/java.desktop/share/native/libfreetype
 525   BUILD_LIBFREETYPE_HEADERS := $(addprefix -I, $(LIBFREETYPE_SRC)/include)
 526   LIBFREETYPE_CFLAGS := $(BUILD_LIBFREETYPE_HEADERS)
 527   ifeq ($(OPENJDK_TARGET_OS), windows)
 528     LIBFREETYPE_LIBS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfreetype/freetype.lib
 529   else
 530     LIBFREETYPE_LIBS := -lfreetype
 531   endif
 532 
 533   $(eval $(call SetupJdkLibrary, BUILD_LIBFREETYPE, \
 534       NAME := freetype, \
 535       SRC := $(LIBFREETYPE_SRC)/src, \
 536       OPTIMIZATION := HIGHEST, \
 537       CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBFREETYPE_HEADERS) \
 538           -DFT2_BUILD_LIBRARY $(EXPORT_ALL_SYMBOLS), \
 539       DISABLED_WARNINGS_solstudio := \
 540          E_STATEMENT_NOT_REACHED \
 541          E_END_OF_LOOP_CODE_NOT_REACHED, \
 542       DISABLED_WARNINGS_microsoft := 4267 4244, \
 543       LDFLAGS := $(LDFLAGS_JDKLIB) \
 544           $(call SET_SHARED_LIBRARY_ORIGIN), \
 545   ))
 546 
 547   TARGETS += $(BUILD_LIBFREETYPE)
 548 endif
 549 
 550 ###########################################################################
 551 
 552 LIBFONTMANAGER_SRC := $(TOPDIR)/src/java.desktop/share/native/libfontmanager \
 553     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
 554 LIBFONTMANAGER_CFLAGS := \
 555     $(addprefix -I, $(shell $(FIND) \
 556       $(LIBFONTMANAGER_SRC) \
 557       $(TOPDIR)/src/java.desktop/share/native/libawt \
 558       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
 559       $(TOPDIR)/src/java.desktop/share/native/common \
 560       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \
 561     -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 562     $(LIBJAVA_HEADER_FLAGS) \
 563     #
 564 
 565 #### Begin harfbuzz configuration
 566 
 567 HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN
 568 
 569 ifneq ($(OPENJDK_TARGET_OS), windows)
 570   HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
 571                       -DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H
 572 endif
 573 ifneq (, $(findstring $(OPENJDK_TARGET_OS), linux macosx))
 574   HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
 575 endif
 576 ifeq ($(OPENJDK_TARGET_OS), solaris)
 577   HARFBUZZ_CFLAGS += -DHAVE_SOLARIS_ATOMIC_OPS
 578 endif
 579 ifeq ($(OPENJDK_TARGET_OS), macosx)
 580   HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
 581 endif
 582 ifneq ($(OPENJDK_TARGET_OS), macosx)
 583   LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
 584 endif
 585 # hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
 586 LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
 587 
 588 LIBFONTMANAGER_CFLAGS += $(HARFBUZZ_CFLAGS)
 589 
 590 #### End harfbuzz configuration
 591 
 592 LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
 593 BUILD_LIBFONTMANAGER_FONTLIB += $(LIBFREETYPE_LIBS)
 594 
 595 LIBFONTMANAGER_OPTIMIZATION := HIGH
 596 
 597 ifeq ($(OPENJDK_TARGET_OS), windows)
 598   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
 599       X11TextRenderer.c
 600   LIBFONTMANAGER_OPTIMIZATION := HIGHEST
 601   LIBFONTMANAGER_CFLAGS += -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows
 602 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 603   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
 604       X11TextRenderer.c \
 605       fontpath.c \
 606       lcdglyph.c
 607 else
 608   LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
 609       lcdglyph.c
 610 endif
 611 
 612 LIBFONTMANAGER_CFLAGS += $(FONT_HEADERS) $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
 613 
 614 ifeq ($(TOOLCHAIN_TYPE), gcc)
 615   # Turn off all warnings for sunFont.c. This is needed because the specific warning
 616   # about discarding 'const' qualifier cannot be turned off individually.
 617   BUILD_LIBFONTMANAGER_sunFont.c_CFLAGS := -w
 618   # Turn off aliasing with GCC for ExtensionSubtables.cpp
 619   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 620 endif
 621 
 622 # LDFLAGS clarification:
 623 #   Filter relevant linker flags disallowing unresolved symbols as we cannot
 624 #   build-time decide to which library to link against (libawt_headless or
 625 #   libawt_xawt). See JDK-8196516 for details.
 626 $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
 627     NAME := fontmanager, \
 628     SRC := $(LIBFONTMANAGER_SRC), \
 629     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
 630         AccelGlyphCache.c, \
 631     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 632     CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
 633     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
 634     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
 635     CFLAGS_windows = -DCC_NOEX, \
 636     WARNINGS_AS_ERRORS_xlc := false, \
 637     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
 638         type-limits missing-field-initializers implicit-fallthrough, \
 639     DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
 640         maybe-uninitialized, \
 641     DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
 642         tautological-constant-out-of-range-compare int-to-pointer-cast, \
 643     DISABLED_WARNINGS_C_solstudio = \
 644         E_INTEGER_OVERFLOW_DETECTED \
 645         E_ARG_INCOMPATIBLE_WITH_ARG_L \
 646         E_ENUM_VAL_OVERFLOWS_INT_MAX, \
 647     DISABLED_WARNINGS_CXX_solstudio := \
 648         truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
 649         hidevf w_novirtualdescr arrowrtn2, \
 650     DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334 4819 4101, \
 651     LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
 652         $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) $(LDFLAGS_CXX_JDK) \
 653         $(call SET_SHARED_LIBRARY_ORIGIN), \
 654     LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 655     LDFLAGS_macosx := -undefined dynamic_lookup, \
 656     LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
 657     LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
 658     LIBS_aix := -lawt_headless,\
 659     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
 660         $(WIN_AWT_LIB), \
 661 ))
 662 
 663 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 664 
 665 ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
 666   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
 667 endif
 668 
 669 ifeq ($(FREETYPE_TO_USE), bundled)
 670   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBFREETYPE)
 671 endif
 672 
 673 TARGETS += $(BUILD_LIBFONTMANAGER)
 674 
 675 ################################################################################
 676 
 677 ifeq ($(OPENJDK_TARGET_OS), windows)
 678   LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 679   LIBJAWT_CFLAGS := -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \
 680       -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 681       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 682       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 683       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \
 684       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 685       -I$(TOPDIR)/src/java.desktop/windows/native/include \
 686       -I$(TOPDIR)/src/java.desktop/share/native/include \
 687       $(LIBJAVA_HEADER_FLAGS) \
 688       #
 689 
 690   ifeq ($(OPENJDK_TARGET_CPU), x86)
 691     KERNEL32_LIB := kernel32.lib
 692   endif
 693   $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \
 694       NAME := jawt, \
 695       SRC := $(LIBJAWT_SRC), \
 696       INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES), \
 697       OPTIMIZATION := LOW, \
 698       CFLAGS := $(CXXFLAGS_JDKLIB) \
 699           -EHsc -DUNICODE -D_UNICODE \
 700           $(LIBJAWT_CFLAGS), \
 701       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
 702       LIBS := $(JDKLIB_LIBS) $(KERNEL32_LIB) advapi32.lib $(WIN_AWT_LIB), \
 703   ))
 704 
 705   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
 706 
 707   $(eval $(call SetupCopyFiles, COPY_JAWT_LIB, \
 708       FILES := $(BUILD_LIBJAWT_IMPORT_LIBRARY), \
 709       DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
 710   ))
 711 
 712   $(COPY_JAWT_LIB): $(BUILD_LIBJAWT)
 713 
 714   TARGETS += $(COPY_JAWT_LIB)
 715 
 716 else # OPENJDK_TARGET_OS not windows
 717 
 718   ifeq ($(OPENJDK_TARGET_OS), macosx)
 719     LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libjawt
 720   else
 721     LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 722   endif
 723   LIBJAWT_CFLAGS := \
 724       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 725       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
 726       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
 727       -I$(TOPDIR)/src/java.desktop/share/native/include \
 728       $(LIBJAVA_HEADER_FLAGS) \
 729       #
 730 
 731   ifeq ($(OPENJDK_TARGET_OS), macosx)
 732     JAWT_LIBS := -lawt_lwawt
 733   else
 734     JAWT_LIBS :=
 735     ifneq ($(OPENJDK_TARGET_OS), solaris)
 736       JAWT_LIBS += -lawt
 737     endif
 738     ifeq ($(ENABLE_HEADLESS_ONLY), false)
 739       JAWT_LIBS += -lawt_xawt
 740     else
 741       JAWT_LIBS += -lawt_headless
 742       HEADLESS_CFLAG += -DHEADLESS
 743     endif
 744   endif
 745 
 746   $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \
 747       NAME := jawt, \
 748       SRC := $(LIBJAWT_SRC), \
 749       INCLUDE_FILES := $(JAWT_FILES), \
 750       OPTIMIZATION := LOW, \
 751       CFLAGS := $(CFLAGS_JDKLIB) \
 752           $(LIBJAWT_CFLAGS), \
 753       CFLAGS_linux := $(HEADLESS_CFLAG), \
 754       CFLAGS_macosx := $(LIBJAWT_CFLAGS_macosx), \
 755       LDFLAGS := $(LDFLAGS_JDKLIB) \
 756           $(call SET_SHARED_LIBRARY_ORIGIN), \
 757       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 758       LDFLAGS_macosx := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \
 759       LIBS_unix := $(JAWT_LIBS) $(JDKLIB_LIBS), \
 760       LIBS_solaris := $(X_LIBS) -lXrender, \
 761       LIBS_macosx := -framework Cocoa, \
 762   ))
 763 
 764   ifeq ($(ENABLE_HEADLESS_ONLY), false)
 765     $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
 766   else
 767     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
 768   endif
 769 
 770   ifeq ($(OPENJDK_TARGET_OS), macosx)
 771     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
 772   endif
 773 
 774 endif # OPENJDK_TARGET_OS
 775 
 776 TARGETS += $(BUILD_LIBJAWT)
 777 
 778 ################################################################################
 779 
 780 ifeq ($(ENABLE_HEADLESS_ONLY), false)
 781 
 782   LIBSPLASHSCREEN_DIRS := \
 783       $(TOPDIR)/src/java.desktop/share/native/libjavajpeg \
 784       $(TOPDIR)/src/java.desktop/share/native/libsplashscreen \
 785       #
 786 
 787   ifeq ($(USE_EXTERNAL_LIBGIF), true)
 788     GIFLIB_LIBS := -lgif
 789     LIBSPLASHSCREEN_EXCLUDES := giflib
 790   else
 791     LIBSPLASHSCREEN_CFLAGS += -I$(TOPDIR)/src/java.desktop/share/native/libsplashscreen/giflib
 792   endif
 793 
 794   ifeq ($(USE_EXTERNAL_LIBJPEG), true)
 795     LIBJPEG_LIBS := -ljpeg
 796   else
 797     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
 798     LIBJPEG_CFLAGS := -I$(TOPDIR)/src/java.desktop/share/native/libjavajpeg
 799   endif
 800 
 801   ifeq ($(USE_EXTERNAL_LIBPNG), false)
 802     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/share/native/libsplashscreen/libpng
 803   else
 804     LIBSPLASHSCREEN_EXCLUDES += libpng
 805   endif
 806 
 807   ifneq ($(OPENJDK_TARGET_OS), macosx)
 808     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen
 809   else
 810     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen
 811   endif
 812 
 813   ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
 814     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
 815   endif
 816 
 817   ifeq ($(OPENJDK_TARGET_OS), windows)
 818     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/windows/native/common/awt/systemscale
 819   endif
 820   LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0 \
 821       $(addprefix -I, $(LIBSPLASHSCREEN_DIRS)) \
 822       $(LIBJAVA_HEADER_FLAGS) \
 823       #
 824 
 825   ifeq ($(OPENJDK_TARGET_OS), macosx)
 826     LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
 827     LIBSPLASHSCREEN_CFLAGS += -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp
 828 
 829     BUILD_LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
 830     BUILD_LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
 831     BUILD_LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS := -x objective-c -O0
 832     BUILD_LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS := -x objective-c -O0
 833     BUILD_LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS := -x objective-c -O0
 834     BUILD_LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS := -x objective-c -O0
 835     BUILD_LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS := -O0
 836 
 837   else ifeq ($(OPENJDK_TARGET_OS), windows)
 838     LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
 839   else
 840     LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 $(X_CFLAGS)
 841   endif
 842 
 843   LIBSPLASHSCREEN_LIBS :=
 844 
 845   ifeq ($(USE_EXTERNAL_LIBZ), false)
 846     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.base/share/native/libzip/zlib
 847   else
 848     ifeq ($(OPENJDK_TARGET_OS), macosx)
 849       ifeq ($(USE_EXTERNAL_LIBPNG), false)
 850         # When building our own libpng and using an external libz, we need to
 851         # inject our own libz.h to tweak the exported ZLIB_VERNUM macro. See
 852         # $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng/zlib.h
 853         # for details.
 854         LIBSPLASHSCREEN_CFLAGS += -iquote $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng
 855       endif
 856     endif
 857   endif
 858 
 859   ifeq ($(OPENJDK_TARGET_OS), macosx)
 860     LIBSPLASHSCREEN_LIBS += \
 861         $(LIBM) -lpthread -liconv -losxapp \
 862         -framework ApplicationServices \
 863         -framework Foundation \
 864         -framework Cocoa \
 865         -framework JavaNativeFoundation
 866   else ifeq ($(OPENJDK_TARGET_OS), windows)
 867     LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
 868   else
 869     LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread -ldl
 870   endif
 871 
 872   $(eval $(call SetupJdkLibrary, BUILD_LIBSPLASHSCREEN, \
 873       NAME := splashscreen, \
 874       SRC := $(LIBSPLASHSCREEN_DIRS), \
 875       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
 876       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
 877       OPTIMIZATION := LOW, \
 878       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
 879           $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
 880       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result \
 881           maybe-uninitialized shift-negative-value implicit-fallthrough, \
 882       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
 883       DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
 884           E_STATEMENT_NOT_REACHED, \
 885       DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
 886       LDFLAGS := $(LDFLAGS_JDKLIB) \
 887           $(call SET_SHARED_LIBRARY_ORIGIN), \
 888       LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \
 889       LDFLAGS_windows := -delayload:user32.dll, \
 890       LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ_LIBS) \
 891           $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
 892       LIBS_aix := -liconv, \
 893   ))
 894 
 895   TARGETS += $(BUILD_LIBSPLASHSCREEN)
 896 
 897   ifeq ($(OPENJDK_TARGET_OS), macosx)
 898     $(BUILD_LIBSPLASHSCREEN): $(call FindLib, java.desktop, osxapp)
 899   endif
 900 
 901 endif
 902 
 903 ################################################################################
 904 
 905 ifeq ($(OPENJDK_TARGET_OS), macosx)
 906 
 907   LIBAWT_LWAWT_DIRS := \
 908       $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt \
 909       $(TOPDIR)/src/java.desktop/unix/native/common/awt \
 910       $(TOPDIR)/src/java.desktop/share/native/common/font \
 911       $(TOPDIR)/src/java.desktop/share/native/common/java2d \
 912       #
 913 
 914   LIBAWT_LWAWT_CFLAGS := \
 915       $(addprefix -I, $(LIBAWT_LWAWT_DIRS)) \
 916       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 917       -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
 918       -I$(TOPDIR)/src/java.desktop/unix/native/libawt_xawt/awt \
 919       -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/font \
 920       -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
 921       -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 922       -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 923       -I$(TOPDIR)/src/java.desktop/macosx/native/include \
 924       -I$(TOPDIR)/src/java.desktop/share/native/include \
 925       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
 926       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 927       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 928       -I$(TOPDIR)/src/java.desktop/unix/native/libawt/java2d \
 929       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
 930       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
 931       -I$(TOPDIR)/src/java.desktop/share/native/libmlib_image/ \
 932       -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
 933       $(LIBJAVA_HEADER_FLAGS) \
 934       #
 935 
 936   LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
 937   LIBAWT_LWAWT_EXCLUDES := $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib
 938 
 939   $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_LWAWT, \
 940       NAME := awt_lwawt, \
 941       SRC := $(LIBAWT_LWAWT_DIRS), \
 942       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
 943       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
 944       EXCLUDES := $(LIBAWT_LWAWT_EXCLUDES), \
 945       OPTIMIZATION := LOW, \
 946       CFLAGS := $(CFLAGS_JDKLIB) \
 947           $(X_CFLAGS) \
 948           $(X_LIBS) \
 949           $(LIBAWT_LWAWT_CFLAGS), \
 950       DISABLED_WARNINGS_clang := incomplete-implementation enum-conversion \
 951           deprecated-declarations objc-method-access bitwise-op-parentheses \
 952           incompatible-pointer-types parentheses-equality extra-tokens, \
 953       LDFLAGS := $(LDFLAGS_JDKLIB) \
 954           $(call SET_SHARED_LIBRARY_ORIGIN) \
 955           -L$(INSTALL_LIBRARIES_HERE), \
 956       LIBS := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
 957           -framework Accelerate \
 958           -framework ApplicationServices \
 959           -framework AudioToolbox \
 960           -framework Carbon \
 961           -framework Cocoa \
 962           -framework Security \
 963           -framework ExceptionHandling \
 964           -framework JavaNativeFoundation \
 965           -framework JavaRuntimeSupport \
 966           -framework OpenGL \
 967           -framework QuartzCore -ljava, \
 968   ))
 969 
 970   TARGETS += $(BUILD_LIBAWT_LWAWT)
 971 
 972   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
 973 
 974   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE)
 975 
 976   $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.desktop, osxapp)
 977 
 978   $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java)
 979 
 980 endif
 981 
 982 ################################################################################
 983 
 984 ifeq ($(OPENJDK_TARGET_OS), macosx)
 985 
 986   $(eval $(call SetupJdkLibrary, BUILD_LIBOSXUI, \
 987       NAME := osxui, \
 988       SRC := $(TOPDIR)/src/java.desktop/macosx/native/libosxui, \
 989       OPTIMIZATION := LOW, \
 990       CFLAGS := $(CFLAGS_JDKLIB) \
 991           -I$(TOPDIR)/src/java.desktop/macosx/native/libosxui \
 992           -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
 993           -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
 994           -I$(TOPDIR)/src/java.base/share/native/libjava \
 995           -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
 996           -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop,  \
 997       LDFLAGS := $(LDFLAGS_JDKLIB) \
 998           $(call SET_SHARED_LIBRARY_ORIGIN) \
 999           -Wl$(COMMA)-rpath$(COMMA)@loader_path \
1000           -L$(INSTALL_LIBRARIES_HERE), \
1001       LIBS := -lawt -losxapp -lawt_lwawt \
1002           -framework Cocoa \
1003           -framework Carbon \
1004           -framework ApplicationServices \
1005           -framework JavaNativeFoundation \
1006           -framework JavaRuntimeSupport \
1007           -ljava -ljvm, \
1008   ))
1009 
1010   TARGETS += $(BUILD_LIBOSXUI)
1011 
1012   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
1013 
1014   $(BUILD_LIBOSXUI): $(call FindLib, java.desktop, osxapp)
1015 
1016   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
1017 
1018 endif
1019 
1020 ################################################################################
1021 
1022 # Hook to include the corresponding custom file, if present.
1023 $(eval $(call IncludeCustomExtension, lib/Awt2dLibraries.gmk))
--- EOF ---