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         $(wildcard $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libawt_xawt) \
 273         $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
 274         $(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 275         $(TOPDIR)/src/java.desktop/share/native/common/awt/utility \
 276         $(TOPDIR)/src/java.desktop/share/native/common/font \
 277         $(TOPDIR)/src/java.desktop/share/native/common/java2d \
 278         $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d \
 279         $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 280         #
 281 
 282     ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
 283       LIBAWT_XAWT_DIRS += $(TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
 284     endif
 285 
 286     LIBAWT_XAWT_EXCLUDES := medialib
 287 
 288     LIBAWT_XAWT_CFLAGS := $(addprefix -I, $(shell $(FIND) $(LIBAWT_XAWT_DIRS) -type d)) \
 289         -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 290         -I$(TOPDIR)/src/java.desktop/share/native/include \
 291         -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
 292         -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
 293         -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 294         -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
 295         -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
 296         -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
 297         -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 298         -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
 299         -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
 300         $(LIBJAVA_HEADER_FLAGS)
 301         #
 302 
 303     LIBAWT_XAWT_CFLAGS += -DXAWT -DXAWT_HACK \
 304         -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
 305         $(FONTCONFIG_CFLAGS) \
 306         $(CUPS_CFLAGS)
 307 
 308     ifeq ($(OPENJDK_TARGET_OS), solaris)
 309       LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
 310     endif
 311 
 312     ifeq ($(OPENJDK_TARGET_OS), linux)
 313       ifeq ($(DISABLE_XRENDER), true)
 314         LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true
 315       endif
 316     endif
 317 
 318     LIBAWT_XAWT_LIBS := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm
 319 
 320     ifeq ($(OPENJDK_TARGET_OS), linux)
 321       LIBAWT_XAWT_LIBS += -lpthread
 322     endif
 323 
 324     ifeq ($(TOOLCHAIN_TYPE), gcc)
 325       # Turn off all warnings for the following files since they contain warnings
 326       # that cannot be turned of individually.
 327       # redefining a macro
 328       BUILD_LIBAWT_XAWT_gtk2_interface.c_CFLAGS := -w
 329       # comparison between pointer and integer
 330       BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
 331       # initializing a declared 'extern'
 332       BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
 333     endif
 334 
 335     $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_XAWT, \
 336         NAME := awt_xawt, \
 337         SRC := $(LIBAWT_XAWT_DIRS), \
 338         EXCLUDES := $(LIBAWT_XAWT_EXCLUDES), \
 339         OPTIMIZATION := LOW, \
 340         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
 341             $(X_CFLAGS), \
 342         WARNINGS_AS_ERRORS_xlc := false, \
 343         DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
 344             unused-result maybe-uninitialized format \
 345             format-security int-to-pointer-cast parentheses \
 346             implicit-fallthrough, \
 347         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
 348             E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
 349         LDFLAGS := $(LDFLAGS_JDKLIB) \
 350             $(call SET_SHARED_LIBRARY_ORIGIN) \
 351             -L$(INSTALL_LIBRARIES_HERE), \
 352         LIBS :=  $(X_LIBS) $(LIBAWT_XAWT_LIBS), \
 353         RC_FLAGS := $(RC_FLAGS) \
 354             -D "JDK_FNAME=xawt.dll" \
 355             -D "JDK_INTERNAL_NAME=xawt" \
 356             -D "JDK_FTYPE=0x2L", \
 357     ))
 358 
 359     $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
 360 
 361     $(BUILD_LIBAWT_XAWT): $(BUILD_LIBAWT)
 362 
 363     TARGETS += $(BUILD_LIBAWT_XAWT)
 364 
 365   endif
 366 endif
 367 
 368 ################################################################################
 369 
 370 LIBLCMS_SRC := $(TOPDIR)/src/java.desktop/share/native/liblcms
 371 LIBLCMS_CPPFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 372     -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 373     -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 374     $(LIBJAVA_HEADER_FLAGS) \
 375     #
 376 # The fast floor code loses precision.
 377 LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR
 378 
 379 ifeq ($(USE_EXTERNAL_LCMS), true)
 380   # If we're using an external library, we'll just need the wrapper part.
 381   # By including it explicitly, all other files will be excluded.
 382   BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
 383 else
 384   BUILD_LIBLCMS_INCLUDE_FILES :=
 385   # If we're using the bundled library, we'll need to include it in the
 386   # include path explicitly. Otherwise the system headers will be used.
 387   LIBLCMS_CPPFLAGS += $(addprefix -I, $(LIBLCMS_SRC))
 388 endif
 389 
 390 $(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \
 391     NAME := lcms, \
 392     SRC := $(LIBLCMS_SRC), \
 393     INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
 394     OPTIMIZATION := HIGHEST, \
 395     CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
 396         $(LIBLCMS_CPPFLAGS) \
 397         $(LCMS_CFLAGS), \
 398     CFLAGS_solaris := -xc99=no_lib, \
 399     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
 400     DISABLED_WARNINGS_gcc := format-nonliteral type-limits misleading-indentation, \
 401     DISABLED_WARNINGS_clang := tautological-compare, \
 402     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
 403     DISABLED_WARNINGS_microsoft := 4819, \
 404     LDFLAGS := $(LDFLAGS_JDKLIB) \
 405         $(call SET_SHARED_LIBRARY_ORIGIN), \
 406     LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 407     LIBS_unix := -lawt -ljvm -ljava $(LCMS_LIBS) $(LIBM), \
 408     LIBS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
 409 ))
 410 
 411 TARGETS += $(BUILD_LIBLCMS)
 412 
 413 $(BUILD_LIBLCMS): $(BUILD_LIBAWT)
 414 
 415 ################################################################################
 416 
 417 LIBJAVAJPEG_SRC += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
 418 
 419 # "DISABLED_WARNINGS_gcc := clobbered" rationale:
 420 # Suppress gcc warnings like "variable might be clobbered by 'longjmp'
 421 # or 'vfork'": this warning indicates that some variable is placed to
 422 # a register by optimized compiler and it's value might be lost on longjmp().
 423 # Recommended way to avoid such warning is to declare the variable as
 424 # volatile to prevent the optimization. However, this approach does not
 425 # work because we have to declare all variables as volatile in result.
 426 
 427 ifeq ($(USE_EXTERNAL_LIBJPEG), true)
 428   LIBJPEG_LIBS := -ljpeg
 429   BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
 430       imageioJPEG.c \
 431       jpegdecoder.c
 432   BUILD_LIBJAVAJPEG_HEADERS :=
 433 else
 434   LIBJPEG_LIBS :=
 435   BUILD_LIBJAVAJPEG_INCLUDE_FILES :=
 436   BUILD_LIBJAVAJPEG_HEADERS := $(addprefix -I, $(LIBJAVAJPEG_SRC))
 437 endif
 438 
 439 $(eval $(call SetupJdkLibrary, BUILD_LIBJAVAJPEG, \
 440     NAME := javajpeg, \
 441     SRC := $(LIBJAVAJPEG_SRC), \
 442     INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
 443     OPTIMIZATION := HIGHEST, \
 444     CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBJAVAJPEG_HEADERS) \
 445         $(LIBJAVA_HEADER_FLAGS) \
 446         -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
 447     DISABLED_WARNINGS_gcc := clobbered implicit-fallthrough shift-negative-value, \
 448     LDFLAGS := $(LDFLAGS_JDKLIB) \
 449         $(call SET_SHARED_LIBRARY_ORIGIN), \
 450     LIBS := $(LIBJPEG_LIBS) $(JDKLIB_LIBS), \
 451     LIBS_windows := $(WIN_JAVA_LIB) jvm.lib, \
 452 ))
 453 
 454 $(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java)
 455 
 456 TARGETS += $(BUILD_LIBJAVAJPEG)
 457 
 458 ################################################################################
 459 
 460 # Mac and Windows only use the native AWT lib, do not build libawt_headless
 461 ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
 462 
 463   LIBAWT_HEADLESS_DIRS := $(TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
 464       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 465       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d \
 466       $(TOPDIR)/src/java.desktop/share/native/common/java2d \
 467       $(TOPDIR)/src/java.desktop/share/native/common/font \
 468       #
 469 
 470   LIBAWT_HEADLESS_EXCLUDES := medialib
 471   LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 472       $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
 473       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
 474       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 475       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 476       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
 477       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
 478       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
 479       -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 480       -I$(TOPDIR)/src/java.desktop/share/native/common/font \
 481       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
 482       -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 483       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
 484       $(LIBJAVA_HEADER_FLAGS) \
 485       #
 486 
 487   $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_HEADLESS, \
 488       NAME := awt_headless, \
 489       SRC := $(LIBAWT_HEADLESS_DIRS), \
 490       EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
 491       OPTIMIZATION := LOW, \
 492       CFLAGS := $(CFLAGS_JDKLIB) \
 493           -DHEADLESS=true \
 494           -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
 495           $(CUPS_CFLAGS) \
 496           $(FONTCONFIG_CFLAGS) \
 497           $(X_CFLAGS) \
 498           $(LIBAWT_HEADLESS_CFLAGS), \
 499       DISABLED_WARNINGS_xlc := 1506-356, \
 500       DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
 501       LDFLAGS := $(LDFLAGS_JDKLIB) \
 502           $(call SET_SHARED_LIBRARY_ORIGIN), \
 503       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 504       LIBS_unix := -lawt -ljvm -ljava, \
 505       LIBS_linux := $(LIBM) $(LIBDL), \
 506       LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX), \
 507   ))
 508 
 509   # AIX warning explanation:
 510   # 1506-356 : (W) Compilation unit is empty.
 511   #            This happens during the headless build
 512 
 513   $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
 514 
 515   TARGETS += $(BUILD_LIBAWT_HEADLESS)
 516 
 517 endif
 518 
 519 ################################################################################
 520 
 521 ifeq ($(FREETYPE_TO_USE), system)
 522   LIBFREETYPE_CFLAGS := $(FREETYPE_CFLAGS)
 523   LIBFREETYPE_LIBS := $(FREETYPE_LIBS)
 524 else
 525   LIBFREETYPE_SRC := $(TOPDIR)/src/java.desktop/share/native/libfreetype
 526   BUILD_LIBFREETYPE_HEADERS := $(addprefix -I, $(LIBFREETYPE_SRC)/include)
 527   LIBFREETYPE_CFLAGS := $(BUILD_LIBFREETYPE_HEADERS)
 528   ifeq ($(OPENJDK_TARGET_OS), windows)
 529     LIBFREETYPE_LIBS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfreetype/freetype.lib
 530   else
 531     LIBFREETYPE_LIBS := -lfreetype
 532   endif
 533 
 534   $(eval $(call SetupJdkLibrary, BUILD_LIBFREETYPE, \
 535       NAME := freetype, \
 536       SRC := $(LIBFREETYPE_SRC)/src, \
 537       OPTIMIZATION := HIGHEST, \
 538       CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBFREETYPE_HEADERS) \
 539           -DFT2_BUILD_LIBRARY $(EXPORT_ALL_SYMBOLS), \
 540       DISABLED_WARNINGS_solstudio := \
 541          E_STATEMENT_NOT_REACHED \
 542          E_END_OF_LOOP_CODE_NOT_REACHED, \
 543       DISABLED_WARNINGS_microsoft := 4267 4244 4312, \
 544       LDFLAGS := $(LDFLAGS_JDKLIB) \
 545           $(call SET_SHARED_LIBRARY_ORIGIN), \
 546   ))
 547 
 548   TARGETS += $(BUILD_LIBFREETYPE)
 549 endif
 550 
 551 ###########################################################################
 552 
 553 LIBFONTMANAGER_SRC := $(TOPDIR)/src/java.desktop/share/native/libfontmanager \
 554     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
 555 LIBFONTMANAGER_CFLAGS := \
 556     $(addprefix -I, $(shell $(FIND) \
 557       $(LIBFONTMANAGER_SRC) \
 558       $(TOPDIR)/src/java.desktop/share/native/libawt \
 559       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
 560       $(TOPDIR)/src/java.desktop/share/native/common \
 561       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \
 562     -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 563     $(LIBJAVA_HEADER_FLAGS) \
 564     #
 565 
 566 #### Begin harfbuzz configuration
 567 
 568 HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN
 569 
 570 ifneq ($(OPENJDK_TARGET_OS), windows)
 571   HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
 572                       -DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H
 573 endif
 574 ifneq (, $(findstring $(OPENJDK_TARGET_OS), linux macosx))
 575   HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
 576 endif
 577 ifeq ($(OPENJDK_TARGET_OS), solaris)
 578   HARFBUZZ_CFLAGS += -DHAVE_SOLARIS_ATOMIC_OPS
 579 endif
 580 ifeq ($(OPENJDK_TARGET_OS), macosx)
 581   HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
 582 endif
 583 ifneq ($(OPENJDK_TARGET_OS), macosx)
 584   LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
 585 endif
 586 # hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
 587 LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
 588 
 589 LIBFONTMANAGER_CFLAGS += $(HARFBUZZ_CFLAGS)
 590 
 591 #### End harfbuzz configuration
 592 
 593 LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
 594 BUILD_LIBFONTMANAGER_FONTLIB += $(LIBFREETYPE_LIBS)
 595 
 596 LIBFONTMANAGER_OPTIMIZATION := HIGH
 597 
 598 ifeq ($(OPENJDK_TARGET_OS), windows)
 599   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
 600       X11TextRenderer.c
 601   LIBFONTMANAGER_OPTIMIZATION := HIGHEST
 602   LIBFONTMANAGER_CFLAGS += -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows
 603 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 604   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
 605       X11TextRenderer.c \
 606       fontpath.c \
 607       lcdglyph.c
 608 else
 609   LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
 610       lcdglyph.c
 611 endif
 612 
 613 LIBFONTMANAGER_CFLAGS += $(FONT_HEADERS) $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
 614 
 615 ifeq ($(TOOLCHAIN_TYPE), gcc)
 616   # Turn off all warnings for sunFont.c. This is needed because the specific warning
 617   # about discarding 'const' qualifier cannot be turned off individually.
 618   BUILD_LIBFONTMANAGER_sunFont.c_CFLAGS := -w
 619   # Turn off aliasing with GCC for ExtensionSubtables.cpp
 620   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 621 endif
 622 
 623 # LDFLAGS clarification:
 624 #   Filter relevant linker flags disallowing unresolved symbols as we cannot
 625 #   build-time decide to which library to link against (libawt_headless or
 626 #   libawt_xawt). See JDK-8196516 for details.
 627 $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
 628     NAME := fontmanager, \
 629     SRC := $(LIBFONTMANAGER_SRC), \
 630     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
 631         AccelGlyphCache.c, \
 632     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 633     CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
 634     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
 635     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
 636     CFLAGS_windows = -DCC_NOEX, \
 637     WARNINGS_AS_ERRORS_xlc := false, \
 638     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
 639         type-limits missing-field-initializers implicit-fallthrough, \
 640     DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
 641         maybe-uninitialized, \
 642     DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
 643         tautological-constant-out-of-range-compare int-to-pointer-cast, \
 644     DISABLED_WARNINGS_C_solstudio = \
 645         E_INTEGER_OVERFLOW_DETECTED \
 646         E_ARG_INCOMPATIBLE_WITH_ARG_L \
 647         E_ENUM_VAL_OVERFLOWS_INT_MAX, \
 648     DISABLED_WARNINGS_CXX_solstudio := \
 649         truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
 650         hidevf w_novirtualdescr arrowrtn2, \
 651     DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334 4819 4101, \
 652     LDFLAGS := $(subst -Xlinker -z -Xlinker defs,, \
 653         $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB))) $(LDFLAGS_CXX_JDK) \
 654         $(call SET_SHARED_LIBRARY_ORIGIN), \
 655     LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 656     LDFLAGS_aix := -Wl$(COMMA)-berok, \
 657     LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
 658     LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
 659     LIBS_macosx := -lawt_lwawt -framework CoreText -framework CoreFoundation \
 660         -framework CoreGraphics, \
 661     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
 662         $(WIN_AWT_LIB), \
 663 ))
 664 
 665 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 666 
 667 ifeq ($(OPENJDK_TARGET_OS), macosx)
 668   $(BUILD_LIBFONTMANAGER): $(call FindLib, java.desktop, awt_lwawt)
 669 endif
 670 
 671 ifeq ($(FREETYPE_TO_USE), bundled)
 672   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBFREETYPE)
 673 endif
 674 
 675 TARGETS += $(BUILD_LIBFONTMANAGER)
 676 
 677 ################################################################################
 678 
 679 ifeq ($(OPENJDK_TARGET_OS), windows)
 680   LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 681   LIBJAWT_CFLAGS := -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \
 682       -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 683       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 684       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 685       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \
 686       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 687       -I$(TOPDIR)/src/java.desktop/windows/native/include \
 688       -I$(TOPDIR)/src/java.desktop/share/native/include \
 689       $(LIBJAVA_HEADER_FLAGS) \
 690       #
 691 
 692   ifeq ($(OPENJDK_TARGET_CPU), x86)
 693     KERNEL32_LIB := kernel32.lib
 694   endif
 695   $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \
 696       NAME := jawt, \
 697       SRC := $(LIBJAWT_SRC), \
 698       INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES), \
 699       OPTIMIZATION := LOW, \
 700       CFLAGS := $(CXXFLAGS_JDKLIB) \
 701           -EHsc -DUNICODE -D_UNICODE \
 702           $(LIBJAWT_CFLAGS), \
 703       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
 704       LIBS := $(JDKLIB_LIBS) $(KERNEL32_LIB) advapi32.lib $(WIN_AWT_LIB), \
 705   ))
 706 
 707   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
 708 
 709   $(eval $(call SetupCopyFiles, COPY_JAWT_LIB, \
 710       FILES := $(BUILD_LIBJAWT_IMPORT_LIBRARY), \
 711       DEST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
 712   ))
 713 
 714   $(COPY_JAWT_LIB): $(BUILD_LIBJAWT)
 715 
 716   TARGETS += $(COPY_JAWT_LIB)
 717 
 718 else # OPENJDK_TARGET_OS not windows
 719 
 720   ifeq ($(OPENJDK_TARGET_OS), macosx)
 721     LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libjawt
 722   else
 723     LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 724   endif
 725   LIBJAWT_CFLAGS := \
 726       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 727       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
 728       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
 729       -I$(TOPDIR)/src/java.desktop/share/native/include \
 730       $(LIBJAVA_HEADER_FLAGS) \
 731       #
 732 
 733   ifeq ($(OPENJDK_TARGET_OS), macosx)
 734     JAWT_LIBS := -lawt_lwawt
 735   else
 736     JAWT_LIBS :=
 737     ifneq ($(OPENJDK_TARGET_OS), solaris)
 738       JAWT_LIBS += -lawt
 739     endif
 740     ifeq ($(ENABLE_HEADLESS_ONLY), false)
 741       JAWT_LIBS += -lawt_xawt
 742     else
 743       JAWT_LIBS += -lawt_headless
 744       HEADLESS_CFLAG += -DHEADLESS
 745     endif
 746   endif
 747 
 748   $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \
 749       NAME := jawt, \
 750       SRC := $(LIBJAWT_SRC), \
 751       INCLUDE_FILES := $(JAWT_FILES), \
 752       OPTIMIZATION := LOW, \
 753       CFLAGS := $(CFLAGS_JDKLIB) \
 754           $(LIBJAWT_CFLAGS), \
 755       CFLAGS_linux := $(HEADLESS_CFLAG), \
 756       CFLAGS_macosx := $(LIBJAWT_CFLAGS_macosx), \
 757       LDFLAGS := $(LDFLAGS_JDKLIB) \
 758           $(call SET_SHARED_LIBRARY_ORIGIN), \
 759       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 760       LDFLAGS_macosx := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \
 761       LIBS_unix := $(JAWT_LIBS) $(JDKLIB_LIBS), \
 762       LIBS_solaris := $(X_LIBS) -lXrender, \
 763       LIBS_macosx := -framework Cocoa, \
 764   ))
 765 
 766   ifeq ($(ENABLE_HEADLESS_ONLY), false)
 767     $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
 768   else
 769     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
 770   endif
 771 
 772   ifeq ($(OPENJDK_TARGET_OS), macosx)
 773     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
 774   endif
 775 
 776 endif # OPENJDK_TARGET_OS
 777 
 778 TARGETS += $(BUILD_LIBJAWT)
 779 
 780 ################################################################################
 781 
 782 ifeq ($(ENABLE_HEADLESS_ONLY), false)
 783 
 784   LIBSPLASHSCREEN_DIRS := \
 785       $(TOPDIR)/src/java.desktop/share/native/libjavajpeg \
 786       $(TOPDIR)/src/java.desktop/share/native/libsplashscreen \
 787       #
 788 
 789   ifeq ($(USE_EXTERNAL_LIBGIF), true)
 790     GIFLIB_LIBS := -lgif
 791     LIBSPLASHSCREEN_EXCLUDES := giflib
 792   else
 793     LIBSPLASHSCREEN_CFLAGS += -I$(TOPDIR)/src/java.desktop/share/native/libsplashscreen/giflib
 794   endif
 795 
 796   ifeq ($(USE_EXTERNAL_LIBJPEG), true)
 797     LIBJPEG_LIBS := -ljpeg
 798   else
 799     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
 800     LIBJPEG_CFLAGS := -I$(TOPDIR)/src/java.desktop/share/native/libjavajpeg
 801   endif
 802 
 803   ifeq ($(USE_EXTERNAL_LIBPNG), false)
 804     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/share/native/libsplashscreen/libpng
 805   else
 806     LIBSPLASHSCREEN_EXCLUDES += libpng
 807   endif
 808 
 809   ifneq ($(OPENJDK_TARGET_OS), macosx)
 810     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen
 811   else
 812     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen
 813   endif
 814 
 815   ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
 816     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
 817   endif
 818 
 819   ifeq ($(OPENJDK_TARGET_OS), windows)
 820     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/windows/native/common/awt/systemscale
 821   endif
 822   LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0 \
 823       $(addprefix -I, $(LIBSPLASHSCREEN_DIRS)) \
 824       $(LIBJAVA_HEADER_FLAGS) \
 825       #
 826 
 827   ifeq ($(OPENJDK_TARGET_OS), macosx)
 828     LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
 829     LIBSPLASHSCREEN_CFLAGS += -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp
 830 
 831     BUILD_LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
 832     BUILD_LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
 833     BUILD_LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS := -x objective-c -O0
 834     BUILD_LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS := -x objective-c -O0
 835     BUILD_LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS := -x objective-c -O0
 836     BUILD_LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS := -x objective-c -O0
 837     BUILD_LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS := -O0
 838 
 839   else ifeq ($(OPENJDK_TARGET_OS), windows)
 840     LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
 841   else
 842     LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 $(X_CFLAGS)
 843   endif
 844 
 845   LIBSPLASHSCREEN_LIBS :=
 846 
 847   ifeq ($(USE_EXTERNAL_LIBZ), false)
 848     LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.base/share/native/libzip/zlib
 849   else
 850     ifeq ($(OPENJDK_TARGET_OS), macosx)
 851       ifeq ($(USE_EXTERNAL_LIBPNG), false)
 852         # When building our own libpng and using an external libz, we need to
 853         # inject our own libz.h to tweak the exported ZLIB_VERNUM macro. See
 854         # $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng/zlib.h
 855         # for details.
 856         LIBSPLASHSCREEN_CFLAGS += -iquote $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng
 857       endif
 858     endif
 859   endif
 860 
 861   ifeq ($(OPENJDK_TARGET_OS), macosx)
 862     LIBSPLASHSCREEN_LIBS += \
 863         $(LIBM) -lpthread -liconv -losxapp \
 864         -framework ApplicationServices \
 865         -framework Foundation \
 866         -framework Cocoa \
 867         -framework JavaNativeFoundation
 868   else ifeq ($(OPENJDK_TARGET_OS), windows)
 869     LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
 870   else
 871     LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread -ldl
 872   endif
 873 
 874   $(eval $(call SetupJdkLibrary, BUILD_LIBSPLASHSCREEN, \
 875       NAME := splashscreen, \
 876       SRC := $(LIBSPLASHSCREEN_DIRS), \
 877       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
 878       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
 879       OPTIMIZATION := LOW, \
 880       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
 881           $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
 882       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result \
 883           maybe-uninitialized shift-negative-value implicit-fallthrough, \
 884       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
 885       DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
 886           E_STATEMENT_NOT_REACHED, \
 887       DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
 888       LDFLAGS := $(LDFLAGS_JDKLIB) \
 889           $(call SET_SHARED_LIBRARY_ORIGIN), \
 890       LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \
 891       LDFLAGS_windows := -delayload:user32.dll, \
 892       LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ_LIBS) \
 893           $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
 894       LIBS_aix := -liconv, \
 895   ))
 896 
 897   TARGETS += $(BUILD_LIBSPLASHSCREEN)
 898 
 899   ifeq ($(OPENJDK_TARGET_OS), macosx)
 900     $(BUILD_LIBSPLASHSCREEN): $(call FindLib, java.desktop, osxapp)
 901   endif
 902 
 903 endif
 904 
 905 ################################################################################
 906 
 907 ifeq ($(OPENJDK_TARGET_OS), macosx)
 908 
 909   LIBAWT_LWAWT_DIRS := \
 910       $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt \
 911       $(TOPDIR)/src/java.desktop/unix/native/common/awt \
 912       $(TOPDIR)/src/java.desktop/share/native/common/font \
 913       $(TOPDIR)/src/java.desktop/share/native/common/java2d \
 914       #
 915 
 916   LIBAWT_LWAWT_CFLAGS := \
 917       $(addprefix -I, $(LIBAWT_LWAWT_DIRS)) \
 918       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 919       -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
 920       -I$(TOPDIR)/src/java.desktop/unix/native/libawt_xawt/awt \
 921       -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/font \
 922       -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
 923       -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 924       -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 925       -I$(TOPDIR)/src/java.desktop/macosx/native/include \
 926       -I$(TOPDIR)/src/java.desktop/share/native/include \
 927       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
 928       -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 929       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 930       -I$(TOPDIR)/src/java.desktop/unix/native/libawt/java2d \
 931       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
 932       -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
 933       -I$(TOPDIR)/src/java.desktop/share/native/libmlib_image/ \
 934       -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
 935       $(LIBJAVA_HEADER_FLAGS) \
 936       #
 937 
 938   LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
 939   LIBAWT_LWAWT_EXCLUDES := $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib
 940 
 941   $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_LWAWT, \
 942       NAME := awt_lwawt, \
 943       SRC := $(LIBAWT_LWAWT_DIRS), \
 944       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
 945       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
 946       EXCLUDES := $(LIBAWT_LWAWT_EXCLUDES), \
 947       OPTIMIZATION := LOW, \
 948       CFLAGS := $(CFLAGS_JDKLIB) \
 949           $(X_CFLAGS) \
 950           $(X_LIBS) \
 951           $(LIBAWT_LWAWT_CFLAGS), \
 952       DISABLED_WARNINGS_clang := incomplete-implementation enum-conversion \
 953           deprecated-declarations objc-method-access bitwise-op-parentheses \
 954           incompatible-pointer-types parentheses-equality extra-tokens, \
 955       LDFLAGS := $(LDFLAGS_JDKLIB) \
 956           $(call SET_SHARED_LIBRARY_ORIGIN) \
 957           -L$(INSTALL_LIBRARIES_HERE), \
 958       LIBS := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
 959           -framework Accelerate \
 960           -framework ApplicationServices \
 961           -framework AudioToolbox \
 962           -framework Carbon \
 963           -framework Cocoa \
 964           -framework Security \
 965           -framework ExceptionHandling \
 966           -framework JavaNativeFoundation \
 967           -framework JavaRuntimeSupport \
 968           -framework OpenGL \
 969           -framework QuartzCore -ljava, \
 970   ))
 971 
 972   TARGETS += $(BUILD_LIBAWT_LWAWT)
 973 
 974   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
 975 
 976   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE)
 977 
 978   $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.desktop, osxapp)
 979 
 980   $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java)
 981 
 982 endif
 983 
 984 ################################################################################
 985 
 986 ifeq ($(OPENJDK_TARGET_OS), macosx)
 987 
 988   $(eval $(call SetupJdkLibrary, BUILD_LIBOSXUI, \
 989       NAME := osxui, \
 990       SRC := $(TOPDIR)/src/java.desktop/macosx/native/libosxui, \
 991       OPTIMIZATION := LOW, \
 992       CFLAGS := $(CFLAGS_JDKLIB) \
 993           -I$(TOPDIR)/src/java.desktop/macosx/native/libosxui \
 994           -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
 995           -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
 996           -I$(TOPDIR)/src/java.base/share/native/libjava \
 997           -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
 998           -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop,  \
 999       DISABLED_WARNINGS_clang := deprecated-declarations, \
1000       LDFLAGS := $(LDFLAGS_JDKLIB) \
1001           $(call SET_SHARED_LIBRARY_ORIGIN) \
1002           -Wl$(COMMA)-rpath$(COMMA)@loader_path \
1003           -L$(INSTALL_LIBRARIES_HERE), \
1004       LIBS := -lawt -losxapp -lawt_lwawt \
1005           -framework Cocoa \
1006           -framework Carbon \
1007           -framework ApplicationServices \
1008           -framework JavaNativeFoundation \
1009           -framework JavaRuntimeSupport \
1010           -ljava -ljvm, \
1011   ))
1012 
1013   TARGETS += $(BUILD_LIBOSXUI)
1014 
1015   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
1016 
1017   $(BUILD_LIBOSXUI): $(call FindLib, java.desktop, osxapp)
1018 
1019   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
1020 
1021 endif
1022 
1023 ################################################################################
1024 
1025 # Hook to include the corresponding custom file, if present.
1026 $(eval $(call IncludeCustomExtension, lib/Awt2dLibraries.gmk))