9 reldir = str (Dir ('.').srcnode ())
11 sources = glob.glob ('*.tely')
12 pngs = glob.glob ('*.png')
17 outdir = os.path.join (env['build'], reldir, env['out'])
20 e.Append (LILYPOND_BOOK_PATH = [os.path.join (env['srcdir'], reldir, 'user')])
21 e['LILYPOND_BOOK_PATH'].append (os.path.join (env['srcdir'], reldir, 'user'))
23 def verbose_opt (env, opt):
28 LILYPOND_BIN = env['LILYPOND_BIN']
29 LILYPONDPREFIX = env['LILYPONDPREFIX']
31 mfbuild = os.path.join (env['absbuild'], 'mf', env['out'])
32 lilybuild = os.path.join (env['absbuild'], 'lily', env['out'])
33 userbuild = os.path.join (env['absbuild'], 'Documentation/user', env['out'])
34 e.Depends ('lilypond.texi', os.path.join (mfbuild, 'feta16list.ly'))
35 e.Depends ('lilypond.texi', os.path.join (mfbuild, 'parmesan16list.ly'))
36 e.Depends ('lilypond.texi', LILYPOND_BIN)
37 e.Depends ('lilypond.texi', 'lilypond-internals.texi')
38 #e.Depends ('lilypond.texi', os.path.join (lilybuild, 'lilypond-bin'))
40 png_stems = map (lambda x: os.path.splitext (x)[0], pngs)
41 epss = map (e.Png2eps, png_stems)
42 e.Depends ('lilypond.texi', epss)
44 e.Command ('lilypond-internals.texi', LILYPOND_BIN,
45 ('(cd ${TARGET.dir} && \
46 LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \
47 + verbose_opt (env, ' --verbose') \
48 + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\
51 doc_stems = map (lambda x: os.path.splitext (x)[0], sources)
52 texis = map (e.Tely2texi, doc_stems)
53 dvis = map (e.Texi2dvi, doc_stems)
54 pss = map (e.PostScript, map (lambda x: x + '.dvi', doc_stems))
55 pdfs = map (e.Dvi2pdf, doc_stems)
58 def file_subst (file_name, find, subst):
59 find_re = re.compile (find, re.MULTILINE)
60 s = open (file_name).read ()
61 t = re.sub (find_re, subst, s)
63 os.rename (file_name, file_name + '~')
64 h = open (file_name, "w")
68 docdir = os.path.join (env['srcdir'], 'Documentation')
70 srcdir = env['srcdir']
71 verbose = verbose_opt (env, ' --verbose')
72 a = ('makeinfo -I%(reldir)s -I${SOURCE.dir}'\
73 + ' --output=${TARGET.dir}'\
74 + ' --css-include=%(docdir)s/texinfo.css'\
75 + ' --html%(verbose)s'\
77 + ' makeinfo -I%(reldir)s -I${SOURCE.dir}' \
78 + ' --output=$TARGET' \
79 + ' --css-include=%(docdir)s/texinfo.css' \
80 + ' --html --no-split --no-headers %(verbose)s' \
81 + ' $SOURCE') % vars ()
82 def url_fixup (target, source, env):
83 file_subst (str (target[0]),
84 '\.\./lilypond-internals', 'lilypond-internals/')
85 c = 'pwd; ln -f %(userbuild)s/*.png %(userbuild)s/*.ly ${TARGET.dir}/' % vars ()
86 e.Command ('lilypond/lilypond.html', 'lilypond.texi', [a, url_fixup, c])
87 e.Command ('lilypond-internals/lilypond-internals.html',
88 'lilypond-internals.texi', a)
90 e.Alias ('doc', texis)
95 e.Alias ('doc', 'lilypond-internals/lilypond.html')
96 e.Alias ('doc', 'lilypond-internals/lilypond-internals.html')
99 all_sources = ['SConscript',] + sources + pngs
100 x = env.Tar (env['tarball'], all_sources)