source: trunk/SConstruct @ 235

Last change on this file since 235 was 234, checked in by tim, 14 years ago

improvements to version determination

File size: 2.8 KB
Line 
1import sys
2import os
3sys.dont_write_bytecode = True
4from regfi_version import REGFI_VERSION
5
6cflags = '-std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -fvisibility=hidden'
7cflags += ' -DREGFI_VERSION=\'"%s"\'' % REGFI_VERSION
8cflags += ' -ggdb'
9
10lib_src = ['lib/regfi.c',
11           'lib/winsec.c',
12           'lib/range_list.c',
13           'lib/lru_cache.c',
14           'lib/void_stack.c']
15
16env = Environment(CFLAGS=cflags,
17                  CPPPATH=['include', '/usr/local/include'],
18                  LIBPATH=['lib', '/usr/local/lib'],
19                  LIBS=['m', 'pthread', 'regfi', 'talloc'])
20
21
22# Libraries
23libregfi_static = env.Library(lib_src)
24libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'])
25
26
27# Executables
28reglookup = env.Program(['src/reglookup.c'])
29reglookup_recover = env.Program(['src/reglookup-recover.c'])
30
31
32# Documentation
33#  This only needs to be run during the release/packaging process
34man_fixup = "|sed 's/.SH DESCRIPTION/\\n.SH DESCRIPTION/'"
35man_builder = Builder(action='docbook2x-man --to-stdout $SOURCE'
36                      + man_fixup + '| gzip -9 > $TARGET',
37                      suffix = '.gz',
38                      src_suffix = '.docbook')
39env['BUILDERS']['ManPage'] = man_builder
40
41man_reglookup = env.ManPage('doc/reglookup.1.docbook')
42man_reglookup_recover = env.ManPage('doc/reglookup-recover.1.docbook')
43man_reglookup_timeline = env.ManPage('doc/reglookup-timeline.1.docbook')
44
45# Installation
46prefix='/usr/local/'
47install_items = [prefix+'bin',
48                 prefix+'lib',
49                 prefix+'include/regfi',
50                 prefix+'man']
51
52env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
53env.Install(prefix+'lib', [libregfi, libregfi_static])
54env.Install(prefix+'include/regfi', Glob('include/*.h'))
55env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover,
56                                man_reglookup_timeline])
57
58if sys.version_info[0] == 2:
59   install_items.append('pyregfi2-install.log')
60   env.Command('pyregfi2-install.log', ['python/pyregfi/__init__.py', 'python/pyregfi/structures.py'],
61               "python pyregfi-distutils.py install | tee pyregfi2-install.log")
62
63python_path = os.popen('which python3').read()
64if python_path != '':
65   install_items.append('pyregfi3-install.log')
66   env.Command('pyregfi3-install.log', ['python/pyregfi/__init__.py', 'python/pyregfi/structures.py'],
67               "python3 pyregfi-distutils.py install | tee pyregfi3-install.log")
68
69
70# User Friendly Targets
71env.Alias('libregfi', libregfi)
72env.Alias('reglookup', reglookup)
73env.Alias('reglookup-recover', reglookup_recover)
74env.Alias('bin', [reglookup_recover, reglookup])
75env.Alias('doc', [man_reglookup,man_reglookup_recover,man_reglookup_timeline])
76env.Alias('install', install_items)
77
78Default('bin', libregfi)
Note: See TracBrowser for help on using the repository browser.