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 BUILD_LIBMLIB_IMAGE_MAPFILE := $(TOPDIR)/make/mapfiles/libmlib_image/mapfile-vers
  40 
  41 BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
  42 
  43 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
  44   BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
  45 endif
  46 
  47 ifneq ($(OPENJDK_TARGET_OS), windows)
  48   BUILD_LIBMLIB_LDLIBS += $(LIBM) $(LIBDL)
  49 endif
  50 
  51 $(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE, \
  52     NAME := mlib_image, \
  53     SRC := $(BUILD_LIBMLIB_SRC), \
  54     EXCLUDE_FILES := mlib_c_ImageBlendTable.c, \
  55     OPTIMIZATION := HIGHEST, \
  56     CFLAGS := $(CFLAGS_JDKLIB) \
  57         $(BUILD_LIBMLIB_CFLAGS), \
  58     MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
  59     LDFLAGS := $(LDFLAGS_JDKLIB) \
  60         $(call SET_SHARED_LIBRARY_ORIGIN), \
  61     LIBS := $(BUILD_LIBMLIB_LDLIBS) \
  62         $(JDKLIB_LIBS), \
  63 ))
  64 
  65 $(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
  66 
  67 TARGETS += $(BUILD_LIBMLIB_IMAGE)
  68 
  69 ################################################################################
  70 
  71 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
  72 
  73   LIBMLIB_IMAGE_V_SRC := $(TOPDIR)/src/java.desktop/share/native/libmlib_image \
  74       $(TOPDIR)/src/java.desktop/unix/native/libmlib_image \
  75       $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib \
  76       $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \
  77       #
  78   LIBMLIB_IMAGE_V_CFLAGS := $(TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il \
  79       $(addprefix -I, $(LIBMLIB_IMAGE_V_SRC)) \
  80       #
  81 
  82   BUILD_LIBMLIB_IMAGE_V_EXFILES := \
  83       awt_ImagingLib.c \
  84       mlib_c_ImageAffine_BC.c \
  85       mlib_c_ImageAffine_BC_S16.c \
  86       mlib_c_ImageAffine_BC_U16.c \
  87       mlib_c_ImageAffine_BL.c \
  88       mlib_c_ImageAffine_BL_S16.c \
  89       mlib_c_ImageAffine_BL_U16.c \
  90       mlib_c_ImageAffine_NN.c \
  91       mlib_c_ImageConvClearEdge.c \
  92       mlib_c_ImageConvCopyEdge.c \
  93       mlib_c_ImageConv_f.c \
  94       mlib_c_ImageConvVersion.c \
  95       mlib_c_ImageCopy.c \
  96       mlib_c_ImageLookUp.c \
  97       mlib_c_ImageLookUp_f.c \
  98       #
  99 
 100   LIBMLIB_IMAGE_V_CFLAGS += $(filter-out -DMLIB_NO_LIBSUNMATH, $(BUILD_LIBMLIB_CFLAGS))
 101 
 102   $(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE_V, \
 103       NAME := mlib_image_v, \
 104       SRC := $(LIBMLIB_IMAGE_V_SRC), \
 105       EXCLUDE_FILES := $(BUILD_LIBMLIB_IMAGE_V_EXFILES), \
 106       OPTIMIZATION := HIGHEST, \
 107       CFLAGS := -xarch=sparcvis \
 108           $(LIBMLIB_IMAGE_V_CFLAGS) \
 109           $(CFLAGS_JDKLIB), \
 110       MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
 111       LDFLAGS := $(LDFLAGS_JDKLIB) \
 112           $(call SET_SHARED_LIBRARY_ORIGIN), \
 113       LIBS := -ljava -ljvm $(BUILD_LIBMLIB_LDLIBS), \
 114   ))
 115 
 116   $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
 117 
 118   TARGETS += $(BUILD_LIBMLIB_IMAGE_V)
 119 
 120 endif
 121 
 122 ################################################################################
 123 
 124 LIBAWT_DIRS := $(TOPDIR)/src/java.desktop/share/native/libawt \
 125     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
 126     $(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 127     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 128     #
 129 
 130 ifeq ($(OPENJDK_TARGET_OS), aix)
 131   LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libawt
 132 endif
 133 
 134 ifeq ($(OPENJDK_TARGET_OS), windows)
 135   LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/awt/utility
 136 endif
 137 
 138 ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), )
 139   LIBAWT_EXFILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
 140 endif
 141 
 142 ifeq ($(OPENJDK_TARGET_OS), macosx)
 143   LIBAWT_EXFILES += initIDs.c awt/image/cvutils/img_colors.c
 144 endif
 145 
 146 LIBAWT_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 147     $(addprefix -I, $(shell find $(LIBAWT_DIRS) -type d)) \
 148     $(LIBJAVA_HEADER_FLAGS) \
 149     $(addprefix -I, $(BUILD_LIBMLIB_IMAGE_SRC)) \
 150     #
 151 
 152 LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS)
 153 
 154 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
 155   LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
 156   LIBAWT_CFLAGS += -xarch=sparcvis
 157 
 158   LIBAWT_CFLAGS += $(TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il
 159   LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib
 160   LIBAWT_EXFILES += java2d/loops/MapAccelFunc.c
 161 
 162   ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
 163     LIBAWT_ASFLAGS = -P -xarch=v9a
 164   else
 165     LIBAWT_ASFLAGS = -P -xarch=v8plusa
 166   endif
 167 else
 168   LIBAWT_EXCLUDES += \
 169       $(TOPDIR)/src/java.desktop/unix/native/libawt/awt/medialib \
 170       $(TOPDIR)/src/java.desktop/unix/native/libawt/java2d/loops \
 171       $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \
 172       #
 173 endif
 174 
 175 ifneq ($(OPENJDK_TARGET_OS), solaris)
 176   LIBAWT_CFLAGS += -DMLIB_NO_LIBSUNMATH
 177 endif
 178 
 179 ifeq ($(OPENJDK_TARGET_OS), windows)
 180   LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/font \
 181       $(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 182       $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt/systemscale \
 183   # Why does libawt need java.base headers?
 184   LIBAWT_CFLAGS += -I$(TOPDIR)/src/java.desktop/share/native/common/font \
 185       -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 186       -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
 187       -I$(TOPDIR)/src/java.desktop/windows/native/include \
 188       -I$(TOPDIR)/src/java.desktop/share/native/include \
 189       -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
 190       #
 191   LIBAWT_EXFILES += \
 192       java2d/d3d/D3DShaderGen.c \
 193       awt/image/cvutils/img_colors.c \
 194       #
 195 
 196   LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
 197   ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 198     LIBAWT_CFLAGS += -DMLIB_OS64BIT
 199   endif
 200 
 201   LIBAWT_RC_FLAGS ?= -I $(TOPDIR)/src/java.base/windows/native/launcher/icons
 202   LIBAWT_VERSIONINFO_RESOURCE := $(TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
 203 endif
 204 
 205 LIBAWT_MAPFILE := $(TOPDIR)/make/mapfiles/libawt/mapfile-vers
 206 ifeq ($(OPENJDK_TARGET_OS), linux)
 207   LIBAWT_MAPFILE :=

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