#! /usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


"""
Bootloader building script.
"""


# TODO Finish migration from waf 1.5 to 1.7 syntax.


top = '.'
out = 'build'


def options(ctx):
    ctx.load('compiler_c')


def configure(ctx):
    ctx.load('compiler_c')
    ctx.check_inline()
    ctx.check_endianness()

    libs = 'dl m z'.split()  # m - math, z - zlib
    for l in libs:
        ctx.check_cc(lib=l)


def build(ctx):
    ctx.program(
        #features = 'aaa',
        source   = ctx.path.ant_glob('common/main.c linux/*.c common/*.c'),
        includes = 'linux common',
        lib      = 'dl m z',
        #cflags   = ['-g'],
        target   = 'run',
    )

