+#urg how does #/ subst work?
+Export ('env')
+SConscript ('buildscripts/builder.py')
+
+env.PrependENVPath ('PATH',
+ os.path.join (env['absbuild'], env['out'], 'usr/bin'))
+
+if os.environ.has_key ('TEXMF'):
+ env.Append (ENV = {'TEXMF' : os.environ['TEXMF']})
+env.Append (ENV = {'TEXMF' : '{$LILYPONDPREFIX,' \
+ + os.popen ('kpsexpand \$TEXMF').read ()[:-1] + '}' })
+
+
+
+BUILD_ABC2LY = '${set__x}$PYTHON $srcdir/scripts/abc2ly.py'
+BUILD_LILYPOND = '${set__x}$PYTHON $srcdir/scripts/lilypond.py${__verbose}'
+BUILD_LILYPOND_BIN = '$absbuild/$out/lilypond-bin ${__verbose}'
+BUILD_LILYPOND_BOOK = '$PYTHON $srcdir/scripts/lilypond-book.py --verbose'
+
+
+# post-option environment-update
+env.Append (
+ bindir = bindir,
+ sharedir = sharedir,
+ lilypond_datadir = sharedir_package,
+ localedir = localedir,
+ local_lilypond_datadir = sharedir_package_version,
+ lilypondprefix = lilypondprefix,
+ sharedir_package = sharedir_package,
+ sharedir_doc_package = sharedir_doc_package,
+ sharedir_package_version = sharedir_package_version,
+
+ LILYPOND = BUILD_LILYPOND,
+ ABC2LY = BUILD_ABC2LY,
+ LILYPOND_BOOK = BUILD_LILYPOND_BOOK,
+ LILYPOND_BOOK_FORMAT = 'texi-html',
+ MAKEINFO_FLAGS = '--css-include=$srcdir/Documentation/texinfo.css',
+
+ TEXI2DVI_PAPERSIZE = '@afourpaper',
+ TEXI2DVI_FLAGS = [ '-t $TEXI2DVI_PAPERSIZE'],
+ DVIPS_PAPERSIZE = 'a4',
+ DVIPS_FLAGS = ['-t $DVIPS_PAPERSIZE',
+ '-u+lilypond.map',
+ '-u+ec-mftrace.map'],
+ PSPDF_FLAGS = ['-sPAPERSIZE=$DVIPS_PAPERSIZE'],
+ )
+
+if env['debugging']:
+ env.Append (CCFLAGS = ['-g', '-pipe'])
+if env['optimising']:
+ env.Append (CCFLAGS = '-O2')
+ env.Append (CXXFLAGS = ['-DSTRING_UTILS_INLINED'])
+if env['warnings']:
+ env.Append (CCFLAGS = ['-W', '-Wall'])
+ env.Append (CXXFLAGS = ['-Wconversion'])
+
+# ugr,huh?
+env.Append (LINKFLAGS = ['-Wl,--export-dynamic'])
+
+if env['verbose']:
+ env['__verbose'] = ' --verbose'
+ env['set__x'] = 'set -x;'
+
+
+## Explicit target and dependencies
+
+if 'clean' in COMMAND_LINE_TARGETS:
+ # ugh: prevent reconfigure instead of clean
+ os.system ('touch %s' % config_cache)
+
+ command = sys.argv[0] + ' -c .'
+ sys.stdout.write ('Running %s ... ' % command)
+ sys.stdout.write ('\n')
+ s = os.system (command)
+ if os.path.exists (config_cache):
+ os.unlink (config_cache)
+ Exit (s)
+
+if 'realclean' in COMMAND_LINE_TARGETS:
+ command = 'rm -rf $(find . -name "out-scons" -o -name ".scon*")'
+ sys.stdout.write ('Running %s ... ' % command)
+ sys.stdout.write ('\n')
+ s = os.system (command)
+ if os.path.exists (config_cache):
+ os.unlink (config_cache)
+ Exit (s)
+
+# Declare SConscript phonies
+env.Alias ('minimal', config_cache)
+env.Alias ('mf-essential', config_cache)
+
+env.Alias ('minimal', ['lily', 'mf-essential'])
+env.Alias ('all', ['minimal', 'mf', '.'])
+# Do we want the doc/web separation?
+env.Alias ('doc',
+ ['Documentation',
+ 'Documentation/user',
+ 'Documentation/topdocs',
+ 'Documentation/bibliography',
+ 'input'])
+
+# Without target arguments, do minimal build
+if not COMMAND_LINE_TARGETS:
+ env.Default (['minimal'])
+
+# GNU Make rerouting compat:
+env.Alias ('web', 'doc')
+
+