added Version.hh
[senf.git] / senf / SConscript
1 # -*- python -*-
2
3 Import('env')
4 import SENFSCons, os
5
6 ###########################################################################
7
8 # Create local_config.h
9 if not env.GetOption('clean') and not os.path.exists("local_config.hh"):
10     Execute(Touch("local_config.hh"))
11
12 # Ext/SConscript is last so it can depend on env vars set by any other script
13 # (e.g. $PACKET_BUNDLES)
14 SConscript(sorted(list(set(env.Glob("*/SConscript", strings=True)) - set(("Ext/SConscript",)))))
15 SConscript("Ext/SConscript")
16
17 env.InstallSubdir(target = '$INCLUDEINSTALLDIR', 
18                   source = sorted(env.Glob("*.hh", strings=True)))
19
20 # Create Version.hh
21 MAJOR = 1
22 MINOR = 1
23 REV = int(os.popen("svn info | grep 'Last Changed Rev:' | awk '{print $4}'").read().strip().lower())
24 env.CreateFile("Version.hh", env.Value(
25     '// auto-generated file.\n\n'
26     '#ifndef HH_SENF_Version\n'
27     '#define HH_SENF_Version\n\n'
28     '// SENF_VERSION %% 100000 is the revision number\n'
29     '// SENF_VERSION / 100000 %% 100 is the minor version\n'
30     '// SENF_VERSION / 10000000 is the major version\n'
31     '#define SENF_VERSION %(MAJOR)d%(MINOR)02d%(REV)05d\n\n'
32     '#define SENF_LIB_VERSION "%(MAJOR)d.%(MINOR)02d"\n\n'
33     '#define SENF_REVISION "%(REV)d"\n\n'
34     '#endif\n' % locals()) )