#
# Copyright (C) 2007 Arnold Krille
# Copyright (C) 2007 Pieter Palmers
# Copyright (C) 2008 Marc-Olivier Barre
#
# This file originates from FFADO (www.ffado.org)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import os
from string import Template

Import('env')

# Paths to include files
env.AppendUnique(CPPPATH = ['#/', '#/common', '#/common/jack', '#/macosx'])

#
# Source files section
#

srcfiles_macosx_server = ['#/common/Jackdmp.cpp']

srcfiles_macosx_coreaudio = ['JackCoreAudioDriver.cpp']

srcfiles_macosx_dummy = ['#/common/JackDummyDriver.cpp']

#
# Build/install section
#

# build the server and its backends
serverenv = env.Copy()
serverenv.PrependUnique( LIBPATH=env['build_base'] )
serverenv.PrependUnique( LIBS=[env['SERVERLIB'], 'dl'] )

server = serverenv.Program(env['SERVER'], srcfiles_macosx_server)
serverenv.Install( env['BINDIR'], server )

drv = serverenv.SharedLibrary( 'jack_dummy', srcfiles_macosx_dummy )
serverenv.InstallAs( env['ADDON_DIR']+ '/jack_dummy.so', drv )

drv = serverenv.SharedLibrary( 'jack_coreaudio', srcfiles_macosx_coreaudio )
serverenv.InstallAs( env['ADDON_DIR']+ '/jack_coreaudio.so', drv )
