# -*- mode: python -*-

Import([
    "env",
    ])

env = env.Clone()

env['CCFLAGS_WERROR'] = []

def removeIfPresent(lst, item):
    try:
        lst.remove(item)
    except ValueError:
        pass

for to_remove in ['-Wall', '-W']:
    removeIfPresent(env['CCFLAGS'], to_remove)

env.Prepend(CPPPATH=[
    'src/headers',
])

env.Append(
    CPPDEFINES=[
        'LTC_NO_PROTOTYPES',
    ]
)

env.Library(
    target="tomcrypt",
    source= [
        "src/ciphers/aes/aes.c",
        "src/ciphers/aes/aes_tab.c",
        "src/hashes/helper/hash_memory.c",
        "src/hashes/sha1.c",
        "src/hashes/sha2/sha256.c",
        "src/hashes/sha2/sha512.c",
        "src/modes/cbc/cbc_done.c",
        "src/modes/cbc/cbc_start.c",
        "src/modes/cbc/cbc_encrypt.c",
        "src/modes/cbc/cbc_decrypt.c",
        "src/modes/ctr/ctr_done.c",
        "src/modes/ctr/ctr_start.c",
        "src/modes/ctr/ctr_encrypt.c",
        "src/modes/ctr/ctr_decrypt.c",
        "src/mac/hmac/hmac_done.c",
        "src/mac/hmac/hmac_init.c",
        "src/mac/hmac/hmac_memory.c",
        "src/mac/hmac/hmac_process.c",
        "src/misc/compare_testvector.c",
        "src/misc/crypt/crypt_argchk.c",
        "src/misc/crypt/crypt_cipher_is_valid.c",
        "src/misc/crypt/crypt_cipher_descriptor.c",
        "src/misc/crypt/crypt_find_cipher.c",
        "src/misc/crypt/crypt_find_hash.c",
        "src/misc/crypt/crypt_hash_descriptor.c",
        "src/misc/crypt/crypt_hash_is_valid.c",
        "src/misc/crypt/crypt_register_cipher.c",
        "src/misc/crypt/crypt_register_hash.c",
        "src/misc/zeromem.c",
    ],
)
