#!/bin/env python
##########################################################
#
# scons - buildsystem for alock
#
##########################################################

alock_sources = [ 'alock.c', 'alock_utils.c', 'alock_frame.c' ]

auth_sources = [ 'auth_none.c' ]
bg_sources = [ 'bg_none.c', 'bg_blank.c' ]
cursor_sources = [ 'cursor_none.c', 'cursor_theme.c', 'cursor_glyph.c' ]

Import('alock_env')

build =  alock_env.Clone()


if build['passwd']:
    auth_sources += [ 'auth_passwd.c' ]
if build['hash']:
    auth_sources += [ 'auth_md5.c', 'auth_sha1.c', 'auth_sha2.c', 'auth_wpool.c' ]
if build['pam']:
    auth_sources += [ 'auth_pam.c' ]

if build['xcursor']:
    cursor_sources += [ 'cursor_xcursor.c' ]

if build['imlib2']:
    bg_sources += [ 'bg_image.c' ]
if build['xrender']:
    bg_sources += [ 'bg_shade.c']
    if build['xrender'] or build['xpm']:
        cursor_sources += ['cursor_image.c']

alock_sources += auth_sources + bg_sources + cursor_sources

alock = build.Program('alock', alock_sources)

if build['amd5']:
    md5 = Environment()
    md5.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ])
    md5.Program('amd5', md5.StaticObject(target = 'amd5.o', source = 'auth_md5.c'))

if build['asha1']:
    sha1 = Environment()
    sha1.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ])
    sha1.Program('asha1', sha1.StaticObject(target = 'asha1', source = 'auth_sha1.c'))

if build['asha2']:
    sha2 = Environment()
    sha2.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ])
    sha2.Program('asha2', sha2.StaticObject(target = 'asha2', source = 'auth_sha2.c'))

if build['awpool']:
    wpool = Environment()
    wpool.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ])
    wpool.Program('awpool', wpool.StaticObject(target = 'apool', source = 'auth_wpool.c'))


# vim:ft=python
