minor fixes for clang++
[senf.git] / senf / SConscript
index 0eb33c6..de256e4 100644 (file)
@@ -1,7 +1,7 @@
 # -*- python -*-
 
 Import('env')
-import SENFSCons, glob, os
+import SENFSCons, os, re
 
 ###########################################################################
 
@@ -11,7 +11,28 @@ if not env.GetOption('clean') and not os.path.exists("local_config.hh"):
 
 # Ext/SConscript is last so it can depend on env vars set by any other script
 # (e.g. $PACKET_BUNDLES)
-SConscript(list(set(glob.glob("*/SConscript")) - set(("Ext/SConscript",))))
+SConscript(sorted(list(set(env.Glob("*/SConscript", strings=True)) - set(("Ext/SConscript",)))))
 SConscript("Ext/SConscript")
 
-env.InstallSubdir(target = '$INCLUDEINSTALLDIR', source = [ 'config.hh' ])
+env.InstallSubdir(target = '$INCLUDEINSTALLDIR', 
+                  source = sorted(env.Glob("*.hh", strings=True)))
+
+# Create Version.hh
+MAJOR = 1
+MINOR = 1
+svn_info = re.search('.*last changed rev: (\d+).*', os.popen('svn info').read().strip().lower());
+if svn_info:
+    REV = int(svn_info.groups()[0])
+else:
+    REV = 0
+env.CreateFile("Version.hh", env.Value(
+    '// auto-generated file.\n\n'
+    '#ifndef HH_SENF_Version\n'
+    '#define HH_SENF_Version\n\n'
+    '// SENF_VERSION %% 100000 is the revision number\n'
+    '// SENF_VERSION / 100000 %% 100 is the minor version\n'
+    '// SENF_VERSION / 10000000 is the major version\n'
+    '#define SENF_VERSION %(MAJOR)d%(MINOR)02d%(REV)05d\n\n'
+    '#define SENF_LIB_VERSION "%(MAJOR)d.%(MINOR)02d"\n\n'
+    '#define SENF_REVISION "%(REV)d"\n\n'
+    '#endif\n' % locals()) )