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_ImageAffine_NN.c \
 100       mlib_c_ImageConvClearEdge.c \
 101       mlib_c_ImageConvCopyEdge.c \
 102       mlib_c_ImageConv_f.c \
 103       mlib_c_ImageConvVersion.c \
 104       mlib_c_ImageCopy.c \
 105       mlib_c_ImageLookUp.c \
 106       mlib_c_ImageLookUp_f.c \
 107       #
 108 
 109   LIBMLIB_IMAGE_V_CFLAGS += $(filter-out -DMLIB_NO_LIBSUNMATH, $(BUILD_LIBMLIB_CFLAGS))
 110 
 111   $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE_V, \
 112       LIBRARY := mlib_image_v, \
 113       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 114       SRC := $(LIBMLIB_IMAGE_V_SRC), \
 115       EXCLUDE_FILES := $(BUILD_LIBMLIB_IMAGE_V_EXFILES), \
 116       OPTIMIZATION := HIGHEST, \
 117       CFLAGS := -xarch=sparcvis \
 118           $(LIBMLIB_IMAGE_V_CFLAGS) \
 119           $(CFLAGS_JDKLIB), \
 120       DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
 121       MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
 122       LDFLAGS := $(LDFLAGS_JDKLIB) \
 123           $(call SET_SHARED_LIBRARY_ORIGIN), \
 124       LIBS := -ljava -ljvm -lc $(BUILD_LIBMLIB_LDLIBS), \
 125       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image_v, \
 126   ))
 127 
 128   $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
 129 
 130   TARGETS += $(BUILD_LIBMLIB_IMAGE_V)
 131 
 132 endif
 133 
 134 ################################################################################
 135 
 136 LIBAWT_DIRS := $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \
 137     $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
 138     $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 139     $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 140     #
 141 
 142 ifeq ($(OPENJDK_TARGET_OS), aix)
 143   LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libawt
 144 endif
 145 
 146 ifeq ($(OPENJDK_TARGET_OS), windows)
 147   LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility
 148 else
 149   LIBAWT_EXFILES := java2d/ShaderList.c
 150 endif
 151 
 152 ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), )
 153   LIBAWT_EXFILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
 154 endif
 155 
 156 ifeq ($(OPENJDK_TARGET_OS), macosx)
 157   LIBAWT_EXFILES += initIDs.c awt/image/cvutils/img_colors.c
 158 endif
 159 
 160 LIBAWT_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 161     $(addprefix -I, $(shell find $(LIBAWT_DIRS) -type d)) \
 162     $(LIBJAVA_HEADER_FLAGS) \
 163     $(addprefix -I, $(BUILD_LIBMLIB_IMAGE_SRC)) \
 164     #
 165 
 166 LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS)
 167 
 168 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
 169   LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
 170   LIBAWT_CFLAGS += -xarch=sparcvis
 171 
 172   LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il
 173   LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/medialib
 174   LIBAWT_EXFILES += java2d/loops/MapAccelFunc.c
 175 
 176   ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
 177     LIBAWT_ASFLAGS = -P -xarch=v9a
 178   else
 179     LIBAWT_ASFLAGS = -P -xarch=v8plusa
 180   endif
 181 else
 182   LIBAWT_EXCLUDES += \
 183       $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/awt/medialib \
 184       $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/java2d/loops \
 185       $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \
 186       #
 187 endif
 188 
 189 ifneq ($(OPENJDK_TARGET_OS), solaris)
 190   LIBAWT_CFLAGS += -DMLIB_NO_LIBSUNMATH
 191 endif
 192 
 193 ifeq ($(OPENJDK_TARGET_OS), windows)
 194   LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
 195       $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 196       $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt/systemscale \
 197   # Why does libawt need java.base headers?
 198   LIBAWT_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
 199       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 200       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
 201       -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
 202       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 203       -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
 204       #
 205   LIBAWT_EXFILES += \
 206       java2d/d3d/D3DShaderGen.c \
 207       awt/image/cvutils/img_colors.c \
 208       #
 209 
 210   LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
 211   ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 212     LIBAWT_CFLAGS += -DMLIB_OS64BIT
 213   endif
 214 
 215   ifdef OPENJDK
 216     LIBAWT_RC_FLAGS := -I $(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons
 217   else
 218     LIBAWT_RC_FLAGS := -I $(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons
 219   endif
 220   LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
 221 endif
 222 
 223 LIBAWT_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt/mapfile-vers
 224 ifeq ($(OPENJDK_TARGET_OS), linux)
 225   LIBAWT_MAPFILE :=
 226 endif
 227 
 228 # Turn off all warnings for debug_mem.c This is needed because the specific warning
 229 # about initializing a declared 'extern' cannot be turned off individually. Only
 230 # applies to debug builds.
 231 ifeq ($(TOOLCHAIN_TYPE), gcc)
 232   BUILD_LIBAWT_debug_mem.c_CFLAGS := -w
 233 endif
 234 
 235 $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
 236     LIBRARY := awt, \
 237     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 238     SRC := $(LIBAWT_DIRS), \
 239     EXCLUDES := $(LIBAWT_EXCLUDES), \
 240     EXCLUDE_FILES := $(LIBAWT_EXFILES), \
 241     OPTIMIZATION := LOW, \
 242     CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
 243     DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
 244         format-nonliteral parentheses, \
 245     DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
 246     DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
 247     DISABLED_WARNINGS_microsoft := 4297 4244 4267 4996, \
 248     ASFLAGS := $(LIBAWT_ASFLAGS), \
 249     MAPFILE := $(LIBAWT_MAPFILE), \
 250     LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
 251     LDFLAGS_macosx := -L$(INSTALL_LIBRARIES_HERE), \
 252     LDFLAGS_windows := -delayload:user32.dll -delayload:gdi32.dll \
 253         -delayload:shell32.dll -delayload:winmm.dll \
 254         -delayload:winspool.drv -delayload:imm32.dll \
 255         -delayload:ole32.dll -delayload:comdlg32.dll \
 256         -delayload:comctl32.dll -delayload:shlwapi.dll, \
 257     LIBS_unix := -ljvm -ljava $(LIBM), \
 258     LIBS_linux :=  $(LIBDL), \
 259     LIBS_solaris := $(LIBDL) -lc, \
 260     LIBS_aix := $(LIBDL),\
 261     LIBS_macosx := -lmlib_image \
 262         -framework Cocoa \
 263         -framework OpenGL \
 264         -framework JavaNativeFoundation \
 265         -framework JavaRuntimeSupport \
 266         -framework ApplicationServices \
 267         -framework AudioToolbox, \
 268     LIBS_windows := kernel32.lib user32.lib gdi32.lib winspool.lib \
 269         imm32.lib ole32.lib uuid.lib shell32.lib \
 270         comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
 271         delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib, \
 272     VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
 273     RC_FLAGS := $(RC_FLAGS) $(LIBAWT_RC_FLAGS) \
 274         -D "JDK_FNAME=awt.dll" \
 275         -D "JDK_INTERNAL_NAME=awt" \
 276         -D "JDK_FTYPE=0x2L", \
 277     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt, \
 278 ))
 279 
 280 $(BUILD_LIBAWT): $(call FindLib, java.base, java)
 281 
 282 ifeq ($(OPENJDK_TARGET_OS), macosx)
 283   $(BUILD_LIBAWT): $(BUILD_LIBMLIB_IMAGE)
 284 endif
 285 
 286 TARGETS += $(BUILD_LIBAWT)
 287 
 288 ################################################################################
 289 
 290 ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
 291   ifndef BUILD_HEADLESS_ONLY
 292 
 293     LIBAWT_XAWT_DIRS := \
 294         $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
 295         $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 296         $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility \
 297         $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
 298         $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 299         $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
 300         $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
 301         $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 302         #
 303 
 304     ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
 305       LIBAWT_XAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
 306     endif
 307 
 308     LIBAWT_XAWT_EXCLUDES := medialib
 309 
 310     LIBAWT_XAWT_CFLAGS := $(addprefix -I, $(shell $(FIND) $(LIBAWT_XAWT_DIRS) -type d)) \
 311         -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 312         -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 313         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
 314         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
 315         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 316         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
 317         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
 318         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
 319         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 320         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
 321         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga \
 322         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
 323         $(LIBJAVA_HEADER_FLAGS)
 324         #
 325 
 326     LIBAWT_XAWT_CFLAGS += -DXAWT -DXAWT_HACK \
 327         -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
 328         $(CUPS_CFLAGS)
 329 
 330     ifeq ($(OPENJDK_TARGET_OS), solaris)
 331       LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
 332     endif
 333 
 334     ifeq ($(OPENJDK_TARGET_OS), linux)
 335       ifeq ($(DISABLE_XRENDER), true)
 336         LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true
 337       endif
 338     endif
 339 
 340     LIBAWT_XAWT_LIBS := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
 341 
 342     ifeq ($(OPENJDK_TARGET_OS), linux)
 343       LIBAWT_XAWT_LIBS += -lpthread
 344     endif
 345 
 346     ifeq ($(TOOLCHAIN_TYPE), gcc)
 347       # Turn off all warnings for the following files since they contain warnings
 348       # that cannot be turned of individually.
 349       # redefining a macro
 350       BUILD_LIBAWT_XAWT_gtk2_interface.c_CFLAGS := -w
 351       # comparison between pointer and integer
 352       BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
 353       # initializing a declared 'extern'
 354       BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
 355       # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED)
 356       BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w
 357    endif
 358 
 359     $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
 360         LIBRARY := awt_xawt, \
 361         OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 362         SRC := $(LIBAWT_XAWT_DIRS), \
 363         EXCLUDES := $(LIBAWT_XAWT_EXCLUDES), \
 364         OPTIMIZATION := LOW, \
 365         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
 366             $(X_CFLAGS), \
 367         WARNINGS_AS_ERRORS_xlc := false, \
 368         DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
 369             deprecated-declarations unused-result maybe-uninitialized format \
 370             format-security int-to-pointer-cast parentheses, \
 371         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
 372             E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
 373         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \
 374         LDFLAGS := $(LDFLAGS_JDKLIB) \
 375             $(call SET_SHARED_LIBRARY_ORIGIN) \
 376             $(call SET_SHARED_LIBRARY_ORIGIN,/..) \
 377             -L$(INSTALL_LIBRARIES_HERE), \
 378         LIBS :=  $(X_LIBS) $(LIBAWT_XAWT_LIBS), \
 379         VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 380         RC_FLAGS := $(RC_FLAGS) \
 381             -D "JDK_FNAME=xawt.dll" \
 382             -D "JDK_INTERNAL_NAME=xawt" \
 383             -D "JDK_FTYPE=0x2L", \
 384         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_xawt, \
 385     ))
 386 
 387     $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
 388 
 389     $(BUILD_LIBAWT_XAWT): $(BUILD_LIBAWT)
 390 
 391     TARGETS += $(BUILD_LIBAWT_XAWT)
 392 
 393   endif
 394 endif
 395 
 396 ################################################################################
 397 
 398 LIBLCMS_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/liblcms
 399 LIBLCMS_CPPFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 400     -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 401     -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 402     $(LIBJAVA_HEADER_FLAGS) \
 403     #
 404 # The fast floor code loses precision.
 405 LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR
 406 
 407 # Avoid warning for GCC 6
 408 ifeq ($(TOOLCHAIN_TYPE), gcc)
 409   LCMS_CFLAGS += -Wno-misleading-indentation
 410 endif
 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_xlc := 1506-356, \
 586         DISABLED_WARNINGS_gcc := maybe-uninitialized int-to-pointer-cast, \
 587         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
 588             E_EMPTY_TRANSLATION_UNIT, \
 589         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
 590         LDFLAGS := $(LDFLAGS_JDKLIB) \
 591             $(call SET_SHARED_LIBRARY_ORIGIN), \
 592         LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 593         LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 594         LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 595         REORDER := $(LIBAWT_HEADLESS_REORDER), \
 596         LIBS_unix := -lawt -ljvm -ljava, \
 597         LIBS_linux := $(LIBM) $(LIBDL), \
 598         LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \
 599         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
 600     ))
 601 
 602     # AIX warning explanation:
 603     # 1506-356 : (W) Compilation unit is empty.
 604     #            This happens during the headless build
 605 
 606     $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
 607 
 608     TARGETS += $(BUILD_LIBAWT_HEADLESS)
 609 
 610   endif
 611 endif
 612 
 613 ################################################################################
 614 
 615 LIBFONTMANAGER_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libfontmanager \
 616     $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
 617 LIBFONTMANAGER_CFLAGS := \
 618     $(addprefix -I, $(shell $(FIND) \
 619       $(LIBFONTMANAGER_SRC) \
 620       $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \
 621       $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
 622       $(JDK_TOPDIR)/src/java.desktop/share/native/common \
 623       $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \
 624     -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 625     $(LIBJAVA_HEADER_FLAGS) \
 626     #
 627 
 628 #### Begin harfbuzz configuration
 629 
 630 HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN
 631 
 632 ifneq ($(OPENJDK_TARGET_OS), windows)
 633   HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
 634                       -DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H
 635 endif
 636 ifneq (, $(findstring $(OPENJDK_TARGET_OS), linux macosx))
 637   HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
 638 endif
 639 ifeq ($(OPENJDK_TARGET_OS), solaris)
 640   HARFBUZZ_CFLAGS += -DHAVE_SOLARIS_ATOMIC_OPS
 641 endif
 642 ifeq ($(OPENJDK_TARGET_OS), macosx)
 643   HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
 644 endif
 645 ifneq ($(OPENJDK_TARGET_OS), macosx)
 646   LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
 647 endif
 648 # hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
 649 LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
 650 
 651 LIBFONTMANAGER_CFLAGS += $(HARFBUZZ_CFLAGS)
 652 
 653 #### End harfbuzz configuration
 654 
 655 ifndef OPENJDK
 656   LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/closed/java.desktop/share/native/libt2k
 657   BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libfontmanager/mapfile-vers
 658   LIBFONTMANAGER_EXCLUDE_FILES += freetypeScaler.c
 659 else
 660   LIBFONTMANAGER_CFLAGS += $(FREETYPE_CFLAGS)
 661   BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libfontmanager/mapfile-vers.openjdk
 662   BUILD_LIBFONTMANAGER_FONTLIB := $(FREETYPE_LIBS)
 663 endif
 664 
 665 LIBFONTMANAGER_OPTIMIZATION := HIGH
 666 
 667 ifeq ($(OPENJDK_TARGET_OS), windows)
 668   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
 669       X11TextRenderer.c
 670   LIBFONTMANAGER_OPTIMIZATION := HIGHEST
 671   LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows
 672 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 673   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
 674       X11TextRenderer.c \
 675       fontpath.c \
 676       lcdglyph.c
 677 else
 678   LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
 679       lcdglyph.c
 680 endif
 681 
 682 LIBFONTMANAGER_CFLAGS += $(FONT_HEADERS) $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
 683 
 684 ifeq ($(TOOLCHAIN_TYPE), gcc)
 685   # Turn off all warnings for sunFont.c. This is needed because the specific warning
 686   # about discarding 'const' qualifier cannot be turned off individually.
 687   BUILD_LIBFONTMANAGER_sunFont.c_CFLAGS := -w
 688   # Turn off aliasing with GCC for ExtensionSubtables.cpp
 689   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 690 endif
 691 
 692 $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
 693     LIBRARY := fontmanager, \
 694     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 695     SRC := $(LIBFONTMANAGER_SRC), \
 696     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
 697         AccelGlyphCache.c, \
 698     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 699     CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
 700     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
 701     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
 702     CFLAGS_windows = -DCC_NOEX, \
 703     WARNINGS_AS_ERRORS_xlc := false, \
 704     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
 705         type-limits missing-field-initializers, \
 706     DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
 707         maybe-uninitialized, \
 708     DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
 709         tautological-constant-out-of-range-compare int-to-pointer-cast, \
 710     DISABLED_WARNINGS_C_solstudio = \
 711         E_INTEGER_OVERFLOW_DETECTED \
 712         E_ARG_INCOMPATIBLE_WITH_ARG_L \
 713         E_ENUM_VAL_OVERFLOWS_INT_MAX, \
 714     DISABLED_WARNINGS_CXX_solstudio := \
 715         truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
 716         hidevf w_novirtualdescr arrowrtn2, \
 717     DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334, \
 718     MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
 719     LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
 720         $(call SET_SHARED_LIBRARY_ORIGIN), \
 721     LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 722     LDFLAGS_macosx := -undefined dynamic_lookup, \
 723     LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
 724     LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
 725     LIBS_linux := -lc, \
 726     LIBS_solaris := -lawt_headless -lc, \
 727     LIBS_aix := -lawt_headless,\
 728     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
 729         $(WIN_AWT_LIB), \
 730     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 731     RC_FLAGS := $(RC_FLAGS) \
 732         -D "JDK_FNAME=fontmanager.dll" \
 733         -D "JDK_INTERNAL_NAME=fontmanager" \
 734         -D "JDK_FTYPE=0x2L", \
 735     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
 736 ))
 737 
 738 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 739 
 740 ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
 741   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
 742 endif
 743 
 744 TARGETS += $(BUILD_LIBFONTMANAGER)
 745 
 746 ################################################################################
 747 
 748 ifeq ($(OPENJDK_TARGET_OS), windows)
 749   LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 750   LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \
 751       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 752       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 753       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 754       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \
 755       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 756       -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
 757       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 758       $(LIBJAVA_HEADER_FLAGS) \
 759       #
 760 
 761   ifeq ($(OPENJDK_TARGET_CPU), x86)
 762     KERNEL32_LIB := kernel32.lib
 763   endif
 764   $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
 765       LIBRARY := jawt, \
 766       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 767       SRC := $(LIBJAWT_SRC), \
 768       INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES), \
 769       OPTIMIZATION := LOW, \
 770       CFLAGS := $(CXXFLAGS_JDKLIB) \
 771           -EHsc -DUNICODE -D_UNICODE \
 772           $(LIBJAWT_CFLAGS), \
 773       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
 774       LIBS := $(JDKLIB_LIBS) $(KERNEL32_LIB) advapi32.lib $(WIN_AWT_LIB), \
 775       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 776       RC_FLAGS := $(RC_FLAGS) \
 777           -D "JDK_FNAME=jawt.dll" \
 778           -D "JDK_INTERNAL_NAME=jawt" \
 779           -D "JDK_FTYPE=0x2L", \
 780       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
 781   ))
 782 
 783   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
 784 
 785   $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
 786         $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
 787         $(call MakeDir, $(@D))
 788         $(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
 789 
 790   TARGETS += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
 791 
 792 else # OPENJDK_TARGET_OS not windows
 793 
 794   ifeq ($(OPENJDK_TARGET_OS), macosx)
 795     LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjawt
 796   else
 797     LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 798   endif
 799   LIBJAWT_CFLAGS := \
 800       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 801       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
 802       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
 803       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 804       $(LIBJAVA_HEADER_FLAGS) \
 805       #
 806 
 807   ifeq ($(OPENJDK_TARGET_OS), macosx)
 808     JAWT_LIBS := -lawt_lwawt
 809   else
 810     JAWT_LIBS :=
 811     ifneq ($(OPENJDK_TARGET_OS), solaris)
 812       JAWT_LIBS += -lawt
 813     endif
 814     ifndef BUILD_HEADLESS_ONLY
 815       JAWT_LIBS += -lawt_xawt
 816     else
 817       JAWT_LIBS += -lawt_headless
 818       HEADLESS_CFLAG += -DHEADLESS
 819     endif
 820   endif
 821 
 822   $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
 823       LIBRARY := jawt, \
 824       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 825       SRC := $(LIBJAWT_SRC), \
 826       INCLUDE_FILES := $(JAWT_FILES), \
 827       OPTIMIZATION := LOW, \
 828       CFLAGS := $(CFLAGS_JDKLIB) \
 829           $(LIBJAWT_CFLAGS), \
 830       CFLAGS_linux := $(HEADLESS_CFLAG), \
 831       CFLAGS_macosx := $(LIBJAWT_CFLAGS_macosx), \
 832       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjawt/mapfile-vers, \
 833       LDFLAGS := $(LDFLAGS_JDKLIB) \
 834           $(call SET_SHARED_LIBRARY_ORIGIN), \
 835       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 836       LDFLAGS_macosx := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \
 837       LIBS_unix := $(JAWT_LIBS) $(JDKLIB_LIBS), \
 838       LIBS_solaris := $(X_LIBS) -lXrender, \
 839       LIBS_macosx := -framework Cocoa, \
 840       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
 841   ))
 842 
 843   ifndef BUILD_HEADLESS_ONLY
 844     $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
 845   else
 846     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
 847   endif
 848 
 849   ifeq ($(OPENJDK_TARGET_OS), macosx)
 850     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
 851   endif
 852 
 853 endif # OPENJDK_TARGET_OS
 854 
 855 TARGETS += $(BUILD_LIBJAWT)
 856 
 857 ################################################################################
 858 
 859 ifndef BUILD_HEADLESS_ONLY
 860 
 861   LIBSPLASHSCREEN_DIRS := \
 862       $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg \
 863       $(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen \
 864       #
 865 
 866   ifeq ($(USE_EXTERNAL_LIBGIF), true)
 867     GIFLIB_LIBS := -lgif
 868     LIBSPLASHSCREEN_EXCLUDES := giflib
 869   else
 870     LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen/giflib
 871   endif
 872 
 873   ifeq ($(USE_EXTERNAL_LIBJPEG), true)
 874     LIBJPEG_LIBS := -ljpeg
 875   else
 876     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg
 877     LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg
 878   endif
 879 
 880   ifeq ($(USE_EXTERNAL_LIBPNG), false)
 881     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen/libpng
 882   else
 883     LIBSPLASHSCREEN_EXCLUDES += libpng
 884   endif
 885 
 886   ifneq ($(OPENJDK_TARGET_OS), macosx)
 887     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen
 888   else
 889     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libsplashscreen
 890   endif
 891 
 892   ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
 893     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
 894   endif
 895 
 896   ifeq ($(OPENJDK_TARGET_OS), windows)
 897     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/windows/native/common/awt/systemscale
 898   endif 
 899   LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0 \
 900       $(addprefix -I, $(LIBSPLASHSCREEN_DIRS)) \
 901       $(LIBJAVA_HEADER_FLAGS) \
 902       #
 903 
 904   ifeq ($(OPENJDK_TARGET_OS), macosx)
 905     LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
 906     LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp
 907 
 908     BUILD_LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
 909     BUILD_LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
 910     BUILD_LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS := -x objective-c -O0
 911     BUILD_LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS := -x objective-c -O0
 912     BUILD_LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS := -x objective-c -O0
 913     BUILD_LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS := -x objective-c -O0
 914     BUILD_LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS := -O0
 915 
 916   else ifeq ($(OPENJDK_TARGET_OS), windows)
 917     LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
 918   else
 919     LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 $(X_CFLAGS)
 920   endif
 921 
 922   LIBSPLASHSCREEN_LIBS :=
 923 
 924   ifneq ($(USE_EXTERNAL_LIBZ), true)
 925     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
 926     LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
 927   endif
 928 
 929   ifeq ($(OPENJDK_TARGET_OS), macosx)
 930     LIBSPLASHSCREEN_LDFLAGS := -L$(INSTALL_LIBRARIES_HERE)
 931     LIBSPLASHSCREEN_LIBS += \
 932         $(LIBM) -lpthread -liconv -losxapp \
 933         -framework ApplicationServices \
 934         -framework Foundation \
 935         -framework Cocoa \
 936         -framework JavaNativeFoundation
 937   else ifeq ($(OPENJDK_TARGET_OS), windows)
 938     LIBSPLASHSCREEN_LDFLAGS := -delayload:user32.dll
 939     LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
 940   else
 941     LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread
 942   endif
 943 
 944   $(eval $(call SetupNativeCompilation,BUILD_LIBSPLASHSCREEN, \
 945       LIBRARY := splashscreen, \
 946       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 947       SRC := $(LIBSPLASHSCREEN_DIRS), \
 948       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
 949       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
 950       OPTIMIZATION := LOW, \
 951       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
 952                 $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
 953       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \
 954       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
 955       DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
 956           E_STATEMENT_NOT_REACHED, \
 957       DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
 958       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
 959       LDFLAGS := $(LIBSPLASHSCREEN_LDFLAGS) $(LDFLAGS_JDKLIB) \
 960           $(call SET_SHARED_LIBRARY_ORIGIN), \
 961       LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ) \
 962                         $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
 963       LIBS_aix := -liconv, \
 964       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 965       RC_FLAGS := $(RC_FLAGS) \
 966           -D "JDK_FNAME=splashscreen.dll" \
 967           -D "JDK_INTERNAL_NAME=splashscreen" \
 968           -D "JDK_FTYPE=0x2L", \
 969       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
 970   ))
 971 
 972   TARGETS += $(BUILD_LIBSPLASHSCREEN)
 973 
 974   ifeq ($(OPENJDK_TARGET_OS), macosx)
 975     $(BUILD_LIBSPLASHSCREEN): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
 976   endif
 977 
 978 endif
 979 
 980 ################################################################################
 981 
 982 ifeq ($(OPENJDK_TARGET_OS), macosx)
 983 
 984   LIBAWT_LWAWT_DIRS := \
 985       $(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt \
 986       $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt \
 987       $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
 988       $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 989       #
 990 
 991   LIBAWT_LWAWT_CFLAGS := \
 992       $(addprefix -I, $(LIBAWT_LWAWT_DIRS)) \
 993       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 994       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/include \
 995       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 996       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
 997       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
 998       -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_xawt/awt \
 999       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/font \
1000       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
1001       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
1002       -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/java2d \
1003       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libmlib_image/ \
1004       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
1005       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
1006       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
1007       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
1008       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
1009       $(LIBJAVA_HEADER_FLAGS) \
1010       #
1011 
1012   LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
1013   LIBAWT_LWAWT_EXCLUDES := $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/medialib
1014 
1015   $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT, \
1016       LIBRARY := awt_lwawt, \
1017       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
1018       SRC := $(LIBAWT_LWAWT_DIRS), \
1019       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
1020       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
1021       EXCLUDES := $(LIBAWT_LWAWT_EXCLUDES), \
1022       OPTIMIZATION := LOW, \
1023       CFLAGS := $(CFLAGS_JDKLIB) \
1024           $(X_CFLAGS) \
1025           $(X_LIBS) \
1026           $(LIBAWT_LWAWT_CFLAGS), \
1027       DISABLED_WARNINGS_clang := incomplete-implementation enum-conversion \
1028           deprecated-declarations objc-method-access bitwise-op-parentheses \
1029           incompatible-pointer-types parentheses-equality extra-tokens, \
1030       LDFLAGS := $(LDFLAGS_JDKLIB) \
1031           $(call SET_SHARED_LIBRARY_ORIGIN) \
1032           -L$(INSTALL_LIBRARIES_HERE), \
1033       LIBS := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
1034           -framework Accelerate \
1035           -framework ApplicationServices \
1036           -framework AudioToolbox \
1037           -framework Carbon \
1038           -framework Cocoa \
1039           -framework Security \
1040           -framework ExceptionHandling \
1041           -framework JavaNativeFoundation \
1042           -framework JavaRuntimeSupport \
1043           -framework OpenGL \
1044           -framework QuartzCore -ljava, \
1045       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
1046   ))
1047 
1048   TARGETS += $(BUILD_LIBAWT_LWAWT)
1049 
1050   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
1051 
1052   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE)
1053 
1054   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBOSXAPP)
1055 
1056   $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java)
1057 
1058 endif
1059 
1060 ################################################################################
1061 
1062 ifeq ($(OPENJDK_TARGET_OS), macosx)
1063 
1064   $(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI, \
1065       LIBRARY := osxui, \
1066       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
1067       SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui, \
1068       OPTIMIZATION := LOW, \
1069       CFLAGS := $(CFLAGS_JDKLIB) \
1070           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui \
1071           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
1072           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
1073           -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
1074           -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
1075           -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop,  \
1076       LDFLAGS := $(LDFLAGS_JDKLIB) \
1077           $(call SET_SHARED_LIBRARY_ORIGIN) \
1078           -Wl$(COMMA)-rpath$(COMMA)@loader_path \
1079           -L$(INSTALL_LIBRARIES_HERE), \
1080       LIBS := -lawt -losxapp -lawt_lwawt \
1081           -framework Cocoa \
1082           -framework Carbon \
1083           -framework ApplicationServices \
1084           -framework JavaNativeFoundation \
1085           -framework JavaRuntimeSupport \
1086           -ljava -ljvm, \
1087       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
1088   ))
1089 
1090   TARGETS += $(BUILD_LIBOSXUI)
1091 
1092   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
1093 
1094   $(BUILD_LIBOSXUI): $(BUILD_LIBOSXAPP)
1095 
1096   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
1097 
1098   #$(BUILD_LIBOSXUI): $(call FindLib, java.base, java)
1099 
1100 endif
1101 
1102 ################################################################################
1103 
1104 # Hook to include the corresponding custom file, if present.
1105 $(eval $(call IncludeCustomExtension, jdk, lib/Awt2dLibraries.gmk))
--- EOF ---