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