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