source: trunk/SConstruct@ 273

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

allowed compiler to be specified via CC environment variable
fixed 3 uninitialized variable problems discovered by clang source analyzer

File size: 3.7 KB
RevLine 
[211]1import sys
[212]2import os
[234]3sys.dont_write_bytecode = True
[232]4from regfi_version import REGFI_VERSION
[211]5
[225]6cflags = '-std=gnu99 -pedantic -Wall -D_FILE_OFFSET_BITS=64 -fvisibility=hidden'
[232]7cflags += ' -DREGFI_VERSION=\'"%s"\'' % REGFI_VERSION
[225]8cflags += ' -ggdb'
[187]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
[273]16cc=os.environ.get('CC', 'gcc')
[269]17env = Environment(ENV=os.environ,
[273]18 CC=cc,
[269]19 CFLAGS=cflags,
[191]20 CPPPATH=['include', '/usr/local/include'],
21 LIBPATH=['lib', '/usr/local/lib'],
[195]22 LIBS=['m', 'pthread', 'regfi', 'talloc'])
[191]23
[187]24# Libraries
25libregfi_static = env.Library(lib_src)
[203]26libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'])
[187]27
[189]28
[187]29# Executables
[191]30reglookup = env.Program(['src/reglookup.c'])
31reglookup_recover = env.Program(['src/reglookup-recover.c'])
[187]32
[189]33
[187]34# Documentation
35# This only needs to be run during the release/packaging process
36man_fixup = "|sed 's/.SH DESCRIPTION/\\n.SH DESCRIPTION/'"
37man_builder = Builder(action='docbook2x-man --to-stdout $SOURCE'
38 + man_fixup + '| gzip -9 > $TARGET',
39 suffix = '.gz',
[189]40 src_suffix = '.docbook')
[187]41env['BUILDERS']['ManPage'] = man_builder
42
43man_reglookup = env.ManPage('doc/reglookup.1.docbook')
44man_reglookup_recover = env.ManPage('doc/reglookup-recover.1.docbook')
45man_reglookup_timeline = env.ManPage('doc/reglookup-timeline.1.docbook')
46
[189]47# Installation
48prefix='/usr/local/'
[246]49if 'PREFIX' in os.environ:
50 prefix = os.environ['PREFIX']+'/'
51
[212]52install_items = [prefix+'bin',
53 prefix+'lib',
54 prefix+'include/regfi',
55 prefix+'man']
56
[189]57env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
[269]58libinstall = env.Install(prefix+'lib', [libregfi, libregfi_static])
[193]59env.Install(prefix+'include/regfi', Glob('include/*.h'))
[189]60env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover,
61 man_reglookup_timeline])
[269]62env.AddPostAction(libinstall, 'ldconfig')
[189]63
[212]64if sys.version_info[0] == 2:
65 install_items.append('pyregfi2-install.log')
[253]66 env.Command('pyregfi2-install.log', ['python/pyregfi/__init__.py',
67 'python/pyregfi/structures.py',
68 'python/pyregfi/winsec.py'],
[212]69 "python pyregfi-distutils.py install | tee pyregfi2-install.log")
[189]70
[212]71python_path = os.popen('which python3').read()
72if python_path != '':
73 install_items.append('pyregfi3-install.log')
[253]74 env.Command('pyregfi3-install.log', ['python/pyregfi/__init__.py',
75 'python/pyregfi/structures.py',
76 'python/pyregfi/winsec.py'],
[212]77 "python3 pyregfi-distutils.py install | tee pyregfi3-install.log")
78
[238]79# API documentation
80regfi_doc = env.Command('doc/devel/regfi/index.html',
81 Glob('lib/*.c')+Glob('include/*.h')+['doc/devel/Doxyfile.regfi'],
82 'doxygen doc/devel/Doxyfile.regfi')
83pyregfi_doc = env.Command('doc/devel/pyregfi/index.html',
84 Glob('python/pyregfi/*.py')+['doc/devel/Doxyfile.pyregfi', regfi_doc],
85 'doxygen doc/devel/Doxyfile.pyregfi')
[212]86
[238]87
[187]88# User Friendly Targets
89env.Alias('libregfi', libregfi)
90env.Alias('reglookup', reglookup)
91env.Alias('reglookup-recover', reglookup_recover)
92env.Alias('bin', [reglookup_recover, reglookup])
93env.Alias('doc', [man_reglookup,man_reglookup_recover,man_reglookup_timeline])
[238]94env.Alias('doc-devel', [regfi_doc, pyregfi_doc])
[212]95env.Alias('install', install_items)
[187]96
97Default('bin', libregfi)
Note: See TracBrowser for help on using the repository browser.