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