make/lib/SoundLibraries.gmk
changeset 47216 71c04702a3d5
parent 47191 8c95ea7056b7
child 47217 72e3ae9a25eb
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 #
       
     2 # Copyright (c) 2011, 2015, 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 := \
       
    27     $(JDK_TOPDIR)/src/java.desktop/share/native/libjsound \
       
    28     $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjsound \
       
    29     #
       
    30 LIBJSOUND_CFLAGS := \
       
    31     -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
       
    32     $(LIBJAVA_HEADER_FLAGS) \
       
    33     $(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir)) \
       
    34     #
       
    35 
       
    36 LIBJSOUND_SRC_FILES := Utilities.c Platform.c
       
    37 
       
    38 EXTRA_SOUND_JNI_LIBS :=
       
    39 
       
    40 LIBJSOUND_MIDIFILES := \
       
    41     MidiInDevice.c \
       
    42     MidiInDeviceProvider.c \
       
    43     MidiOutDevice.c \
       
    44     MidiOutDeviceProvider.c \
       
    45     PlatformMidi.c
       
    46 
       
    47 # files needed for ports
       
    48 LIBJSOUND_PORTFILES := \
       
    49     PortMixerProvider.c \
       
    50     PortMixer.c
       
    51 
       
    52 # files needed for direct audio
       
    53 LIBJSOUND_DAUDIOFILES := \
       
    54     DirectAudioDeviceProvider.c \
       
    55     DirectAudioDevice.c
       
    56 
       
    57 ifeq ($(OPENJDK_TARGET_OS), windows)
       
    58   EXTRA_SOUND_JNI_LIBS += jsoundds
       
    59   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_WINDOWS \
       
    60       -DUSE_PLATFORM_MIDI_OUT=TRUE \
       
    61       -DUSE_PLATFORM_MIDI_IN=TRUE \
       
    62       -DUSE_PORTS=TRUE
       
    63   LIBJSOUND_SRC_FILES += \
       
    64       PLATFORM_API_WinOS_Charset_Util.cpp \
       
    65       PLATFORM_API_WinOS_MidiIn.cpp \
       
    66       PLATFORM_API_WinOS_MidiOut.c \
       
    67       PLATFORM_API_WinOS_Util.c \
       
    68       PLATFORM_API_WinOS_Ports.c
       
    69   LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
       
    70   LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
       
    71 endif # OPENJDK_TARGET_OS windows
       
    72 
       
    73 ifeq ($(OPENJDK_TARGET_OS), linux)
       
    74   EXTRA_SOUND_JNI_LIBS += jsoundalsa
       
    75   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
       
    76 endif # OPENJDK_TARGET_OS linux
       
    77 
       
    78 ifeq ($(OPENJDK_TARGET_OS), aix)
       
    79   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_AIX
       
    80 endif # OPENJDK_TARGET_OS aix
       
    81 
       
    82 ifeq ($(OPENJDK_TARGET_OS), macosx)
       
    83   LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX
       
    84   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX \
       
    85       -DUSE_PORTS=TRUE \
       
    86       -DUSE_DAUDIO=TRUE \
       
    87       -DUSE_PLATFORM_MIDI_OUT=TRUE \
       
    88       -DUSE_PLATFORM_MIDI_IN=TRUE
       
    89   LIBJSOUND_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjsound
       
    90   LIBJSOUND_SRC_FILES += \
       
    91       PLATFORM_API_MacOSX_Utils.cpp \
       
    92       PLATFORM_API_MacOSX_PCM.cpp \
       
    93       PLATFORM_API_MacOSX_Ports.cpp \
       
    94       PLATFORM_API_MacOSX_MidiIn.c \
       
    95       PLATFORM_API_MacOSX_MidiOut.c \
       
    96       PLATFORM_API_MacOSX_MidiUtils.c
       
    97   LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
       
    98   LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
       
    99   LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
       
   100 endif # OPENJDK_TARGET_OS macosx
       
   101 
       
   102 ifeq ($(OPENJDK_TARGET_OS), solaris)
       
   103   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_SOLARIS \
       
   104       -DUSE_PORTS=TRUE \
       
   105       -DUSE_DAUDIO=TRUE
       
   106   LIBJSOUND_SRC_FILES += \
       
   107       PLATFORM_API_SolarisOS_Utils.c \
       
   108       PLATFORM_API_SolarisOS_Ports.c \
       
   109       PLATFORM_API_SolarisOS_PCM.c
       
   110   LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
       
   111   LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
       
   112   LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
       
   113 endif # OPENJDK_TARGET_OS solaris
       
   114 
       
   115 LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
       
   116 
       
   117 $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
       
   118     LIBRARY := jsound, \
       
   119     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       
   120     SRC := $(LIBJSOUND_SRC_DIRS), \
       
   121     INCLUDE_FILES := $(LIBJSOUND_SRC_FILES), \
       
   122     TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \
       
   123     OPTIMIZATION := LOW, \
       
   124     CFLAGS := $(CFLAGS_JDKLIB) \
       
   125         $(LIBJSOUND_CFLAGS), \
       
   126     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
       
   127     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
       
   128     LDFLAGS := $(LDFLAGS_JDKLIB) \
       
   129         $(call SET_SHARED_LIBRARY_ORIGIN), \
       
   130     LIBS_unix := -ljava -ljvm, \
       
   131     LIBS_solaris := -lc, \
       
   132     LIBS_macosx := -framework CoreAudio -framework CoreFoundation \
       
   133         -framework CoreServices -framework AudioUnit $(LIBCXX) \
       
   134         -framework CoreMIDI -framework AudioToolbox, \
       
   135     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \
       
   136     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
       
   137     RC_FLAGS := $(RC_FLAGS) \
       
   138         -D "JDK_FNAME=jsound.dll" \
       
   139         -D "JDK_INTERNAL_NAME=jsound" \
       
   140         -D "JDK_FTYPE=0x2L", \
       
   141     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
       
   142 ))
       
   143 
       
   144 $(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
       
   145 
       
   146 TARGETS += $(BUILD_LIBJSOUND)
       
   147 
       
   148 ##########################################################################################
       
   149 
       
   150 ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
       
   151 
       
   152   $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA, \
       
   153       LIBRARY := jsoundalsa, \
       
   154       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       
   155       SRC := $(LIBJSOUND_SRC_DIRS), \
       
   156       INCLUDE_FILES := Utilities.c $(LIBJSOUND_MIDIFILES) $(LIBJSOUND_PORTFILES) \
       
   157           $(LIBJSOUND_DAUDIOFILES) \
       
   158           PLATFORM_API_LinuxOS_ALSA_CommonUtils.c \
       
   159           PLATFORM_API_LinuxOS_ALSA_PCM.c \
       
   160           PLATFORM_API_LinuxOS_ALSA_PCMUtils.c \
       
   161           PLATFORM_API_LinuxOS_ALSA_MidiIn.c \
       
   162           PLATFORM_API_LinuxOS_ALSA_MidiOut.c \
       
   163           PLATFORM_API_LinuxOS_ALSA_MidiUtils.c \
       
   164           PLATFORM_API_LinuxOS_ALSA_Ports.c, \
       
   165       OPTIMIZATION := LOW, \
       
   166       CFLAGS := $(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
       
   167           $(LIBJSOUND_CFLAGS) \
       
   168           -DUSE_DAUDIO=TRUE \
       
   169           -DUSE_PORTS=TRUE \
       
   170           -DUSE_PLATFORM_MIDI_OUT=TRUE \
       
   171           -DUSE_PLATFORM_MIDI_IN=TRUE, \
       
   172       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsoundalsa/mapfile-vers, \
       
   173       LDFLAGS := $(LDFLAGS_JDKLIB) \
       
   174           $(call SET_SHARED_LIBRARY_ORIGIN), \
       
   175       LIBS := $(ALSA_LIBS) -ljava -ljvm, \
       
   176       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
       
   177   ))
       
   178 
       
   179   $(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
       
   180 
       
   181   TARGETS += $(BUILD_LIBJSOUNDALSA)
       
   182 
       
   183 endif
       
   184 
       
   185 ##########################################################################################
       
   186 
       
   187 ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), )
       
   188 
       
   189   $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS, \
       
   190       LIBRARY := jsoundds, \
       
   191       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       
   192       SRC := $(LIBJSOUND_SRC_DIRS), \
       
   193       INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \
       
   194           PLATFORM_API_WinOS_Charset_Util.cpp \
       
   195           PLATFORM_API_WinOS_DirectSound.cpp, \
       
   196       OPTIMIZATION := LOW, \
       
   197       CFLAGS := $(CFLAGS_JDKLIB) \
       
   198           $(LIBJSOUND_CFLAGS) \
       
   199           -DUSE_DAUDIO=TRUE, \
       
   200       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
       
   201           $(call SET_SHARED_LIBRARY_ORIGIN), \
       
   202       LIBS := $(JDKLIB_LIBS) dsound.lib winmm.lib user32.lib ole32.lib, \
       
   203       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
       
   204       RC_FLAGS := $(RC_FLAGS) \
       
   205           -D "JDK_FNAME=jsoundds.dll" \
       
   206           -D "JDK_INTERNAL_NAME=jsoundds" \
       
   207           -D "JDK_FTYPE=0x2L", \
       
   208       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
       
   209   ))
       
   210 
       
   211   $(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
       
   212 
       
   213   TARGETS += $(BUILD_LIBJSOUNDDS)
       
   214 
       
   215 endif