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