Create subdirectory src and move source files into it.
[vomak.git] / wscript
bloba567e3f4a25d433759a146350eb087972eb92061
1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # WAF build script - this file is part of vomak - a very simple IRC bot
6 # Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 # $Id: wscript 2649 2008-06-05 16:52:39Z eht16 $
23 """
24 This is a WAF build script (http://code.google.com/p/waf/).
25 """
28 import Params, subprocess, sys
31 APPNAME = 'vomak'
32 VERSION = '0.1'
34 srcdir = '.'
35 blddir = 'build'
38 def configure(conf):
40 conf.check_tool('compiler_cc')
42 conf.check_pkg('glib-2.0', destvar='GLIB', vnum='2.6.0', mandatory=True)
44 if Params.g_options.debug:
45 conf.env.append_value('CCFLAGS', '-g -DDEBUG -O0')
48 def set_options(opt):
49 opt.tool_options('compiler_cc')
51 opt.add_option('--html', action='store_true', default=False,
52 help='generate HTML doc [default: No]', dest='html')
54 opt.add_option('--debug', action='store_true', default=False,
55 help='enable debug mode [default: No]', dest='debug')
58 def build(bld):
59 obj = bld.create_obj('cc', 'program')
60 obj.name = 'vomak'
61 obj.target = 'vomak'
62 obj.source = 'src/irc.c src/socket.c src/vomak.c'
63 obj.includes = '.'
64 obj.uselib = 'GLIB'
67 def init():
68 if Params.g_options.html:
69 ret = launch('rst2html -stg --stylesheet=vomak.css README readme.html',
70 'Generating HTML documentation')
71 sys.exit(ret)
74 # Simple function to execute a command and print its exit status
75 def launch(command, status):
76 ret = 0
77 Params.pprint('GREEN', status)
78 try:
79 ret = subprocess.call(command.split())
80 except:
81 ret = 1
83 if ret != 0:
84 Params.pprint('RED', status + ' failed')
86 return ret