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