SoundLibraries.gmk revision 8845:4be14673b9bf
1# 2# Copyright (c) 2011, 2013, 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 26LIBJSOUND_SRC_DIRS := \ 27 $(JDK_TOPDIR)/src/share/native/com/sun/media/sound \ 28 $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/media/sound 29 30LIBJSOUND_SRC_FILES := Utilities.c Platform.c 31 32LIBJSOUND_LANG := C 33LIBJSOUND_CFLAGS := $(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir)) 34 35EXTRA_SOUND_JNI_LIBS := 36 37LIBJSOUND_MIDIFILES := \ 38 MidiInDevice.c \ 39 MidiInDeviceProvider.c \ 40 MidiOutDevice.c \ 41 MidiOutDeviceProvider.c \ 42 PlatformMidi.c 43 44# files needed for ports 45LIBJSOUND_PORTFILES := \ 46 PortMixerProvider.c \ 47 PortMixer.c 48 49# files needed for direct audio 50LIBJSOUND_DAUDIOFILES := \ 51 DirectAudioDeviceProvider.c \ 52 DirectAudioDevice.c 53 54ifeq ($(OPENJDK_TARGET_OS), windows) 55 EXTRA_SOUND_JNI_LIBS += jsoundds 56 LIBJSOUND_CFLAGS += -DX_PLATFORM=X_WINDOWS \ 57 -DUSE_PLATFORM_MIDI_OUT=TRUE \ 58 -DUSE_PLATFORM_MIDI_IN=TRUE \ 59 -DUSE_PORTS=TRUE 60 LIBJSOUND_SRC_FILES += \ 61 PLATFORM_API_WinOS_MidiIn.cpp \ 62 PLATFORM_API_WinOS_MidiOut.c \ 63 PLATFORM_API_WinOS_Util.c \ 64 PLATFORM_API_WinOS_Ports.c 65 LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES) 66 LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES) 67endif # OPENJDK_TARGET_OS windows 68 69ifeq ($(OPENJDK_TARGET_OS), linux) 70 EXTRA_SOUND_JNI_LIBS += jsoundalsa 71 LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX 72endif # OPENJDK_TARGET_OS linux 73 74ifeq ($(OPENJDK_TARGET_OS), macosx) 75 LIBJSOUND_LANG := C++ 76 LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX \ 77 -DUSE_PORTS=TRUE \ 78 -DUSE_DAUDIO=TRUE \ 79 -DUSE_PLATFORM_MIDI_OUT=TRUE \ 80 -DUSE_PLATFORM_MIDI_IN=TRUE 81 LIBJSOUND_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/sun/media/sound 82 LIBJSOUND_SRC_FILES += \ 83 PLATFORM_API_MacOSX_Utils.cpp \ 84 PLATFORM_API_MacOSX_PCM.cpp \ 85 PLATFORM_API_MacOSX_Ports.cpp \ 86 PLATFORM_API_MacOSX_MidiIn.c \ 87 PLATFORM_API_MacOSX_MidiOut.c \ 88 PLATFORM_API_MacOSX_MidiUtils.c 89 LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES) 90 LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES) 91 LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES) 92endif # OPENJDK_TARGET_OS macosx 93 94ifeq ($(OPENJDK_TARGET_OS), solaris) 95 LIBJSOUND_CFLAGS += -DX_PLATFORM=X_SOLARIS \ 96 -DUSE_PORTS=TRUE \ 97 -DUSE_DAUDIO=TRUE 98 LIBJSOUND_SRC_FILES += \ 99 PLATFORM_API_SolarisOS_Utils.c \ 100 PLATFORM_API_SolarisOS_Ports.c \ 101 PLATFORM_API_SolarisOS_PCM.c 102 LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES) 103 LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES) 104 LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES) 105endif # OPENJDK_TARGET_OS solaris 106 107 108ifeq ($(JVM_VARIANT_ZERO), true) 109 LIBJSOUND_CFLAGS += -DX_ARCH=X_ZERO 110else 111 ifeq ($(OPENJDK_TARGET_CPU), x86) 112 LIBJSOUND_CFLAGS += -DX_ARCH=X_I586 113 endif 114 115 ifeq ($(OPENJDK_TARGET_CPU), sparc) 116 LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARC 117 endif 118 119 ifeq ($(OPENJDK_TARGET_CPU), sparcv9) 120 LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARCV9 121 endif 122 123 ifeq ($(OPENJDK_TARGET_CPU), x86_64) 124 LIBJSOUND_CFLAGS += -DX_ARCH=X_AMD64 125 endif 126 127 ifeq ($(OPENJDK_TARGET_CPU), arm) 128 LIBJSOUND_CFLAGS += -DX_ARCH=X_ARM 129 endif 130 131 ifeq ($(OPENJDK_TARGET_CPU), ppc) 132 LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC 133 endif 134endif 135 136LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"' 137 138$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \ 139 LIBRARY := jsound, \ 140 OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ 141 SRC := $(LIBJSOUND_SRC_DIRS), \ 142 INCLUDE_FILES := $(LIBJSOUND_SRC_FILES), \ 143 LANG := $(LIBJSOUND_LANG), \ 144 OPTIMIZATION := LOW, \ 145 CFLAGS := $(CFLAGS_JDKLIB) \ 146 $(LIBJSOUND_CFLAGS), \ 147 CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \ 148 MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \ 149 LDFLAGS := $(LDFLAGS_JDKLIB) \ 150 $(call SET_SHARED_LIBRARY_ORIGIN), \ 151 LDFLAGS_macosx := -framework CoreAudio -framework CoreFoundation \ 152 -framework CoreServices -framework AudioUnit $(LIBCXX) \ 153 -framework CoreMIDI -framework AudioToolbox, \ 154 LDFLAGS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \ 155 LDFLAGS_SUFFIX_posix := -ljava -ljvm, \ 156 LDFLAGS_SUFFIX_solaris := -lc, \ 157 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ 158 RC_FLAGS := $(RC_FLAGS) \ 159 -D "JDK_FNAME=jsound.dll" \ 160 -D "JDK_INTERNAL_NAME=jsound" \ 161 -D "JDK_FTYPE=0x2L", \ 162 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsound, \ 163 DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) 164 165$(BUILD_LIBJSOUND): $(BUILD_LIBJAVA) 166 167BUILD_LIBRARIES += $(BUILD_LIBJSOUND) 168 169########################################################################################## 170 171ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), ) 172 173 $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA, \ 174 LIBRARY := jsoundalsa, \ 175 OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ 176 SRC := $(LIBJSOUND_SRC_DIRS), \ 177 INCLUDE_FILES := Utilities.c $(LIBJSOUND_MIDIFILES) $(LIBJSOUND_PORTFILES) \ 178 $(LIBJSOUND_DAUDIOFILES) \ 179 PLATFORM_API_LinuxOS_ALSA_CommonUtils.c \ 180 PLATFORM_API_LinuxOS_ALSA_PCM.c \ 181 PLATFORM_API_LinuxOS_ALSA_PCMUtils.c \ 182 PLATFORM_API_LinuxOS_ALSA_MidiIn.c \ 183 PLATFORM_API_LinuxOS_ALSA_MidiOut.c \ 184 PLATFORM_API_LinuxOS_ALSA_MidiUtils.c \ 185 PLATFORM_API_LinuxOS_ALSA_Ports.c, \ 186 LANG := C, \ 187 OPTIMIZATION := LOW, \ 188 CFLAGS := $(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \ 189 $(LIBJSOUND_CFLAGS) \ 190 -DUSE_DAUDIO=TRUE \ 191 -DUSE_PORTS=TRUE \ 192 -DUSE_PLATFORM_MIDI_OUT=TRUE \ 193 -DUSE_PLATFORM_MIDI_IN=TRUE, \ 194 MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsoundalsa/mapfile-vers, \ 195 LDFLAGS := $(LDFLAGS_JDKLIB) \ 196 $(call SET_SHARED_LIBRARY_ORIGIN), \ 197 LDFLAGS_SUFFIX := $(ALSA_LIBS) -ljava -ljvm, \ 198 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundalsa, \ 199 DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) 200 201 $(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA) 202 203 BUILD_LIBRARIES += $(BUILD_LIBJSOUNDALSA) 204 205endif 206 207########################################################################################## 208 209ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), ) 210 211 $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS, \ 212 LIBRARY := jsoundds, \ 213 OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ 214 SRC := $(LIBJSOUND_SRC_DIRS), \ 215 INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \ 216 PLATFORM_API_WinOS_DirectSound.cpp, \ 217 LANG := C++, \ 218 OPTIMIZATION := LOW, \ 219 CFLAGS := $(CFLAGS_JDKLIB) \ 220 $(LIBJSOUND_CFLAGS) \ 221 -DUSE_DAUDIO=TRUE, \ 222 LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \ 223 $(call SET_SHARED_LIBRARY_ORIGIN), \ 224 LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX) dsound.lib winmm.lib user32.lib ole32.lib, \ 225 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ 226 RC_FLAGS := $(RC_FLAGS) \ 227 -D "JDK_FNAME=jsoundds.dll" \ 228 -D "JDK_INTERNAL_NAME=jsoundds" \ 229 -D "JDK_FTYPE=0x2L", \ 230 OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundds, \ 231 DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) 232 233 $(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA) 234 235 BUILD_LIBRARIES += $(BUILD_LIBJSOUNDDS) 236 237endif 238