9 sources = env['src_glob'] (env, '*.tely')
10 pngs = env['src_glob'] (env, '*.png')
12 def verbose_opt (env, opt):
17 LILYPOND_BIN = env['LILYPOND_BIN']
18 LILYPONDPREFIX = env['LILYPONDPREFIX']
20 mfbuild = os.path.join (env['absbuild'], 'mf', env['out'])
21 lilybuild = os.path.join (env['absbuild'], 'lily', env['out'])
22 userbuild = os.path.join (env['absbuild'], 'Documentation/user', env['out'])
24 env.Depends ('lilypond.texi', LILYPOND_BIN)
25 env.Depends ('lilypond.texi', 'lilypond-internals.texi')
26 env.Depends ('doc', mfbuild)
28 png_stems = map (lambda x: os.path.splitext (x)[0], pngs)
29 epss = map (env.Png2eps, png_stems)
30 env.Depends ('lilypond.texi', epss)
32 env.Command ('lilypond-internals.texi', LILYPOND_BIN,
33 ('(cd ${TARGET.dir} && \
34 LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \
35 + verbose_opt (env, ' --verbose') \
36 + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\
39 doc_stems = map (lambda x: os.path.splitext (x)[0], sources)
40 texis = map (env.Tely2texi, doc_stems)
41 dvis = map (env.Texi2dvi, doc_stems)
42 pss = map (env.PostScript, map (lambda x: x + '.dvi', doc_stems))
43 pdfs = map (env.Dvi2pdf, doc_stems)
46 def file_subst (file_name, find, subst):
47 find_re = re.compile (find, re.MULTILINE)
48 s = open (file_name).read ()
49 t = re.sub (find_re, subst, s)
51 os.rename (file_name, file_name + '~')
52 h = open (file_name, "w")
56 ##docdir = os.path.join (env['srcdir'], 'Documentation')
57 docdir = Dir ('.').srcnode ().abspath + '/..'
60 srcdir = env['srcdir']
61 verbose = verbose_opt (env, ' --verbose')
62 a = ('makeinfo -I%(reldir)s -I${SOURCE.dir}'\
63 + ' --output=${TARGET.dir}'\
64 + ' --css-include=%(docdir)s/texinfo.css'\
65 + ' --html%(verbose)s'\
67 + ' makeinfo -I%(reldir)s -I${SOURCE.dir}' \
68 + ' --output=$TARGET' \
69 + ' --css-include=%(docdir)s/texinfo.css' \
70 + ' --html --no-split --no-headers %(verbose)s' \
71 + ' $SOURCE') % vars ()
72 def url_fixup (target, source, env):
73 file_subst (str (target[0]),
74 '\.\./lilypond-internals', 'lilypond-internals/')
75 c = 'pwd; ln -f %(userbuild)s/*.png %(userbuild)s/*.ly ${TARGET.dir}/' % vars ()
77 e.Command ('lilypond/lilypond.html', 'lilypond.texi', [a, url_fixup, c])
78 e.Command ('lilypond-internals/lilypond-internals.html',
79 'lilypond-internals.texi', a)
81 env.Alias ('doc', texis)
82 env.Alias ('doc', dvis)
83 env.Alias ('doc', pss)
84 env.Alias ('doc', pdfs)
86 env.Alias ('doc', 'lilypond-internals/lilypond.html')
87 env.Alias ('doc', 'lilypond-internals/lilypond-internals.html')