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