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