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'])
35 # more of these? -- howto?
36 e.Depends ('lilypond.texi', os.path.join (mfbuild, 'feta16list.ly'))
37 e.Depends ('lilypond.texi', os.path.join (mfbuild, 'parmesan16list.ly'))
39 e.Depends ('doc', os.path.join (mfbuild, 'feta20.enc'))
40 e.Depends ('doc', os.path.join (mfbuild, 'feta20.enc'))
42 e.Depends ('lilypond.texi', LILYPOND_BIN)
43 e.Depends ('lilypond.texi', 'lilypond-internals.texi')
45 e.Depends ('lilypond.texi', 'fonts')
47 png_stems = map (lambda x: os.path.splitext (x)[0], pngs)
48 epss = map (e.Png2eps, png_stems)
49 e.Depends ('lilypond.texi', epss)
51 e.Command ('lilypond-internals.texi', LILYPOND_BIN,
52 ('(cd ${TARGET.dir} && \
53 LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \
54 + verbose_opt (env, ' --verbose') \
55 + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\
58 doc_stems = map (lambda x: os.path.splitext (x)[0], sources)
59 texis = map (e.Tely2texi, doc_stems)
60 dvis = map (e.Texi2dvi, doc_stems)
61 pss = map (e.PostScript, map (lambda x: x + '.dvi', doc_stems))
62 pdfs = map (e.Dvi2pdf, doc_stems)
65 def file_subst (file_name, find, subst):
66 find_re = re.compile (find, re.MULTILINE)
67 s = open (file_name).read ()
68 t = re.sub (find_re, subst, s)
70 os.rename (file_name, file_name + '~')
71 h = open (file_name, "w")
75 docdir = os.path.join (env['srcdir'], 'Documentation')
77 srcdir = env['srcdir']
78 verbose = verbose_opt (env, ' --verbose')
79 a = ('makeinfo -I%(reldir)s -I${SOURCE.dir}'\
80 + ' --output=${TARGET.dir}'\
81 + ' --css-include=%(docdir)s/texinfo.css'\
82 + ' --html%(verbose)s'\
84 + ' makeinfo -I%(reldir)s -I${SOURCE.dir}' \
85 + ' --output=$TARGET' \
86 + ' --css-include=%(docdir)s/texinfo.css' \
87 + ' --html --no-split --no-headers %(verbose)s' \
88 + ' $SOURCE') % vars ()
89 def url_fixup (target, source, env):
90 file_subst (str (target[0]),
91 '\.\./lilypond-internals', 'lilypond-internals/')
92 c = 'pwd; ln -f %(userbuild)s/*.png %(userbuild)s/*.ly ${TARGET.dir}/' % vars ()
93 e.Command ('lilypond/lilypond.html', 'lilypond.texi', [a, url_fixup, c])
94 e.Command ('lilypond-internals/lilypond-internals.html',
95 'lilypond-internals.texi', a)
97 e.Alias ('doc', texis)
100 e.Alias ('doc', pdfs)
102 e.Alias ('doc', 'lilypond-internals/lilypond.html')
103 e.Alias ('doc', 'lilypond-internals/lilypond-internals.html')
106 all_sources = ['SConscript',] + sources + pngs
107 x = env.Tar (env['tarball'], all_sources)