]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/SConscript
* SConstruct: Further development.
[lilypond.git] / lily / SConscript
index c5bde0c080dcfff3c7406c0cbe9005853e96686f..2da49d683a212c8ea217e720d2f7a85e89133931 100644 (file)
@@ -1,38 +1,30 @@
 # -*-python-*-
 
-import glob
-import os
-
-here = os.getcwd ()
-reldir = str (Dir ('.').srcnode ())
-os.chdir (reldir)
-sources = glob.glob ('*.cc') + ['parser.yy', 'lexer.ll']
-includes = glob.glob ('include/*.hh')
-os.chdir (here)
-
-name = 'lyparser'
-
 Import ('env')
-e = env.Copy ()
 
-#let's do this after the split
-#sources = filter (lambda x: x != 'pangofc-afm-decoder.cc', sources)
-#pango = env.Copy ()
-#if pango['gui']:
-#      pango.ParseConfig ('pkg-config --cflags --libs gtk+-2.0')
-#      pango.ParseConfig ('pkg-config --cflags --libs pango')
-#pango.Object ('foo-' + 'pangofc-afm-decoder.o', 'pangofc-afm-decoder.cc')
-#
-#e.Object ('pangofc-afm-decoder.o', 'foo-pangofc-afm-deocder.o')
+outdir = Dir ('.').abspath
+cc_sources =  env['src_glob'] (env, '*.cc')
+sources = cc_sources + ['parser.yy', 'lexer.ll']
+includes = env['src_glob'] (env, 'include/*.hh')
 
-e.Append (YACCFLAGS = '-d')
-outdir = os.path.join (env['build'], reldir, env['out'])
+e = env.Copy ()
 e.Append (CPPPATH = [outdir, '#/lily/include', '#/flower/include'])
-e.Depends ('lexer.cc', 'parser.cc')
-e.Depends ('my-lily-lexer.o', 'parser.cc')
-e.Depends ('my-lily-parser.o', 'parser.cc')
+e.Append (LEXFLAGS = ['-Cfe', '-p', '-p'])
+
+# SCons builds parser.cc and parser.hh automagically with this but
+# keeps removing and rebuilding parser.cc because it wants parser.hpp.
+# e.Append (YACCFLAGS = '-d')
+# e.Depends ('lexer.cc', 'parser.cc')
+# e.Depends ('my-lily-lexer.o', 'parser.cc')
+# e.Depends ('my-lily-parser.o', 'parser.cc')
+
+# Adding an explicit Builder works well, we do not even need to list
+# header dependencies.
+HH = Builder (action = 'bison -d -o ${TARGET.base}.cc $SOURCE',
+             suffix = '.hh', src_suffix = '.yy')
+e.Append (BUILDERS = {'HH' : HH})
+e.HH ('parser.hh', 'parser.yy')
 
-# some stuff here from lily-as-lib
 e.Append (LIBS = ['flower'])
 e.ParseConfig ('guile-config link')
 name = 'lilypond-bin'
@@ -40,9 +32,5 @@ lily = e.Program (name, sources)
 env.Install (env['bindir'], lily)
 env.Alias ('install', env['bindir'])
 
-env.Alias ('lily', lily)
-
-
-#testing
-all_sources = ['SConscript',] + sources + includes
-x = env.Tar (env['tarball'], all_sources)
+po = env.Command ('lilypond.po', cc_sources + includes, env['pocommand'])
+env.Alias ('po-update', po)