Fix example build
[senf.git] / SConstruct
index b0f7742..5ab04af 100644 (file)
@@ -50,19 +50,19 @@ env.Append(
    ENV                    = { 'PATH' : os.environ.get('PATH') },
    CLEAN_PATTERNS         = [ '*~', '#*#', '*.pyc', 'semantic.cache', '.sconsign*', '.sconsign' ],
 
-   CPPPATH                = [ '#/include' ],
+   CPPPATH                = [ '#' ],
    LOCALLIBDIR            = '#',
    LIBPATH                = [ '$LOCALLIBDIR' ],
    LIBS                   = [ '$LIBSENF$LIBADDSUFFIX', 'rt', '$BOOSTREGEXLIB', 
                               '$BOOSTIOSTREAMSLIB', '$BOOSTSIGNALSLIB', '$BOOSTFSLIB' ], 
    TEST_EXTRA_LIBS        = [  ],
 
-   PREFIX                 = '/usr/local',
-   LIBINSTALLDIR          = '$PREFIX/lib',
-   BININSTALLDIR          = '$PREFIX/bin',
-   INCLUDEINSTALLDIR      = '$PREFIX/include',
-   OBJINSTALLDIR          = '$LIBINSTALLDIR',
-   DOCINSTALLDIR          = '$PREFIX/doc',
+   PREFIX                 = '#/dist',
+   LIBINSTALLDIR          = '$PREFIX${syslayout and "/lib" or ""}',
+   BININSTALLDIR          = '$PREFIX${syslayout and "/bin" or ""',
+   INCLUDEINSTALLDIR      = '$PREFIX${syslayout and "/include" or ""}',
+   OBJINSTALLDIR          = '$LIBINSTALLDIR${syslayout and "/$LIBINSTALLDIR/senf" or ""',
+   DOCINSTALLDIR          = '$PREFIX/docs',
    CPP_INCLUDE_EXTENSIONS = [ '.h', '.hh', '.ih', '.mpp', '.cci', '.ct', '.cti' ],
    CPP_EXCLUDE_EXTENSIONS = [ '.test.hh' ],
 
@@ -96,9 +96,10 @@ env.Append(
 )
 
 env.SetDefault(
-    LIBSENF = "senf",
-    final   = 0,
-    debug   = 0,
+    LIBSENF   = "senf",
+    final     = 0,
+    debug     = 0,
+    syslayout = 0
 )
 
 # Set variables from command line
@@ -111,26 +112,20 @@ Export('env')
 if not os.path.exists("Doxyfile.local"):
     Execute(Touch("Doxyfile.local"))
 
-# Create local_config.h
-if not env.GetOption('clean') and not os.path.exists("local_config.hh"):
-    Execute(Touch("local_config.hh"))
-
 if not env.GetOption('clean') and not os.path.exists(".prepare-stamp") \
    and not os.environ.get("SCONS") and COMMAND_LINE_TARGETS != [ 'prepare' ]:
     env.Execute([ "scons prepare" ])
 
-# Load SConscripts. Need to load some first (they change the global environment)
-initSConscripts = [ 
-    "debian/SConscript",
-    "doclib/SConscript",
-]
-
-SConscript(initSConscripts)
-
-if os.path.exists('SConscript.local'):
-    SConscript('SConscript.local')
+# Load SConscripts
 
-SConscript(list(set(glob.glob("*/SConscript")) - set(initSConscripts)))
+SConscriptChdir(0)
+SConscript("debian/SConscript")
+SConscriptChdir(1)
+if os.path.exists('SConscript.local') : SConscript('SConscript.local')
+SConscript("senf/SConscript")
+SConscript("Examples/SConscript")
+SConscript("HowTos/SConscript")
+SConscript("doclib/SConscript")
 
 ###########################################################################
 # Define build targets
@@ -139,17 +134,16 @@ SConscript(list(set(glob.glob("*/SConscript")) - set(initSConscripts)))
 env.Depends(SENFSCons.Doxygen(env), env.Value(env['ENV']['REVISION']))
 
 #### libsenf.a
-libsenf = env.Library(env.subst("$LIBSENF$LIBADDSUFFIX"), env['ALLOBJECTS'])
+libsenf = env.Library("$LOCALLIBDIR/${LIBSENF}${LIBADDSUFFIX}", env['ALLOBJECTS'])
 env.Default(libsenf)
 
-env.InstallSubdir(target = '$INCLUDEINSTALLDIR', source = [ 'config.hh' ])
 env.Install('$LIBINSTALLDIR', libsenf)
 
 #### install_all, default, all_tests, all
 env.Alias('install_all', env.FindInstalledFiles())
 env.Alias('default', DEFAULT_TARGETS)
 env.Alias('all_tests', env.FindAllBoostUnitTests())
-env.Alias('all', [ 'default', 'all_tests', 'all_docs' ])
+env.Alias('all', [ 'default', 'all_tests', 'examples', 'all_docs' ])
 
 #### prepare
 env.PhonyTarget('prepare', [], [])