# $Id: Jamfile,v 1.86 2005/11/04 13:09:40 titer Exp $
#
# This file is part of the HandBrake source code.
# Homepage: <http://handbrake.fr/>.
# It may be used under the terms of the GNU General Public License.

SubDir TOP ;

# libhb + contrib libraries
HANDBRAKE_LIBS = libhb.a
          contrib/lib/liba52.a        contrib/lib/libavformat.a
          contrib/lib/libavcodec.a    contrib/lib/libavutil.a
          contrib/lib/libdca.a        contrib/lib/libdvdread.a
          contrib/lib/libmp4v2.a      contrib/lib/libfaac.a
          contrib/lib/libmp3lame.a    contrib/lib/libmpeg2.a
          contrib/lib/libvorbis.a     contrib/lib/libvorbisenc.a
          contrib/lib/libogg.a        contrib/lib/libsamplerate.a
          contrib/lib/libx264.a       contrib/lib/libxvidcore.a
          contrib/lib/libmkv.a        contrib/lib/libswscale.a
          contrib/lib/libtheora.a     contrib/lib/libfaad.a ;

if $(OS) = UNKNOWN
{
    OS = CYGWIN ;
}

if $(OS) = CYGWIN
{
    HANDBRAKE_LIBS = $(HANDBRAKE_LIBS) contrib/lib/libbz2.a contrib/lib/libz.a ;
}

if $(CSS) = 1
{
    HANDBRAKE_LIBS = $(HANDBRAKE_LIBS) contrib/lib/libdvdcss.a ;
}

# Interfaces
CLI_BIN = HandBrakeCLI ;
CLI_SRC = test/test.c 
          test/parsecsv.c ;
BEOS_BIN = HandBrake ;
BEOS_SRC = beos/HBApp.cpp beos/MainWindow.cpp beos/ScanWindow.cpp
           beos/PicWindow.cpp beos/Stepper.cpp beos/QueueWindow.cpp ;
WX_BIN   = wxHB ;
WX_SRC   = wx/hbWizard.cpp wx/wxHB.cpp ;
UI_BIN   = $(CLI_BIN) $(BEOS_BIN) $(WX_BIN) ;
UI_SRC   = $(CLI_SRC) $(BEOS_SRC) $(WX_SRC) ;

# CLI app
# Don't build the CLI from here if MACOSX, let xcode build it :)
if $(OS) != MACOSX
{
	Main $(CLI_BIN) : $(CLI_SRC) ;
}

if $(OS) = BEOS
{
    Main HandBrake : $(BEOS_SRC) ;

    BeOSPackage HandBrake-$(HB_VERSION)-BeOS.zip : HandBrake ;
    HB_PACKAGES += HandBrake-$(HB_VERSION)-BeOS.zip ;
}
if $(OS) = MACOSX
{
    OSX_SRC = macosx/main.mm macosx/Controller.h macosx/Controller.mm
              macosx/PictureController.h macosx/PictureController.mm
              macosx/HBQueueController.h macosx/HBQueueController.mm
              macosx/HBAdvancedController.h macosx/HBAdvancedController.m
              macosx/HBImageAndTextCell.h macosx/HBImageAndTextCell.m
              macosx/HBPreferencesController.h macosx/HBPreferencesController.m
              macosx/HBPresets.h macosx/HBPresets.m
              macosx/English.lproj/InfoPlist.strings ;
              
    OSXApp HandBrake.app : $(OSX_SRC) $(HANDBRAKE_LIBS) ;
    
    # Package
    OSXPackage HandBrake-$(HB_VERSION)-OSX.zip : HandBrake.app ;
    HB_PACKAGES += HandBrake-$(HB_VERSION)-OSX.zip ;
}
if $(OS) = LINUX
{
    # WX UI outdated
    #SystemLibraries $(WX_BIN) : -lpthread `wx-config --libs` ;
    #ObjectC++Flags  $(WX_SRC) : `wx-config --cflags` ;
    #Main            $(WX_BIN) : $(WX_SRC) ;
}

if $(OS) != MACOSX
{
	ObjectHdrs     $(UI_SRC) : $(TOP)/libhb ;
	LinkLibraries  $(UI_BIN) : $(HANDBRAKE_LIBS) ;
}
# Packages
NotFile package ;
Depends package : $(HB_PACKAGES) ;

SubInclude TOP contrib ;
SubInclude TOP libhb ;