1 #
   2 # Copyright (c) 2011, 2018, 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 LIBJSOUND_SRC_DIRS := $(wildcard \
  27     $(TOPDIR)/src/java.desktop/share/native/libjsound \
  28     $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libjsound \
  29     )
  30 
  31 LIBJSOUND_CFLAGS := \
  32     -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
  33     $(LIBJAVA_HEADER_FLAGS) \
  34     $(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir)) \
  35     -DUSE_PORTS=TRUE \
  36     -DUSE_DAUDIO=TRUE \
  37     #
  38 
  39 ifneq ($(OPENJDK_TARGET_OS), solaris)
  40   LIBJSOUND_CFLAGS += \
  41       -DUSE_PLATFORM_MIDI_OUT=TRUE \
  42       -DUSE_PLATFORM_MIDI_IN=TRUE \
  43       #
  44 endif
  45 
  46 ifeq ($(OPENJDK_TARGET_OS), windows)
  47   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_WINDOWS
  48 endif
  49 
  50 ifeq ($(OPENJDK_TARGET_OS), linux)
  51   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
  52 endif
  53 
  54 ifeq ($(OPENJDK_TARGET_OS), aix)
  55   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_AIX
  56 endif
  57 
  58 ifeq ($(OPENJDK_TARGET_OS), macosx)
  59   LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX
  60   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX
  61 endif
  62 
  63 ifeq ($(OPENJDK_TARGET_OS), solaris)
  64   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_SOLARIS
  65 endif
  66 
  67 $(eval $(call SetupJdkLibrary, BUILD_LIBJSOUND, \
  68     NAME := jsound, \
  69     SRC := $(LIBJSOUND_SRC_DIRS), \
  70     TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \
  71     OPTIMIZATION := LOW, \
  72     CFLAGS := $(CFLAGS_JDKLIB) \
  73         $(LIBJSOUND_CFLAGS), \
  74     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
  75     MAPFILE := $(TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
  76     LDFLAGS := $(LDFLAGS_JDKLIB) \
  77         $(call SET_SHARED_LIBRARY_ORIGIN), \
  78     LIBS_unix := -ljava -ljvm, \
  79     LIBS_linux := $(ALSA_LIBS), \
  80     LIBS_macosx := -framework CoreAudio -framework CoreFoundation \
  81         -framework CoreServices -framework AudioUnit \
  82         -framework CoreMIDI -framework AudioToolbox $(LIBCXX), \
  83     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib dsound.lib winmm.lib user32.lib ole32.lib, \
  84 ))
  85 
  86 $(BUILD_LIBJSOUND): $(call FindLib, java.base, java)
  87 
  88 TARGETS += $(BUILD_LIBJSOUND)
  89 
  90 ##########################################################################################