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_gcc := maybe-uninitialized int-to-pointer-cast, \
 591         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
 592             E_EMPTY_TRANSLATION_UNIT, \
 593         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
 594         LDFLAGS := $(LDFLAGS_JDKLIB) \
 595             $(call SET_SHARED_LIBRARY_ORIGIN), \
 596         LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 597         LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 598         LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 599         REORDER := $(LIBAWT_HEADLESS_REORDER), \
 600         LIBS_unix := -lawt -ljvm -ljava, \
 601         LIBS_linux := $(LIBM) $(LIBDL), \
 602         LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \
 603         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
 604     ))
 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     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
 704         type-limits missing-field-initializers, \
 705     DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
 706         maybe-uninitialized, \
 707     DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
 708         tautological-constant-out-of-range-compare int-to-pointer-cast, \
 709     DISABLED_WARNINGS_C_solstudio = \
 710         E_INTEGER_OVERFLOW_DETECTED \
 711         E_ARG_INCOMPATIBLE_WITH_ARG_L \
 712         E_ENUM_VAL_OVERFLOWS_INT_MAX, \
 713     DISABLED_WARNINGS_CXX_solstudio := \
 714         truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
 715         hidevf w_novirtualdescr arrowrtn2, \
 716     DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334, \
 717     MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
 718     LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
 719         $(call SET_SHARED_LIBRARY_ORIGIN), \
 720     LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 721     LDFLAGS_macosx := -undefined dynamic_lookup, \
 722     LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
 723     LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
 724     LIBS_linux := -lc, \
 725     LIBS_solaris := -lawt_headless -lc, \
 726     LIBS_aix := -lawt_headless,\
 727     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
 728         $(WIN_AWT_LIB), \
 729     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 730     RC_FLAGS := $(RC_FLAGS) \
 731         -D "JDK_FNAME=fontmanager.dll" \
 732         -D "JDK_INTERNAL_NAME=fontmanager" \
 733         -D "JDK_FTYPE=0x2L", \
 734     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
 735 ))
 736 
 737 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 738 
 739 ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
 740   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
 741 endif
 742 
 743 TARGETS += $(BUILD_LIBFONTMANAGER)
 744 
 745 ################################################################################
 746 
 747 ifeq ($(OPENJDK_TARGET_OS), windows)
 748   LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 749   LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \
 750       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 751       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 752       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 753       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \
 754       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 755       -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
 756       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 757       $(LIBJAVA_HEADER_FLAGS) \
 758       #
 759 
 760   ifeq ($(OPENJDK_TARGET_CPU), x86)
 761     KERNEL32_LIB := kernel32.lib
 762   endif
 763   $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
 764       LIBRARY := jawt, \
 765       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 766       SRC := $(LIBJAWT_SRC), \
 767       INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES), \
 768       OPTIMIZATION := LOW, \
 769       CFLAGS := $(CXXFLAGS_JDKLIB) \
 770           -EHsc -DUNICODE -D_UNICODE \
 771           $(LIBJAWT_CFLAGS), \
 772       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
 773       LIBS := $(JDKLIB_LIBS) $(KERNEL32_LIB) advapi32.lib $(WIN_AWT_LIB), \
 774       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 775       RC_FLAGS := $(RC_FLAGS) \
 776           -D "JDK_FNAME=jawt.dll" \
 777           -D "JDK_INTERNAL_NAME=jawt" \
 778           -D "JDK_FTYPE=0x2L", \
 779       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
 780   ))
 781 
 782   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
 783 
 784   $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
 785         $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
 786         $(call MakeDir, $(@D))
 787         $(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
 788 
 789   TARGETS += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
 790 
 791 else # OPENJDK_TARGET_OS not windows
 792 
 793   ifeq ($(OPENJDK_TARGET_OS), macosx)
 794     LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjawt
 795   else
 796     LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 797   endif
 798   LIBJAWT_CFLAGS := \
 799       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 800       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
 801       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
 802       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 803       $(LIBJAVA_HEADER_FLAGS) \
 804       #
 805 
 806   ifeq ($(OPENJDK_TARGET_OS), macosx)
 807     JAWT_LIBS := -lawt_lwawt
 808   else
 809     JAWT_LIBS :=
 810     ifneq ($(OPENJDK_TARGET_OS), solaris)
 811       JAWT_LIBS += -lawt
 812     endif
 813     ifndef BUILD_HEADLESS_ONLY
 814       JAWT_LIBS += -lawt_xawt
 815     else
 816       JAWT_LIBS += -lawt_headless
 817       HEADLESS_CFLAG += -DHEADLESS
 818     endif
 819   endif
 820 
 821   $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
 822       LIBRARY := jawt, \
 823       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 824       SRC := $(LIBJAWT_SRC), \
 825       INCLUDE_FILES := $(JAWT_FILES), \
 826       OPTIMIZATION := LOW, \
 827       CFLAGS := $(CFLAGS_JDKLIB) \
 828           $(LIBJAWT_CFLAGS), \
 829       CFLAGS_linux := $(HEADLESS_CFLAG), \
 830       CFLAGS_macosx := $(LIBJAWT_CFLAGS_macosx), \
 831       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjawt/mapfile-vers, \
 832       LDFLAGS := $(LDFLAGS_JDKLIB) \
 833           $(call SET_SHARED_LIBRARY_ORIGIN), \
 834       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 835       LDFLAGS_macosx := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \
 836       LIBS_unix := $(JAWT_LIBS) $(JDKLIB_LIBS), \
 837       LIBS_solaris := $(X_LIBS) -lXrender, \
 838       LIBS_macosx := -framework Cocoa, \
 839       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
 840   ))
 841 
 842   ifndef BUILD_HEADLESS_ONLY
 843     $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
 844   else
 845     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
 846   endif
 847 
 848   ifeq ($(OPENJDK_TARGET_OS), macosx)
 849     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
 850   endif
 851 
 852 endif # OPENJDK_TARGET_OS
 853 
 854 TARGETS += $(BUILD_LIBJAWT)
 855 
 856 ################################################################################
 857 
 858 ifndef BUILD_HEADLESS_ONLY
 859 
 860   LIBSPLASHSCREEN_DIRS := \
 861       $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg \
 862       $(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen \
 863       #
 864 
 865   ifeq ($(USE_EXTERNAL_LIBGIF), true)
 866     GIFLIB_LIBS := -lgif
 867     LIBSPLASHSCREEN_EXCLUDES := giflib
 868   else
 869     LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen/giflib
 870   endif
 871 
 872   ifeq ($(USE_EXTERNAL_LIBJPEG), true)
 873     LIBJPEG_LIBS := -ljpeg
 874   else
 875     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg
 876     LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg
 877   endif
 878 
 879   ifeq ($(USE_EXTERNAL_LIBPNG), false)
 880     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen/libpng
 881   else
 882     LIBSPLASHSCREEN_EXCLUDES += libpng
 883   endif
 884 
 885   ifneq ($(OPENJDK_TARGET_OS), macosx)
 886     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen
 887   else
 888     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libsplashscreen
 889   endif
 890 
 891   ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
 892     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
 893   endif
 894 
 895   ifeq ($(OPENJDK_TARGET_OS), windows)
 896     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/windows/native/common/awt/systemscale
 897   endif 
 898   LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0 \
 899       $(addprefix -I, $(LIBSPLASHSCREEN_DIRS)) \
 900       $(LIBJAVA_HEADER_FLAGS) \
 901       #
 902 
 903   ifeq ($(OPENJDK_TARGET_OS), macosx)
 904     LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
 905     LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp
 906 
 907     BUILD_LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
 908     BUILD_LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
 909     BUILD_LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS := -x objective-c -O0
 910     BUILD_LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS := -x objective-c -O0
 911     BUILD_LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS := -x objective-c -O0
 912     BUILD_LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS := -x objective-c -O0
 913     BUILD_LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS := -O0
 914 
 915   else ifeq ($(OPENJDK_TARGET_OS), windows)
 916     LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
 917   else
 918     LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 $(X_CFLAGS)
 919   endif
 920 
 921   LIBSPLASHSCREEN_LIBS :=
 922 
 923   ifneq ($(USE_EXTERNAL_LIBZ), true)
 924     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
 925     LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
 926   endif
 927 
 928   ifeq ($(OPENJDK_TARGET_OS), macosx)
 929     LIBSPLASHSCREEN_LDFLAGS := -L$(INSTALL_LIBRARIES_HERE)
 930     LIBSPLASHSCREEN_LIBS += \
 931         $(LIBM) -lpthread -liconv -losxapp \
 932         -framework ApplicationServices \
 933         -framework Foundation \
 934         -framework Cocoa \
 935         -framework JavaNativeFoundation
 936   else ifeq ($(OPENJDK_TARGET_OS), windows)
 937     LIBSPLASHSCREEN_LDFLAGS := -delayload:user32.dll
 938     LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
 939   else
 940     LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread
 941   endif
 942 
 943   $(eval $(call SetupNativeCompilation,BUILD_LIBSPLASHSCREEN, \
 944       LIBRARY := splashscreen, \
 945       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 946       SRC := $(LIBSPLASHSCREEN_DIRS), \
 947       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
 948       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
 949       OPTIMIZATION := LOW, \
 950       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
 951                 $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
 952       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \
 953       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
 954       DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
 955           E_STATEMENT_NOT_REACHED, \
 956       DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
 957       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
 958       LDFLAGS := $(LIBSPLASHSCREEN_LDFLAGS) $(LDFLAGS_JDKLIB) \
 959           $(call SET_SHARED_LIBRARY_ORIGIN), \
 960       LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ) \
 961                         $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
 962       LIBS_aix := -liconv, \
 963       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 964       RC_FLAGS := $(RC_FLAGS) \
 965           -D "JDK_FNAME=splashscreen.dll" \
 966           -D "JDK_INTERNAL_NAME=splashscreen" \
 967           -D "JDK_FTYPE=0x2L", \
 968       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
 969   ))
 970 
 971   TARGETS += $(BUILD_LIBSPLASHSCREEN)
 972 
 973   ifeq ($(OPENJDK_TARGET_OS), macosx)
 974     $(BUILD_LIBSPLASHSCREEN): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
 975   endif
 976 
 977 endif
 978 
 979 ################################################################################
 980 
 981 ifeq ($(OPENJDK_TARGET_OS), macosx)
 982 
 983   LIBAWT_LWAWT_DIRS := \
 984       $(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt \
 985       $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt \
 986       $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
 987       $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 988       #
 989 
 990   LIBAWT_LWAWT_CFLAGS := \
 991       $(addprefix -I, $(LIBAWT_LWAWT_DIRS)) \
 992       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 993       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/include \
 994       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 995       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
 996       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
 997       -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_xawt/awt \
 998       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/font \
 999       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
1000       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
1001       -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/java2d \
1002       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libmlib_image/ \
1003       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
1004       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
1005       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
1006       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
1007       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
1008       $(LIBJAVA_HEADER_FLAGS) \
1009       #
1010 
1011   LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
1012   LIBAWT_LWAWT_EXCLUDES := $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/medialib
1013 
1014   $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT, \
1015       LIBRARY := awt_lwawt, \
1016       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
1017       SRC := $(LIBAWT_LWAWT_DIRS), \
1018       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
1019       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
1020       EXCLUDES := $(LIBAWT_LWAWT_EXCLUDES), \
1021       OPTIMIZATION := LOW, \
1022       CFLAGS := $(CFLAGS_JDKLIB) \
1023           $(X_CFLAGS) \
1024           $(X_LIBS) \
1025           $(LIBAWT_LWAWT_CFLAGS), \
1026       DISABLED_WARNINGS_clang := incomplete-implementation enum-conversion \
1027           deprecated-declarations objc-method-access bitwise-op-parentheses \
1028           incompatible-pointer-types parentheses-equality extra-tokens, \
1029       LDFLAGS := $(LDFLAGS_JDKLIB) \
1030           $(call SET_SHARED_LIBRARY_ORIGIN) \
1031           -L$(INSTALL_LIBRARIES_HERE), \
1032       LIBS := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
1033           -framework Accelerate \
1034           -framework ApplicationServices \
1035           -framework AudioToolbox \
1036           -framework Carbon \
1037           -framework Cocoa \
1038           -framework Security \
1039           -framework ExceptionHandling \
1040           -framework JavaNativeFoundation \
1041           -framework JavaRuntimeSupport \
1042           -framework OpenGL \
1043           -framework QuartzCore -ljava, \
1044       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
1045   ))
1046 
1047   TARGETS += $(BUILD_LIBAWT_LWAWT)
1048 
1049   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
1050 
1051   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE)
1052 
1053   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBOSXAPP)
1054 
1055   $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java)
1056 
1057 endif
1058 
1059 ################################################################################
1060 
1061 ifeq ($(OPENJDK_TARGET_OS), macosx)
1062 
1063   $(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI, \
1064       LIBRARY := osxui, \
1065       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
1066       SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui, \
1067       OPTIMIZATION := LOW, \
1068       CFLAGS := $(CFLAGS_JDKLIB) \
1069           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui \
1070           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
1071           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
1072           -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
1073           -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
1074           -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop,  \
1075       LDFLAGS := $(LDFLAGS_JDKLIB) \
1076           $(call SET_SHARED_LIBRARY_ORIGIN) \
1077           -Wl$(COMMA)-rpath$(COMMA)@loader_path \
1078           -L$(INSTALL_LIBRARIES_HERE), \
1079       LIBS := -lawt -losxapp -lawt_lwawt \
1080           -framework Cocoa \
1081           -framework Carbon \
1082           -framework ApplicationServices \
1083           -framework JavaNativeFoundation \
1084           -framework JavaRuntimeSupport \
1085           -ljava -ljvm, \
1086       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
1087   ))
1088 
1089   TARGETS += $(BUILD_LIBOSXUI)
1090 
1091   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
1092 
1093   $(BUILD_LIBOSXUI): $(BUILD_LIBOSXAPP)
1094 
1095   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
1096 
1097   #$(BUILD_LIBOSXUI): $(call FindLib, java.base, java)
1098 
1099 endif
1100 
1101 ################################################################################
1102 
1103 # Hook to include the corresponding custom file, if present.
1104 $(eval $(call IncludeCustomExtension, jdk, lib/Awt2dLibraries.gmk))
--- EOF ---