# Sconscript file to build the bootloader
# Copyright (C) 2005, Giovanni Bajo
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

Import("env")

env.Append(CPPPATH = [ "zlib", "common" ])

if env["PYINST_FLAVOUR"] == "debug":
    # launch.c prints some debug messages to the console if this macro is defined
    env.Append(CPPDEFINES = ["LAUNCH_DEBUG"])

if Platform().name == "win32":
    if env["PYINST_MODE"] == "cons":
        resfile = env.RES("windows/run.rc")
    else:
        resfile = env.RES("windows/runw.rc")

zlib = env.Library("zlib",
                    ["zlib/inflate.c",
                     "zlib/crc32.c",
                     "zlib/adler32.c",
                     "zlib/zutil.c",
                     "zlib/inffast.c",
                     "zlib/inftrees.c"])
run = env.Program("run",
                 ["common/launch.c", "windows/winmain.c", zlib, resfile])
dll = env.SharedLibrary("inprocsrvr",
                        ["common/launch.c", "windows/dllmain.c", zlib])

Return("run", "dll")
