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