forked from opencb-hpg/common-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConscript
85 lines (62 loc) · 2.8 KB
/
SConscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Import('debug', 'compiler')
# Initialize environment
env = Environment(CC = compiler,
CFLAGS = '-std=c99 -D_GNU_SOURCE -D_XOPEN_SOURCE=600 ',
CPPPATH = ['#', '/usr/include/libxml2', '.' ],
LIBPATH = ['/usr/lib' ])
env.Decider('MD5-timestamp')
if debug == 1:
env['CFLAGS'] += '-O0 -g'
else:
env['CFLAGS'] += '-O3'
# Targets
commons_obj = env.Object(Glob('commons/*.c'))
containers_obj = env.Object(Glob('containers/*.c'))
# Compile containers/cprops objects but ONLY those used for our libraries
cpropsenv = Environment(CC = compiler,
CFLAGS = '-D_REENTRANT -D_GNU_SOURCE -DHAVE_CONFIG_H ',
CPPPATH = ['#', '/usr/include/libxml2', '.' ],
LIBPATH = ['/usr/lib' ])
cpropsenv.Decider('MD5-timestamp')
if debug == 1:
cpropsenv['CFLAGS'] += '-O0 -g'
else:
cpropsenv['CFLAGS'] += '-O3'
cprops_obj = cpropsenv.Object(['containers/cprops/avl.c', 'containers/cprops/collection.c', 'containers/cprops/hashlist.c', 'containers/cprops/hashtable.c', 'containers/cprops/heap.c', 'containers/cprops/linked_list.c', 'containers/cprops/log.c', 'containers/cprops/mempool.c', 'containers/cprops/rb.c', 'containers/cprops/util.c', 'containers/cprops/vector.c'])
# Compile commons/sqlite objects
sqliteenv = Environment(CC = compiler,
CFLAGS = '-DHAVE_CONFIG_H -fPIC -DPIC ',
CPPPATH = ['#', '.' ],
LIBPATH = ['/usr/lib' ])
sqliteenv.Decider('MD5-timestamp')
if debug == 1:
sqliteenv['CFLAGS'] += '-O0 -g'
else:
sqliteenv['CFLAGS'] += '-O2 -g'
sqlite_obj = sqliteenv.Object(Glob('commons/sqlite/*.c'))
# Compile commons/argtable objects
argtableenv = Environment(CC = compiler,
CFLAGS = '-DHAVE_CONFIG_H -fPIC -DPIC ',
CPPPATH = ['#', '.' ],
LIBPATH = ['/usr/lib' ])
argtableenv.Decider('MD5-timestamp')
if debug == 1:
argtableenv['CFLAGS'] += '-O0 -g'
else:
argtableenv['CFLAGS'] += '-O2 -g'
argtable_obj = argtableenv.Object(Glob('commons/argtable/*.c'))
# Compile commons/config objects
configenv = Environment(CC = compiler,
CFLAGS = '-DHAVE_CONFIG_H -D_REENTRANT -Wall -Wshadow -Wextra -Wdeclaration-after-statement -Wno-unused-parameter ',
CPPPATH = ['#', '.' ],
LIBPATH = ['/usr/lib' ])
configenv.Decider('MD5-timestamp')
if debug == 1:
configenv['CFLAGS'] += '-O0 -g'
else:
configenv['CFLAGS'] += '-O2 -g'
config_obj = configenv.Object(Glob('commons/config/*.c'))
# Objects
env.Library('common', commons_obj + containers_obj + cprops_obj + sqlite_obj + argtable_obj + config_obj)
# Run tests
containers_test = SConscript("containers/test/SConscript", exports = ['env', 'debug'] )