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_MidiIn.cpp \
  65       PLATFORM_API_WinOS_MidiOut.c \
  66       PLATFORM_API_WinOS_Util.c \
  67       PLATFORM_API_WinOS_Ports.c
  68   LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
  69   LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
  70 endif # OPENJDK_TARGET_OS windows
  71 
  72 ifeq ($(OPENJDK_TARGET_OS), linux)
  73   EXTRA_SOUND_JNI_LIBS += jsoundalsa
  74   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
  75 endif # OPENJDK_TARGET_OS linux
  76 
  77 ifeq ($(OPENJDK_TARGET_OS), aix)
  78   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_AIX
  79 endif # OPENJDK_TARGET_OS aix
  80 
  81 ifeq ($(OPENJDK_TARGET_OS), macosx)
  82   LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX
  83   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX \
  84       -DUSE_PORTS=TRUE \
  85       -DUSE_DAUDIO=TRUE \
  86       -DUSE_PLATFORM_MIDI_OUT=TRUE \
  87       -DUSE_PLATFORM_MIDI_IN=TRUE
  88   LIBJSOUND_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjsound
  89   LIBJSOUND_SRC_FILES += \
  90       PLATFORM_API_MacOSX_Utils.cpp \
  91       PLATFORM_API_MacOSX_PCM.cpp \
  92       PLATFORM_API_MacOSX_Ports.cpp \
  93       PLATFORM_API_MacOSX_MidiIn.c \
  94       PLATFORM_API_MacOSX_MidiOut.c \
  95       PLATFORM_API_MacOSX_MidiUtils.c
  96   LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
  97   LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
  98   LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
  99 endif # OPENJDK_TARGET_OS macosx
 100 
 101 ifeq ($(OPENJDK_TARGET_OS), solaris)
 102   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_SOLARIS \
 103       -DUSE_PORTS=TRUE \
 104       -DUSE_DAUDIO=TRUE
 105   LIBJSOUND_SRC_FILES += \
 106       PLATFORM_API_SolarisOS_Utils.c \
 107       PLATFORM_API_SolarisOS_Ports.c \
 108       PLATFORM_API_SolarisOS_PCM.c
 109   LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
 110   LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
 111   LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
 112 endif # OPENJDK_TARGET_OS solaris
 113 
 114 LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
 115 
 116 $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
 117     LIBRARY := jsound, \
 118     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 119     SRC := $(LIBJSOUND_SRC_DIRS), \
 120     INCLUDE_FILES := $(LIBJSOUND_SRC_FILES), \
 121     TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \
 122     OPTIMIZATION := LOW, \
 123     CFLAGS := $(CFLAGS_JDKLIB) \
 124         $(LIBJSOUND_CFLAGS), \
 125     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
 126     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
 127     LDFLAGS := $(LDFLAGS_JDKLIB) \
 128         $(call SET_SHARED_LIBRARY_ORIGIN), \
 129     LIBS_unix := -ljava -ljvm, \
 130     LIBS_solaris := -lc, \
 131     LIBS_macosx := -framework CoreAudio -framework CoreFoundation \
 132         -framework CoreServices -framework AudioUnit $(LIBCXX) \
 133         -framework CoreMIDI -framework AudioToolbox, \
 134     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \
 135     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 136     RC_FLAGS := $(RC_FLAGS) \
 137         -D "JDK_FNAME=jsound.dll" \
 138         -D "JDK_INTERNAL_NAME=jsound" \
 139         -D "JDK_FTYPE=0x2L", \
 140     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
 141 ))
 142 
 143 $(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
 144 
 145 TARGETS += $(BUILD_LIBJSOUND)
 146 
 147 ##########################################################################################
 148 
 149 ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
 150 
 151   $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA, \
 152       LIBRARY := jsoundalsa, \
 153       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 154       SRC := $(LIBJSOUND_SRC_DIRS), \
 155       INCLUDE_FILES := Utilities.c $(LIBJSOUND_MIDIFILES) $(LIBJSOUND_PORTFILES) \
 156           $(LIBJSOUND_DAUDIOFILES) \
 157           PLATFORM_API_LinuxOS_ALSA_CommonUtils.c \
 158           PLATFORM_API_LinuxOS_ALSA_PCM.c \
 159           PLATFORM_API_LinuxOS_ALSA_PCMUtils.c \
 160           PLATFORM_API_LinuxOS_ALSA_MidiIn.c \
 161           PLATFORM_API_LinuxOS_ALSA_MidiOut.c \
 162           PLATFORM_API_LinuxOS_ALSA_MidiUtils.c \
 163           PLATFORM_API_LinuxOS_ALSA_Ports.c, \
 164       OPTIMIZATION := LOW, \
 165       CFLAGS := $(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
 166           $(LIBJSOUND_CFLAGS) \
 167           -DUSE_DAUDIO=TRUE \
 168           -DUSE_PORTS=TRUE \
 169           -DUSE_PLATFORM_MIDI_OUT=TRUE \
 170           -DUSE_PLATFORM_MIDI_IN=TRUE, \
 171       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsoundalsa/mapfile-vers, \
 172       LDFLAGS := $(LDFLAGS_JDKLIB) \
 173           $(call SET_SHARED_LIBRARY_ORIGIN), \
 174       LIBS := $(ALSA_LIBS) -ljava -ljvm, \
 175       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
 176   ))
 177 
 178   $(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
 179 
 180   TARGETS += $(BUILD_LIBJSOUNDALSA)
 181 
 182 endif
 183 
 184 ##########################################################################################
 185 
 186 ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), )
 187 
 188   $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS, \
 189       LIBRARY := jsoundds, \
 190       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
 191       SRC := $(LIBJSOUND_SRC_DIRS), \
 192       INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \
 193           PLATFORM_API_WinOS_DirectSound.cpp, \
 194       OPTIMIZATION := LOW, \
 195       CFLAGS := $(CFLAGS_JDKLIB) \
 196           $(LIBJSOUND_CFLAGS) \
 197           -DUSE_DAUDIO=TRUE, \
 198       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
 199           $(call SET_SHARED_LIBRARY_ORIGIN), \
 200       LIBS := $(JDKLIB_LIBS) dsound.lib winmm.lib user32.lib ole32.lib, \
 201       VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
 202       RC_FLAGS := $(RC_FLAGS) \
 203           -D "JDK_FNAME=jsoundds.dll" \
 204           -D "JDK_INTERNAL_NAME=jsoundds" \
 205           -D "JDK_FTYPE=0x2L", \
 206       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
 207   ))
 208 
 209   $(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
 210 
 211   TARGETS += $(BUILD_LIBJSOUNDDS)
 212 
 213 endif