More animation work
[potpourri.git] / SConstruct
blob9220d38a4c321d4874ac618cf27816b6e2cc68ca
1 # Copyright 2008 Brian Caine
3 # This file is part of Potpourri.
5 # Potpourri is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # Potpourri is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTIBILITY of FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Potpourri. If not, see <http://www.gnu.org/licenses/>.
18 import glob, os
19 import SConsStuff
21 release = 'release' in COMMAND_LINE_TARGETS
23 debug_env = Environment(CCFLAGS='-g')
24 release_env = Environment()
26 Alias('release', '.')
28 env = 1
30 if release:
31 env = release_env
32 else:
33 env = debug_env
35 pkg_config = SConsStuff.pkg_config
36 other_command = SConsStuff.other_command
38 #sed_string = """ "s/.*/\"&\\\n\"/g; 1 {s/.*/#ifndef __GAME_H\n#define
39 #__TEST__H\n\nconst std::string game_dtd =\n&/g}; $
40 #{s/.*/&;\n\n#endif/g}" """
42 sed_string = (' "s/.*/\\"&' + "\\\\\\n" +
43 '\\"/g; 1{s/.*/#ifndef __TEST__H\\n#define __TEST__H\\n\\nconst std::string name_str = \\n&/g}; $ {s/.*/&;\\n\\n#endif/g}" ')
45 for file in glob.glob("dtd/*.dtd"):
46 header = file.rstrip('dtd') + 'h'
47 name = file.rstrip('.dtd').lstrip('dtd/').upper()
48 other_command('cat ' + file + ' | sed -e ' +
49 sed_string.replace('TEST', name).replace('name', name.lower()) +
50 ' > d; mv d ' + header)
52 Export('release env pkg_config other_command')
54 for dir in os.listdir("src"):
55 path = "src/" + dir + "/SConscript"
56 if os.path.exists(path):
57 sub_target = SConscript(path)