import os, re, imp

if GetOption('win64'):
    from utils import win_build as c
else:
    from utils import linux_build as c

# Write all default parameters
sourcepaths = c.sourcepaths
libpaths    = c.libpaths
cppflags    = c.cppflags
linkflags   = c.linkflags
lSDL      = c.lSDL
lSDLimage = c.lSDLimage
lSDLmixer = c.lSDLmixer
lSDLttf   = c.lSDLttf
lBullet   = c.lBullet
lGL       = c.lGL
lFlite    = c.lFlite
lNoise    = c.lNoise
lPolyVox  = c.lPolyVox
lLsNet   = c.lLsNet
lOther    = c.lOther
lAll      = c.lAll
lAngelScript  = c.lAngelScript

Import('env')
libprefix = env['base_lib_dir']
libpaths.append(libprefix)
cppflags += env['cc_optflags']

# List of unit test files to prune away
unitTests = set(Glob('Test*.cpp') + Glob('*/Test*.cpp') + Glob('*/*/Test*.cpp'))
flymakeFiles = set(Glob('*/*_flymake.cpp') + Glob('*/*/*_flymake.cpp'))
env.Append(CPPPATH   = sourcepaths)
env.Append(LIBPATH   = libpaths)
env.Append(CPPFLAGS  = cppflags)
env.Append(CPPPATH   = sourcepaths)
env.Append(LINKFLAGS = linkflags)

swlMain = os.getenv('SWL_MAIN_FILE', 'main.cpp')
swlTargetSuffix = os.getenv('SWL_TARGET_SUFFIX', '')
target = env['base_exec_dir'] + '/main' + swlTargetSuffix

if GetOption('win64'):
    #############################################
    #           WINDOWS BUILD
    #############################################
    #-------------------------------------------#
    cppFiles = [Glob(swlMain) +
                Glob('extern/*.cpp') +
                Glob('util/*.cpp') +
                Glob('io/*.cpp') +
                Glob('audio/*.cpp') +
                Glob('model/*.cpp') +
                Glob('core/*.cpp') +
                Glob('graphics/*.cpp') +
                Glob('net/*.cpp') +
                Glob('math/*.cpp')]
    app = env.Program(target, cppFiles,
                      LIBPATH = libpaths,
                      CPPFLAGS = cppflags,
                      LINKFLAGS = ('--static -Wl,--no-undefined ' +
                                   '-static-libgcc -static-libstdc++'),
                      LIBS = (lSDL + lSDLmixer + lSDLttf + lSDLimage +
                              lNoise + lPolyVox + lFlite + lBullet +
                              lAngelScript +
                              lLsNet +
                              lGL + lOther))
    Default(app)

else:
    #############################################
    #           LINUX BUILD
    #############################################
    #-------------------------------------------#

    ######################
    # COMMON LIBARIES
    #######################

    # MATH
    #######################
    mathFiles = [list(set(Glob('math/*.cpp') +
                          Glob('math/*/*.cpp')) - unitTests - flymakeFiles)]

    mathLib = env.SharedLibrary(libprefix + '/swl-math',
                                mathFiles,
                                LIBS    = [],
                                LIBPATH = []);
    Default(mathLib)


    # EXTERNAL
    #######################
    externFiles = [list(set(Glob('extern/*.cpp') +
                            Glob('extern/*/*.cpp')) - unitTests - flymakeFiles)]
    externLib = env.SharedLibrary(libprefix + '/swl-extern',
                              externFiles,
                              LIBS     = [],
                              LIBPATH  = []);
    Default(externLib)

    # UTIL
    #######################
    utilFiles = [list(set(Glob('util/*.cpp') +
                          Glob('util/*/*.cpp')) - unitTests - flymakeFiles)]
    utilLib = env.SharedLibrary(libprefix + '/swl-util',
                                utilFiles,
                                LIBS = externLib + mathLib + lSDL +
                                lAngelScript + lNoise);
    Default(utilLib)


    # common libs grouping
    #-------------------------------------------#
    commonLibs = [mathLib + externLib + utilLib + lSDL]

    ######################
    # SYSTEM LIBRARIES
    #######################

    # AUDIO
    #######################
    audioFiles = [list(set(Glob('audio/*.cpp') +
                           Glob('audio/*/*.cpp')) - unitTests - flymakeFiles)]
    audioLib = env.SharedLibrary(libprefix + '/swl-audio',
                                 audioFiles,
                                 LIBS = commonLibs +
                                 lSDLmixer + lFlite);
    Default(audioLib)

    # GRAPHICS
    #######################
    graphicsFiles = [list(set(Glob('graphics/*.cpp') +
                              Glob('graphics/*/*.cpp'))
                          - unitTests - flymakeFiles)]
    graphicsLib = env.SharedLibrary(libprefix + '/swl-graphics',
                                    graphicsFiles,
                                    LIBS = commonLibs +
                                    lSDLimage + lSDLttf + lGL);
    Default(graphicsLib)


    # IO
    #######################
    ioFiles = [list(set(Glob('io/*.cpp') +
                        Glob('io/*/*.cpp')) - unitTests - flymakeFiles)]
    ioLib = env.SharedLibrary(libprefix + '/swl-io',
                              ioFiles,
                              LIBS = commonLibs);
    Default(ioLib)


    # NET
    #######################
    netFiles = [list(set(Glob('net/*.cpp') +
                         Glob('net/*/*.cpp')) - unitTests - flymakeFiles)]
    netLib = env.SharedLibrary(libprefix + '/swl-net',
                               netFiles,
                               LIBS = commonLibs + lLsNet);
    Default(netLib)



    # MODEL
    #######################
    modelFiles = [list(set(Glob('model/*.cpp') +
                           Glob('model/*/*.cpp')) - unitTests - flymakeFiles)]
    modelLib = env.SharedLibrary(libprefix + '/swl-model',
                                 modelFiles,
                                 LIBS = commonLibs + lBullet + lPolyVox);
    Default(modelLib)


    # systems libs grouping
    #-------------------------------------------#
    systemsLibs = [ audioLib + lSDLmixer +
                    graphicsLib + lSDLimage + lSDLttf + lGL +
                    modelLib + lBullet +
                    netLib +
                    ioLib ]


    # SHARED CORE LIBRARY
    #######################
    coreFiles = [list(set(Glob('core/*.cpp') +
                          Glob('core/*/*.cpp')) - unitTests - flymakeFiles)]
    coreLib = env.SharedLibrary(libprefix + '/swl-core',
                                coreFiles,
                                LIBS = commonLibs + systemsLibs)
    Default(coreLib)


    ######################
    # Main Application
    #######################
    cppMain = Glob(swlMain)
    app = env.Program(target, cppMain,
                      LIBPATH  = libpaths,
                      CPPFLAGS = cppflags,
                      LIBS = coreLib + commonLibs + systemsLibs + lOther)
    Default(app)

dd663269fc633d027a5703e997b562bf9cd1c17b
<mask token>

<mask token>
if GetOption('win64'):
    from utils import win_build as c
else:
    from utils import linux_build as c
<mask token>
Import('env')
<mask token>
libpaths.append(libprefix)
cppflags += env['cc_optflags']
<mask token>
env.Append(CPPPATH=sourcepaths)
env.Append(LIBPATH=libpaths)
env.Append(CPPFLAGS=cppflags)
env.Append(CPPPATH=sourcepaths)
env.Append(LINKFLAGS=linkflags)
<mask token>
if GetOption('win64'):
    cppFiles = [Glob(swlMain) + Glob('extern/*.cpp') + Glob('util/*.cpp') +
        Glob('io/*.cpp') + Glob('audio/*.cpp') + Glob('model/*.cpp') + Glob
        ('core/*.cpp') + Glob('graphics/*.cpp') + Glob('net/*.cpp') + Glob(
        'math/*.cpp')]
    app = env.Program(target, cppFiles, LIBPATH=libpaths, CPPFLAGS=cppflags,
        LINKFLAGS='--static -Wl,--no-undefined ' +
        '-static-libgcc -static-libstdc++', LIBS=lSDL + lSDLmixer + lSDLttf +
        lSDLimage + lNoise + lPolyVox + lFlite + lBullet + lAngelScript +
        lLsNet + lGL + lOther)
    Default(app)
else:
    mathFiles = [list(set(Glob('math/*.cpp') + Glob('math/*/*.cpp')) -
        unitTests - flymakeFiles)]
    mathLib = env.SharedLibrary(libprefix + '/swl-math', mathFiles, LIBS=[],
        LIBPATH=[])
    Default(mathLib)
    externFiles = [list(set(Glob('extern/*.cpp') + Glob('extern/*/*.cpp')) -
        unitTests - flymakeFiles)]
    externLib = env.SharedLibrary(libprefix + '/swl-extern', externFiles,
        LIBS=[], LIBPATH=[])
    Default(externLib)
    utilFiles = [list(set(Glob('util/*.cpp') + Glob('util/*/*.cpp')) -
        unitTests - flymakeFiles)]
    utilLib = env.SharedLibrary(libprefix + '/swl-util', utilFiles, LIBS=
        externLib + mathLib + lSDL + lAngelScript + lNoise)
    Default(utilLib)
    commonLibs = [mathLib + externLib + utilLib + lSDL]
    audioFiles = [list(set(Glob('audio/*.cpp') + Glob('audio/*/*.cpp')) -
        unitTests - flymakeFiles)]
    audioLib = env.SharedLibrary(libprefix + '/swl-audio', audioFiles, LIBS
        =commonLibs + lSDLmixer + lFlite)
    Default(audioLib)
    graphicsFiles = [list(set(Glob('graphics/*.cpp') + Glob(
        'graphics/*/*.cpp')) - unitTests - flymakeFiles)]
    graphicsLib = env.SharedLibrary(libprefix + '/swl-graphics',
        graphicsFiles, LIBS=commonLibs + lSDLimage + lSDLttf + lGL)
    Default(graphicsLib)
    ioFiles = [list(set(Glob('io/*.cpp') + Glob('io/*/*.cpp')) - unitTests -
        flymakeFiles)]
    ioLib = env.SharedLibrary(libprefix + '/swl-io', ioFiles, LIBS=commonLibs)
    Default(ioLib)
    netFiles = [list(set(Glob('net/*.cpp') + Glob('net/*/*.cpp')) -
        unitTests - flymakeFiles)]
    netLib = env.SharedLibrary(libprefix + '/swl-net', netFiles, LIBS=
        commonLibs + lLsNet)
    Default(netLib)
    modelFiles = [list(set(Glob('model/*.cpp') + Glob('model/*/*.cpp')) -
        unitTests - flymakeFiles)]
    modelLib = env.SharedLibrary(libprefix + '/swl-model', modelFiles, LIBS
        =commonLibs + lBullet + lPolyVox)
    Default(modelLib)
    systemsLibs = [audioLib + lSDLmixer + graphicsLib + lSDLimage + lSDLttf +
        lGL + modelLib + lBullet + netLib + ioLib]
    coreFiles = [list(set(Glob('core/*.cpp') + Glob('core/*/*.cpp')) -
        unitTests - flymakeFiles)]
    coreLib = env.SharedLibrary(libprefix + '/swl-core', coreFiles, LIBS=
        commonLibs + systemsLibs)
    Default(coreLib)
    cppMain = Glob(swlMain)
    app = env.Program(target, cppMain, LIBPATH=libpaths, CPPFLAGS=cppflags,
        LIBS=coreLib + commonLibs + systemsLibs + lOther)
    Default(app)

<mask token>
if GetOption('win64'):
    from utils import win_build as c
else:
    from utils import linux_build as c
sourcepaths = c.sourcepaths
libpaths = c.libpaths
cppflags = c.cppflags
linkflags = c.linkflags
lSDL = c.lSDL
lSDLimage = c.lSDLimage
lSDLmixer = c.lSDLmixer
lSDLttf = c.lSDLttf
lBullet = c.lBullet
lGL = c.lGL
lFlite = c.lFlite
lNoise = c.lNoise
lPolyVox = c.lPolyVox
lLsNet = c.lLsNet
lOther = c.lOther
lAll = c.lAll
lAngelScript = c.lAngelScript
Import('env')
libprefix = env['base_lib_dir']
libpaths.append(libprefix)
cppflags += env['cc_optflags']
unitTests = set(Glob('Test*.cpp') + Glob('*/Test*.cpp') + Glob('*/*/Test*.cpp')
    )
flymakeFiles = set(Glob('*/*_flymake.cpp') + Glob('*/*/*_flymake.cpp'))
env.Append(CPPPATH=sourcepaths)
env.Append(LIBPATH=libpaths)
env.Append(CPPFLAGS=cppflags)
env.Append(CPPPATH=sourcepaths)
env.Append(LINKFLAGS=linkflags)
swlMain = os.getenv('SWL_MAIN_FILE', 'main.cpp')
swlTargetSuffix = os.getenv('SWL_TARGET_SUFFIX', '')
target = env['base_exec_dir'] + '/main' + swlTargetSuffix
if GetOption('win64'):
    cppFiles = [Glob(swlMain) + Glob('extern/*.cpp') + Glob('util/*.cpp') +
        Glob('io/*.cpp') + Glob('audio/*.cpp') + Glob('model/*.cpp') + Glob
        ('core/*.cpp') + Glob('graphics/*.cpp') + Glob('net/*.cpp') + Glob(
        'math/*.cpp')]
    app = env.Program(target, cppFiles, LIBPATH=libpaths, CPPFLAGS=cppflags,
        LINKFLAGS='--static -Wl,--no-undefined ' +
        '-static-libgcc -static-libstdc++', LIBS=lSDL + lSDLmixer + lSDLttf +
        lSDLimage + lNoise + lPolyVox + lFlite + lBullet + lAngelScript +
        lLsNet + lGL + lOther)
    Default(app)
else:
    mathFiles = [list(set(Glob('math/*.cpp') + Glob('math/*/*.cpp')) -
        unitTests - flymakeFiles)]
    mathLib = env.SharedLibrary(libprefix + '/swl-math', mathFiles, LIBS=[],
        LIBPATH=[])
    Default(mathLib)
    externFiles = [list(set(Glob('extern/*.cpp') + Glob('extern/*/*.cpp')) -
        unitTests - flymakeFiles)]
    externLib = env.SharedLibrary(libprefix + '/swl-extern', externFiles,
        LIBS=[], LIBPATH=[])
    Default(externLib)
    utilFiles = [list(set(Glob('util/*.cpp') + Glob('util/*/*.cpp')) -
        unitTests - flymakeFiles)]
    utilLib = env.SharedLibrary(libprefix + '/swl-util', utilFiles, LIBS=
        externLib + mathLib + lSDL + lAngelScript + lNoise)
    Default(utilLib)
    commonLibs = [mathLib + externLib + utilLib + lSDL]
    audioFiles = [list(set(Glob('audio/*.cpp') + Glob('audio/*/*.cpp')) -
        unitTests - flymakeFiles)]
    audioLib = env.SharedLibrary(libprefix + '/swl-audio', audioFiles, LIBS
        =commonLibs + lSDLmixer + lFlite)
    Default(audioLib)
    graphicsFiles = [list(set(Glob('graphics/*.cpp') + Glob(
        'graphics/*/*.cpp')) - unitTests - flymakeFiles)]
    graphicsLib = env.SharedLibrary(libprefix + '/swl-graphics',
        graphicsFiles, LIBS=commonLibs + lSDLimage + lSDLttf + lGL)
    Default(graphicsLib)
    ioFiles = [list(set(Glob('io/*.cpp') + Glob('io/*/*.cpp')) - unitTests -
        flymakeFiles)]
    ioLib = env.SharedLibrary(libprefix + '/swl-io', ioFiles, LIBS=commonLibs)
    Default(ioLib)
    netFiles = [list(set(Glob('net/*.cpp') + Glob('net/*/*.cpp')) -
        unitTests - flymakeFiles)]
    netLib = env.SharedLibrary(libprefix + '/swl-net', netFiles, LIBS=
        commonLibs + lLsNet)
    Default(netLib)
    modelFiles = [list(set(Glob('model/*.cpp') + Glob('model/*/*.cpp')) -
        unitTests - flymakeFiles)]
    modelLib = env.SharedLibrary(libprefix + '/swl-model', modelFiles, LIBS
        =commonLibs + lBullet + lPolyVox)
    Default(modelLib)
    systemsLibs = [audioLib + lSDLmixer + graphicsLib + lSDLimage + lSDLttf +
        lGL + modelLib + lBullet + netLib + ioLib]
    coreFiles = [list(set(Glob('core/*.cpp') + Glob('core/*/*.cpp')) -
        unitTests - flymakeFiles)]
    coreLib = env.SharedLibrary(libprefix + '/swl-core', coreFiles, LIBS=
        commonLibs + systemsLibs)
    Default(coreLib)
    cppMain = Glob(swlMain)
    app = env.Program(target, cppMain, LIBPATH=libpaths, CPPFLAGS=cppflags,
        LIBS=coreLib + commonLibs + systemsLibs + lOther)
    Default(app)

import os, re, imp
if GetOption('win64'):
    from utils import win_build as c
else:
    from utils import linux_build as c
sourcepaths = c.sourcepaths
libpaths = c.libpaths
cppflags = c.cppflags
linkflags = c.linkflags
lSDL = c.lSDL
lSDLimage = c.lSDLimage
lSDLmixer = c.lSDLmixer
lSDLttf = c.lSDLttf
lBullet = c.lBullet
lGL = c.lGL
lFlite = c.lFlite
lNoise = c.lNoise
lPolyVox = c.lPolyVox
lLsNet = c.lLsNet
lOther = c.lOther
lAll = c.lAll
lAngelScript = c.lAngelScript
Import('env')
libprefix = env['base_lib_dir']
libpaths.append(libprefix)
cppflags += env['cc_optflags']
unitTests = set(Glob('Test*.cpp') + Glob('*/Test*.cpp') + Glob('*/*/Test*.cpp')
    )
flymakeFiles = set(Glob('*/*_flymake.cpp') + Glob('*/*/*_flymake.cpp'))
env.Append(CPPPATH=sourcepaths)
env.Append(LIBPATH=libpaths)
env.Append(CPPFLAGS=cppflags)
env.Append(CPPPATH=sourcepaths)
env.Append(LINKFLAGS=linkflags)
swlMain = os.getenv('SWL_MAIN_FILE', 'main.cpp')
swlTargetSuffix = os.getenv('SWL_TARGET_SUFFIX', '')
target = env['base_exec_dir'] + '/main' + swlTargetSuffix
if GetOption('win64'):
    cppFiles = [Glob(swlMain) + Glob('extern/*.cpp') + Glob('util/*.cpp') +
        Glob('io/*.cpp') + Glob('audio/*.cpp') + Glob('model/*.cpp') + Glob
        ('core/*.cpp') + Glob('graphics/*.cpp') + Glob('net/*.cpp') + Glob(
        'math/*.cpp')]
    app = env.Program(target, cppFiles, LIBPATH=libpaths, CPPFLAGS=cppflags,
        LINKFLAGS='--static -Wl,--no-undefined ' +
        '-static-libgcc -static-libstdc++', LIBS=lSDL + lSDLmixer + lSDLttf +
        lSDLimage + lNoise + lPolyVox + lFlite + lBullet + lAngelScript +
        lLsNet + lGL + lOther)
    Default(app)
else:
    mathFiles = [list(set(Glob('math/*.cpp') + Glob('math/*/*.cpp')) -
        unitTests - flymakeFiles)]
    mathLib = env.SharedLibrary(libprefix + '/swl-math', mathFiles, LIBS=[],
        LIBPATH=[])
    Default(mathLib)
    externFiles = [list(set(Glob('extern/*.cpp') + Glob('extern/*/*.cpp')) -
        unitTests - flymakeFiles)]
    externLib = env.SharedLibrary(libprefix + '/swl-extern', externFiles,
        LIBS=[], LIBPATH=[])
    Default(externLib)
    utilFiles = [list(set(Glob('util/*.cpp') + Glob('util/*/*.cpp')) -
        unitTests - flymakeFiles)]
    utilLib = env.SharedLibrary(libprefix + '/swl-util', utilFiles, LIBS=
        externLib + mathLib + lSDL + lAngelScript + lNoise)
    Default(utilLib)
    commonLibs = [mathLib + externLib + utilLib + lSDL]
    audioFiles = [list(set(Glob('audio/*.cpp') + Glob('audio/*/*.cpp')) -
        unitTests - flymakeFiles)]
    audioLib = env.SharedLibrary(libprefix + '/swl-audio', audioFiles, LIBS
        =commonLibs + lSDLmixer + lFlite)
    Default(audioLib)
    graphicsFiles = [list(set(Glob('graphics/*.cpp') + Glob(
        'graphics/*/*.cpp')) - unitTests - flymakeFiles)]
    graphicsLib = env.SharedLibrary(libprefix + '/swl-graphics',
        graphicsFiles, LIBS=commonLibs + lSDLimage + lSDLttf + lGL)
    Default(graphicsLib)
    ioFiles = [list(set(Glob('io/*.cpp') + Glob('io/*/*.cpp')) - unitTests -
        flymakeFiles)]
    ioLib = env.SharedLibrary(libprefix + '/swl-io', ioFiles, LIBS=commonLibs)
    Default(ioLib)
    netFiles = [list(set(Glob('net/*.cpp') + Glob('net/*/*.cpp')) -
        unitTests - flymakeFiles)]
    netLib = env.SharedLibrary(libprefix + '/swl-net', netFiles, LIBS=
        commonLibs + lLsNet)
    Default(netLib)
    modelFiles = [list(set(Glob('model/*.cpp') + Glob('model/*/*.cpp')) -
        unitTests - flymakeFiles)]
    modelLib = env.SharedLibrary(libprefix + '/swl-model', modelFiles, LIBS
        =commonLibs + lBullet + lPolyVox)
    Default(modelLib)
    systemsLibs = [audioLib + lSDLmixer + graphicsLib + lSDLimage + lSDLttf +
        lGL + modelLib + lBullet + netLib + ioLib]
    coreFiles = [list(set(Glob('core/*.cpp') + Glob('core/*/*.cpp')) -
        unitTests - flymakeFiles)]
    coreLib = env.SharedLibrary(libprefix + '/swl-core', coreFiles, LIBS=
        commonLibs + systemsLibs)
    Default(coreLib)
    cppMain = Glob(swlMain)
    app = env.Program(target, cppMain, LIBPATH=libpaths, CPPFLAGS=cppflags,
        LIBS=coreLib + commonLibs + systemsLibs + lOther)
    Default(app)

import os, re, imp

if GetOption('win64'):
    from utils import win_build as c
else:
    from utils import linux_build as c

# Write all default parameters
sourcepaths = c.sourcepaths
libpaths    = c.libpaths
cppflags    = c.cppflags
linkflags   = c.linkflags
lSDL      = c.lSDL
lSDLimage = c.lSDLimage
lSDLmixer = c.lSDLmixer
lSDLttf   = c.lSDLttf
lBullet   = c.lBullet
lGL       = c.lGL
lFlite    = c.lFlite
lNoise    = c.lNoise
lPolyVox  = c.lPolyVox
lLsNet   = c.lLsNet
lOther    = c.lOther
lAll      = c.lAll
lAngelScript  = c.lAngelScript

Import('env')
libprefix = env['base_lib_dir']
libpaths.append(libprefix)
cppflags += env['cc_optflags']

# List of unit test files to prune away
unitTests = set(Glob('Test*.cpp') + Glob('*/Test*.cpp') + Glob('*/*/Test*.cpp'))
flymakeFiles = set(Glob('*/*_flymake.cpp') + Glob('*/*/*_flymake.cpp'))
env.Append(CPPPATH   = sourcepaths)
env.Append(LIBPATH   = libpaths)
env.Append(CPPFLAGS  = cppflags)
env.Append(CPPPATH   = sourcepaths)
env.Append(LINKFLAGS = linkflags)

swlMain = os.getenv('SWL_MAIN_FILE', 'main.cpp')
swlTargetSuffix = os.getenv('SWL_TARGET_SUFFIX', '')
target = env['base_exec_dir'] + '/main' + swlTargetSuffix

if GetOption('win64'):
    #############################################
    #           WINDOWS BUILD
    #############################################
    #-------------------------------------------#
    cppFiles = [Glob(swlMain) +
                Glob('extern/*.cpp') +
                Glob('util/*.cpp') +
                Glob('io/*.cpp') +
                Glob('audio/*.cpp') +
                Glob('model/*.cpp') +
                Glob('core/*.cpp') +
                Glob('graphics/*.cpp') +
                Glob('net/*.cpp') +
                Glob('math/*.cpp')]
    app = env.Program(target, cppFiles,
                      LIBPATH = libpaths,
                      CPPFLAGS = cppflags,
                      LINKFLAGS = ('--static -Wl,--no-undefined ' +
                                   '-static-libgcc -static-libstdc++'),
                      LIBS = (lSDL + lSDLmixer + lSDLttf + lSDLimage +
                              lNoise + lPolyVox + lFlite + lBullet +
                              lAngelScript +
                              lLsNet +
                              lGL + lOther))
    Default(app)

else:
    #############################################
    #           LINUX BUILD
    #############################################
    #-------------------------------------------#

    ######################
    # COMMON LIBARIES
    #######################

    # MATH
    #######################
    mathFiles = [list(set(Glob('math/*.cpp') +
                          Glob('math/*/*.cpp')) - unitTests - flymakeFiles)]

    mathLib = env.SharedLibrary(libprefix + '/swl-math',
                                mathFiles,
                                LIBS    = [],
                                LIBPATH = []);
    Default(mathLib)


    # EXTERNAL
    #######################
    externFiles = [list(set(Glob('extern/*.cpp') +
                            Glob('extern/*/*.cpp')) - unitTests - flymakeFiles)]
    externLib = env.SharedLibrary(libprefix + '/swl-extern',
                              externFiles,
                              LIBS     = [],
                              LIBPATH  = []);
    Default(externLib)

    # UTIL
    #######################
    utilFiles = [list(set(Glob('util/*.cpp') +
                          Glob('util/*/*.cpp')) - unitTests - flymakeFiles)]
    utilLib = env.SharedLibrary(libprefix + '/swl-util',
                                utilFiles,
                                LIBS = externLib + mathLib + lSDL +
                                lAngelScript + lNoise);
    Default(utilLib)


    # common libs grouping
    #-------------------------------------------#
    commonLibs = [mathLib + externLib + utilLib + lSDL]

    ######################
    # SYSTEM LIBRARIES
    #######################

    # AUDIO
    #######################
    audioFiles = [list(set(Glob('audio/*.cpp') +
                           Glob('audio/*/*.cpp')) - unitTests - flymakeFiles)]
    audioLib = env.SharedLibrary(libprefix + '/swl-audio',
                                 audioFiles,
                                 LIBS = commonLibs +
                                 lSDLmixer + lFlite);
    Default(audioLib)

    # GRAPHICS
    #######################
    graphicsFiles = [list(set(Glob('graphics/*.cpp') +
                              Glob('graphics/*/*.cpp'))
                          - unitTests - flymakeFiles)]
    graphicsLib = env.SharedLibrary(libprefix + '/swl-graphics',
                                    graphicsFiles,
                                    LIBS = commonLibs +
                                    lSDLimage + lSDLttf + lGL);
    Default(graphicsLib)


    # IO
    #######################
    ioFiles = [list(set(Glob('io/*.cpp') +
                        Glob('io/*/*.cpp')) - unitTests - flymakeFiles)]
    ioLib = env.SharedLibrary(libprefix + '/swl-io',
                              ioFiles,
                              LIBS = commonLibs);
    Default(ioLib)


    # NET
    #######################
    netFiles = [list(set(Glob('net/*.cpp') +
                         Glob('net/*/*.cpp')) - unitTests - flymakeFiles)]
    netLib = env.SharedLibrary(libprefix + '/swl-net',
                               netFiles,
                               LIBS = commonLibs + lLsNet);
    Default(netLib)



    # MODEL
    #######################
    modelFiles = [list(set(Glob('model/*.cpp') +
                           Glob('model/*/*.cpp')) - unitTests - flymakeFiles)]
    modelLib = env.SharedLibrary(libprefix + '/swl-model',
                                 modelFiles,
                                 LIBS = commonLibs + lBullet + lPolyVox);
    Default(modelLib)


    # systems libs grouping
    #-------------------------------------------#
    systemsLibs = [ audioLib + lSDLmixer +
                    graphicsLib + lSDLimage + lSDLttf + lGL +
                    modelLib + lBullet +
                    netLib +
                    ioLib ]


    # SHARED CORE LIBRARY
    #######################
    coreFiles = [list(set(Glob('core/*.cpp') +
                          Glob('core/*/*.cpp')) - unitTests - flymakeFiles)]
    coreLib = env.SharedLibrary(libprefix + '/swl-core',
                                coreFiles,
                                LIBS = commonLibs + systemsLibs)
    Default(coreLib)


    ######################
    # Main Application
    #######################
    cppMain = Glob(swlMain)
    app = env.Program(target, cppMain,
                      LIBPATH  = libpaths,
                      CPPFLAGS = cppflags,
                      LIBS = coreLib + commonLibs + systemsLibs + lOther)
    Default(app)
