1 #
   2 # Copyright (c) 2011, 2020, 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 include LibCommon.gmk
  27 
  28 # Hook to include the corresponding custom file, if present.
  29 $(eval $(call IncludeCustomExtension, modules/java.desktop/Lib.gmk))
  30 
  31 # Prepare the find cache.
  32 $(call FillFindCache, $(wildcard $(TOPDIR)/src/java.desktop/*/native))
  33 
  34 ################################################################################
  35 # Create the AWT/2D libraries
  36 
  37 include lib/Awt2dLibraries.gmk
  38 
  39 ################################################################################
  40 # Create the libjsound library
  41 
  42 ifeq ($(call isTargetOs, aix), false)
  43 
  44   LIBJSOUND_CFLAGS := \
  45       $(ALSA_CFLAGS) \
  46       -DX_PLATFORM=X_$(OPENJDK_TARGET_OS_UPPERCASE) \
  47       -DUSE_PORTS=TRUE \
  48       -DUSE_DAUDIO=TRUE \
  49       -DUSE_PLATFORM_MIDI_OUT=TRUE \
  50       -DUSE_PLATFORM_MIDI_IN=TRUE \
  51       #
  52 
  53   ifeq ($(call isTargetOs, macosx), true)
  54     LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX
  55   endif
  56 
  57   $(eval $(call SetupJdkLibrary, BUILD_LIBJSOUND, \
  58       NAME := jsound, \
  59       TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \
  60       OPTIMIZATION := LOW, \
  61       CFLAGS := $(CFLAGS_JDKLIB) \
  62           $(LIBJSOUND_CFLAGS), \
  63       CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
  64       DISABLED_WARNINGS_gcc := undef, \
  65       DISABLED_WARNINGS_clang := undef, \
  66       LDFLAGS := $(LDFLAGS_JDKLIB) \
  67           $(call SET_SHARED_LIBRARY_ORIGIN), \
  68       LIBS_unix := -ljava -ljvm, \
  69       LIBS_linux := $(ALSA_LIBS), \
  70       LIBS_macosx := -framework CoreAudio -framework CoreFoundation \
  71           -framework CoreServices -framework AudioUnit \
  72           -framework CoreMIDI -framework AudioToolbox $(LIBCXX), \
  73       LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib dsound.lib winmm.lib user32.lib ole32.lib, \
  74   ))
  75 
  76   $(BUILD_LIBJSOUND): $(call FindLib, java.base, java)
  77 
  78   TARGETS += $(BUILD_LIBJSOUND)
  79 
  80 endif
  81 
  82 ################################################################################
  83 # Create the macosx specific osxapp and osx libraries
  84 
  85 ifeq ($(call isTargetOs, macosx), true)
  86 
  87   $(eval $(call SetupJdkLibrary, BUILD_LIBOSXAPP, \
  88       NAME := osxapp, \
  89       OPTIMIZATION := LOW, \
  90       CFLAGS := $(CFLAGS_JDKLIB), \
  91       DISABLED_WARNINGS_clang := objc-method-access objc-root-class \
  92           deprecated-declarations format-nonliteral, \
  93       LDFLAGS := $(LDFLAGS_JDKLIB) \
  94           $(call SET_SHARED_LIBRARY_ORIGIN), \
  95       LIBS := \
  96           -framework Accelerate \
  97           -framework ApplicationServices \
  98           -framework AudioToolbox \
  99           -framework Carbon \
 100           -framework Cocoa \
 101           -framework Security \
 102           -framework ExceptionHandling \
 103           -framework JavaNativeFoundation \
 104           -framework JavaRuntimeSupport \
 105           -framework OpenGL \
 106           -framework IOSurface \
 107           -framework QuartzCore, \
 108   ))
 109 
 110   TARGETS += $(BUILD_LIBOSXAPP)
 111 
 112   ##############################################################################
 113 
 114   $(eval $(call SetupJdkLibrary, BUILD_LIBOSX, \
 115       NAME := osx, \
 116       OPTIMIZATION := LOW, \
 117       CFLAGS := $(CFLAGS_JDKLIB), \
 118       EXTRA_HEADER_DIRS := libosxapp, \
 119       DISABLED_WARNINGS_clang := deprecated-declarations, \
 120       LDFLAGS := $(LDFLAGS_JDKLIB) \
 121           -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
 122           $(call SET_SHARED_LIBRARY_ORIGIN), \
 123       LIBS := \
 124           -losxapp \
 125           -framework Cocoa \
 126           -framework ApplicationServices \
 127           -framework JavaNativeFoundation \
 128           -framework JavaRuntimeSupport \
 129           -framework SystemConfiguration \
 130           $(JDKLIB_LIBS), \
 131   ))
 132 
 133   TARGETS += $(BUILD_LIBOSX)
 134 
 135   $(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp)
 136 
 137   $(BUILD_LIBOSX): $(call FindLib, java.base, java)
 138 
 139 endif