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 -lXcomposite $(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, \
 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, \
 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_gcc := maybe-uninitialized int-to-pointer-cast, \
 582         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
 583             E_EMPTY_TRANSLATION_UNIT, \
 584         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
 585         LDFLAGS := $(LDFLAGS_JDKLIB) \
 586             $(call SET_SHARED_LIBRARY_ORIGIN), \
 587         LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 588         LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 589         LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
 590         REORDER := $(LIBAWT_HEADLESS_REORDER), \
 591         LIBS_unix := -lawt -ljvm -ljava, \
 592         LIBS_linux := $(LIBM) $(LIBDL), \
 593         LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \
 594         OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
 595     ))
 596 
 597     # AIX warning explanation:
 598     # 1506-356 : (W) Compilation unit is empty.
 599     #            This happens during the headless build
 600 
 601     $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
 602 
 603     TARGETS += $(BUILD_LIBAWT_HEADLESS)
 604 
 605   endif
 606 endif
 607 
 608 ################################################################################
 609 
 610 LIBFONTMANAGER_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libfontmanager \
 611     $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
 612 LIBFONTMANAGER_CFLAGS := \
 613     $(addprefix -I, $(shell $(FIND) \
 614       $(LIBFONTMANAGER_SRC) \
 615       $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \
 616       $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
 617       $(JDK_TOPDIR)/src/java.desktop/share/native/common \
 618       $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \
 619     -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 620     $(LIBJAVA_HEADER_FLAGS) \
 621     #
 622 
 623 #### Begin harfbuzz configuration
 624 
 625 HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN
 626 
 627 ifneq ($(OPENJDK_TARGET_OS), windows)
 628   HARFBUZZ_CFLAGS += -DGETPAGESIZE -DHAVE_MPROTECT -DHAVE_PTHREAD \
 629                       -DHAVE_SYSCONF -DHAVE_SYS_MMAN_H -DHAVE_UNISTD_H
 630 endif
 631 ifneq (, $(findstring $(OPENJDK_TARGET_OS), linux macosx))
 632   HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES
 633 endif
 634 ifeq ($(OPENJDK_TARGET_OS), solaris)
 635   HARFBUZZ_CFLAGS += -DHAVE_SOLARIS_ATOMIC_OPS
 636 endif
 637 ifeq ($(OPENJDK_TARGET_OS), macosx)
 638   HARFBUZZ_CFLAGS += -DHAVE_CORETEXT
 639 endif
 640 ifneq ($(OPENJDK_TARGET_OS), macosx)
 641   LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-coretext.cc
 642 endif
 643 # hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
 644 LIBFONTMANAGER_EXCLUDE_FILES += harfbuzz/hb-ft.cc
 645 
 646 LIBFONTMANAGER_CFLAGS += $(HARFBUZZ_CFLAGS)
 647 
 648 #### End harfbuzz configuration
 649 
 650 ifndef OPENJDK
 651   LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/closed/java.desktop/share/native/libt2k
 652   BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libfontmanager/mapfile-vers
 653   LIBFONTMANAGER_EXCLUDE_FILES += freetypeScaler.c
 654 else
 655   LIBFONTMANAGER_CFLAGS += $(FREETYPE_CFLAGS)
 656   BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libfontmanager/mapfile-vers.openjdk
 657   BUILD_LIBFONTMANAGER_FONTLIB := $(FREETYPE_LIBS)
 658 endif
 659 
 660 LIBFONTMANAGER_OPTIMIZATION := HIGH
 661 
 662 ifeq ($(OPENJDK_TARGET_OS), windows)
 663   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
 664       X11TextRenderer.c
 665   LIBFONTMANAGER_OPTIMIZATION := HIGHEST
 666   LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows
 667 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 668   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
 669       X11TextRenderer.c \
 670       fontpath.c \
 671       lcdglyph.c
 672 else
 673   LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
 674       lcdglyph.c
 675 endif
 676 
 677 LIBFONTMANAGER_CFLAGS += $(FONT_HEADERS) $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
 678 
 679 ifeq ($(TOOLCHAIN_TYPE), gcc)
 680   # Turn off all warnings for sunFont.c. This is needed because the specific warning
 681   # about discarding 'const' qualifier cannot be turned off individually.
 682   BUILD_LIBFONTMANAGER_sunFont.c_CFLAGS := -w
 683   # Turn off aliasing with GCC for ExtensionSubtables.cpp
 684   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 685 endif
 686 
 687 $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
 688     LIBRARY := fontmanager, \
 689     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 690     SRC := $(LIBFONTMANAGER_SRC), \
 691     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
 692         AccelGlyphCache.c, \
 693     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
 694     CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
 695     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
 696     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
 697     CFLAGS_windows = -DCC_NOEX, \
 698     WARNINGS_AS_ERRORS_xlc := false, \
 699     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
 700         type-limits missing-field-initializers, \
 701     DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
 702         maybe-uninitialized, \
 703     DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
 704         tautological-constant-out-of-range-compare int-to-pointer-cast, \
 705     DISABLED_WARNINGS_C_solstudio = \
 706         E_INTEGER_OVERFLOW_DETECTED \
 707         E_ARG_INCOMPATIBLE_WITH_ARG_L \
 708         E_ENUM_VAL_OVERFLOWS_INT_MAX, \
 709     DISABLED_WARNINGS_CXX_solstudio := \
 710         truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
 711         hidevf w_novirtualdescr arrowrtn2, \
 712     DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334, \
 713     MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
 714     LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
 715         $(call SET_SHARED_LIBRARY_ORIGIN), \
 716     LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 717     LDFLAGS_macosx := -undefined dynamic_lookup, \
 718     LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
 719     LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
 720     LIBS_linux := -lc, \
 721     LIBS_solaris := -lawt_headless -lc, \
 722     LIBS_aix := -lawt_headless,\
 723     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
 724         $(WIN_AWT_LIB), \
 725     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 726     RC_FLAGS := $(RC_FLAGS) \
 727         -D "JDK_FNAME=fontmanager.dll" \
 728         -D "JDK_INTERNAL_NAME=fontmanager" \
 729         -D "JDK_FTYPE=0x2L", \
 730     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
 731 ))
 732 
 733 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 734 
 735 ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
 736   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
 737 endif
 738 
 739 TARGETS += $(BUILD_LIBFONTMANAGER)
 740 
 741 ################################################################################
 742 
 743 ifeq ($(OPENJDK_TARGET_OS), windows)
 744   LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 745   LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \
 746       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
 747       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 748       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
 749       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \
 750       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 751       -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
 752       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 753       $(LIBJAVA_HEADER_FLAGS) \
 754       #
 755 
 756   ifeq ($(OPENJDK_TARGET_CPU), x86)
 757     KERNEL32_LIB := kernel32.lib
 758   endif
 759   $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
 760       LIBRARY := jawt, \
 761       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 762       SRC := $(LIBJAWT_SRC), \
 763       INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES), \
 764       OPTIMIZATION := LOW, \
 765       CFLAGS := $(CXXFLAGS_JDKLIB) \
 766           -EHsc -DUNICODE -D_UNICODE \
 767           $(LIBJAWT_CFLAGS), \
 768       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
 769       LIBS := $(JDKLIB_LIBS) $(KERNEL32_LIB) advapi32.lib $(WIN_AWT_LIB), \
 770       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 771       RC_FLAGS := $(RC_FLAGS) \
 772           -D "JDK_FNAME=jawt.dll" \
 773           -D "JDK_INTERNAL_NAME=jawt" \
 774           -D "JDK_FTYPE=0x2L", \
 775       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
 776   ))
 777 
 778   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
 779 
 780   $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
 781         $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
 782         $(call MakeDir, $(@D))
 783         $(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
 784 
 785   TARGETS += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
 786 
 787 else # OPENJDK_TARGET_OS not windows
 788 
 789   ifeq ($(OPENJDK_TARGET_OS), macosx)
 790     LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjawt
 791   else
 792     LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
 793   endif
 794   LIBJAWT_CFLAGS := \
 795       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
 796       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
 797       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
 798       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 799       $(LIBJAVA_HEADER_FLAGS) \
 800       #
 801 
 802   ifeq ($(OPENJDK_TARGET_OS), macosx)
 803     JAWT_LIBS := -lawt_lwawt
 804   else
 805     JAWT_LIBS :=
 806     ifneq ($(OPENJDK_TARGET_OS), solaris)
 807       JAWT_LIBS += -lawt
 808     endif
 809     ifndef BUILD_HEADLESS_ONLY
 810       JAWT_LIBS += -lawt_xawt
 811     else
 812       JAWT_LIBS += -lawt_headless
 813       HEADLESS_CFLAG += -DHEADLESS
 814     endif
 815   endif
 816 
 817   $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
 818       LIBRARY := jawt, \
 819       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 820       SRC := $(LIBJAWT_SRC), \
 821       INCLUDE_FILES := $(JAWT_FILES), \
 822       OPTIMIZATION := LOW, \
 823       CFLAGS := $(CFLAGS_JDKLIB) \
 824           $(LIBJAWT_CFLAGS), \
 825       CFLAGS_linux := $(HEADLESS_CFLAG), \
 826       CFLAGS_macosx := $(LIBJAWT_CFLAGS_macosx), \
 827       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjawt/mapfile-vers, \
 828       LDFLAGS := $(LDFLAGS_JDKLIB) \
 829           $(call SET_SHARED_LIBRARY_ORIGIN), \
 830       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
 831       LDFLAGS_macosx := -Wl$(COMMA)-rpath$(COMMA)@loader_path, \
 832       LIBS_unix := $(JAWT_LIBS) $(JDKLIB_LIBS), \
 833       LIBS_solaris := $(X_LIBS) -lXrender, \
 834       LIBS_macosx := -framework Cocoa, \
 835       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
 836   ))
 837 
 838   ifndef BUILD_HEADLESS_ONLY
 839     $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
 840   else
 841     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
 842   endif
 843 
 844   ifeq ($(OPENJDK_TARGET_OS), macosx)
 845     $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
 846   endif
 847 
 848 endif # OPENJDK_TARGET_OS
 849 
 850 TARGETS += $(BUILD_LIBJAWT)
 851 
 852 ################################################################################
 853 
 854 ifndef BUILD_HEADLESS_ONLY
 855 
 856   LIBSPLASHSCREEN_DIRS := \
 857       $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg \
 858       $(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen \
 859       #
 860 
 861   ifeq ($(USE_EXTERNAL_LIBGIF), true)
 862     GIFLIB_LIBS := -lgif
 863     LIBSPLASHSCREEN_EXCLUDES := giflib
 864   else
 865     LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen/giflib
 866   endif
 867 
 868   ifeq ($(USE_EXTERNAL_LIBJPEG), true)
 869     LIBJPEG_LIBS := -ljpeg
 870   else
 871     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg
 872     LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg
 873   endif
 874 
 875   ifeq ($(USE_EXTERNAL_LIBPNG), false)
 876     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/libsplashscreen/libpng
 877   else
 878     LIBSPLASHSCREEN_EXCLUDES += libpng
 879   endif
 880 
 881   ifneq ($(OPENJDK_TARGET_OS), macosx)
 882     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen
 883   else
 884     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libsplashscreen
 885   endif
 886 
 887   ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
 888     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
 889   endif
 890 
 891   ifeq ($(OPENJDK_TARGET_OS), windows)
 892     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/windows/native/common/awt/systemscale
 893   endif 
 894   LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0 \
 895       $(addprefix -I, $(LIBSPLASHSCREEN_DIRS)) \
 896       $(LIBJAVA_HEADER_FLAGS) \
 897       #
 898 
 899   ifeq ($(OPENJDK_TARGET_OS), macosx)
 900     LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
 901     LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp
 902 
 903     BUILD_LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
 904     BUILD_LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
 905     BUILD_LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS := -x objective-c -O0
 906     BUILD_LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS := -x objective-c -O0
 907     BUILD_LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS := -x objective-c -O0
 908     BUILD_LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS := -x objective-c -O0
 909     BUILD_LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS := -O0
 910 
 911   else ifeq ($(OPENJDK_TARGET_OS), windows)
 912     LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
 913   else
 914     LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 $(X_CFLAGS)
 915   endif
 916 
 917   LIBSPLASHSCREEN_LIBS :=
 918 
 919   ifneq ($(USE_EXTERNAL_LIBZ), true)
 920     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
 921     LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
 922   endif
 923 
 924   ifeq ($(OPENJDK_TARGET_OS), macosx)
 925     LIBSPLASHSCREEN_LDFLAGS := -L$(INSTALL_LIBRARIES_HERE)
 926     LIBSPLASHSCREEN_LIBS += \
 927         $(LIBM) -lpthread -liconv -losxapp \
 928         -framework ApplicationServices \
 929         -framework Foundation \
 930         -framework Cocoa \
 931         -framework JavaNativeFoundation
 932   else ifeq ($(OPENJDK_TARGET_OS), windows)
 933     LIBSPLASHSCREEN_LDFLAGS := -delayload:user32.dll
 934     LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
 935   else
 936     LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread
 937   endif
 938 
 939   $(eval $(call SetupNativeCompilation,BUILD_LIBSPLASHSCREEN, \
 940       LIBRARY := splashscreen, \
 941       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 942       SRC := $(LIBSPLASHSCREEN_DIRS), \
 943       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
 944       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
 945       OPTIMIZATION := LOW, \
 946       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
 947                 $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
 948       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result maybe-uninitialized, \
 949       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
 950       DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST E_DECLARATION_IN_CODE \
 951           E_STATEMENT_NOT_REACHED, \
 952       DISABLED_WARNINGS_microsoft := 4018 4244 4267, \
 953       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
 954       LDFLAGS := $(LIBSPLASHSCREEN_LDFLAGS) $(LDFLAGS_JDKLIB) \
 955           $(call SET_SHARED_LIBRARY_ORIGIN), \
 956       LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ) \
 957                         $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
 958       LIBS_aix := -liconv, \
 959       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 960       RC_FLAGS := $(RC_FLAGS) \
 961           -D "JDK_FNAME=splashscreen.dll" \
 962           -D "JDK_INTERNAL_NAME=splashscreen" \
 963           -D "JDK_FTYPE=0x2L", \
 964       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
 965   ))
 966 
 967   TARGETS += $(BUILD_LIBSPLASHSCREEN)
 968 
 969   ifeq ($(OPENJDK_TARGET_OS), macosx)
 970     $(BUILD_LIBSPLASHSCREEN): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
 971   endif
 972 
 973 endif
 974 
 975 ################################################################################
 976 
 977 ifeq ($(OPENJDK_TARGET_OS), macosx)
 978 
 979   LIBAWT_LWAWT_DIRS := \
 980       $(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt \
 981       $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt \
 982       $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
 983       $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
 984       #
 985 
 986   LIBAWT_LWAWT_CFLAGS := \
 987       $(addprefix -I, $(LIBAWT_LWAWT_DIRS)) \
 988       -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
 989       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/include \
 990       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
 991       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
 992       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
 993       -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_xawt/awt \
 994       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/font \
 995       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
 996       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
 997       -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/java2d \
 998       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libmlib_image/ \
 999       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
1000       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
1001       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
1002       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
1003       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
1004       $(LIBJAVA_HEADER_FLAGS) \
1005       #
1006 
1007   LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
1008   LIBAWT_LWAWT_EXCLUDES := $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/medialib
1009 
1010   $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT, \
1011       LIBRARY := awt_lwawt, \
1012       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
1013       SRC := $(LIBAWT_LWAWT_DIRS), \
1014       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
1015       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
1016       EXCLUDES := $(LIBAWT_LWAWT_EXCLUDES), \
1017       OPTIMIZATION := LOW, \
1018       CFLAGS := $(CFLAGS_JDKLIB) \
1019           $(X_CFLAGS) \
1020           $(X_LIBS) \
1021           $(LIBAWT_LWAWT_CFLAGS), \
1022       DISABLED_WARNINGS_clang := incomplete-implementation enum-conversion \
1023           deprecated-declarations objc-method-access bitwise-op-parentheses \
1024           incompatible-pointer-types parentheses-equality extra-tokens, \
1025       LDFLAGS := $(LDFLAGS_JDKLIB) \
1026           $(call SET_SHARED_LIBRARY_ORIGIN) \
1027           -L$(INSTALL_LIBRARIES_HERE), \
1028       LIBS := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
1029           -framework Accelerate \
1030           -framework ApplicationServices \
1031           -framework AudioToolbox \
1032           -framework Carbon \
1033           -framework Cocoa \
1034           -framework Security \
1035           -framework ExceptionHandling \
1036           -framework JavaNativeFoundation \
1037           -framework JavaRuntimeSupport \
1038           -framework OpenGL \
1039           -framework QuartzCore -ljava, \
1040       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
1041   ))
1042 
1043   TARGETS += $(BUILD_LIBAWT_LWAWT)
1044 
1045   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
1046 
1047   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE)
1048 
1049   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBOSXAPP)
1050 
1051   $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java)
1052 
1053 endif
1054 
1055 ################################################################################
1056 
1057 ifeq ($(OPENJDK_TARGET_OS), macosx)
1058 
1059   $(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI, \
1060       LIBRARY := osxui, \
1061       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
1062       SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui, \
1063       OPTIMIZATION := LOW, \
1064       CFLAGS := $(CFLAGS_JDKLIB) \
1065           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui \
1066           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
1067           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
1068           -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
1069           -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
1070           -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop,  \
1071       LDFLAGS := $(LDFLAGS_JDKLIB) \
1072           $(call SET_SHARED_LIBRARY_ORIGIN) \
1073           -Wl$(COMMA)-rpath$(COMMA)@loader_path \
1074           -L$(INSTALL_LIBRARIES_HERE), \
1075       LIBS := -lawt -losxapp -lawt_lwawt \
1076           -framework Cocoa \
1077           -framework Carbon \
1078           -framework ApplicationServices \
1079           -framework JavaNativeFoundation \
1080           -framework JavaRuntimeSupport \
1081           -ljava -ljvm, \
1082       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
1083   ))
1084 
1085   TARGETS += $(BUILD_LIBOSXUI)
1086 
1087   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
1088 
1089   $(BUILD_LIBOSXUI): $(BUILD_LIBOSXAPP)
1090 
1091   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
1092 
1093   #$(BUILD_LIBOSXUI): $(call FindLib, java.base, java)
1094 
1095 endif
1096 
1097 ################################################################################
1098 
1099 # Hook to include the corresponding custom file, if present.
1100 $(eval $(call IncludeCustomExtension, jdk, lib/Awt2dLibraries.gmk))
--- EOF ---