9 reldir = str (Dir ('.').srcnode ())
11 sources = glob.glob ('*.tely')
12 pngs = glob.glob ('*.png')
16 outdir = os.path.join (env['build'], reldir, env['out'])
18 def verbose_opt (env, opt):
23 LILYPOND_BIN = env['LILYPOND_BIN']
24 LILYPONDPREFIX = env['LILYPONDPREFIX']
26 mfbuild = os.path.join (env['absbuild'], 'mf', env['out'])
27 lilybuild = os.path.join (env['absbuild'], 'lily', env['out'])
28 userbuild = os.path.join (env['absbuild'], 'Documentation/user', env['out'])
30 # more of these? -- howto?
31 env.Depends ('lilypond.texi', os.path.join (mfbuild, 'feta16list.ly'))
32 env.Depends ('lilypond.texi', os.path.join (mfbuild, 'parmesan16list.ly'))
34 env.Depends ('doc', os.path.join (mfbuild, 'feta20.enc'))
35 env.Depends ('doc', os.path.join (mfbuild, 'feta20.enc'))
37 env.Depends ('lilypond.texi', LILYPOND_BIN)
38 env.Depends ('lilypond.texi', 'lilypond-internals.texi')
40 ##env.Depends ('lilypond.texi', 'fonts')
43 env.Depends ('doc', mfbuild)
45 png_stems = map (lambda x: os.path.splitext (x)[0], pngs)
46 epss = map (env.Png2eps, png_stems)
47 env.Depends ('lilypond.texi', epss)
49 env.Command ('lilypond-internals.texi', LILYPOND_BIN,
50 ('(cd ${TARGET.dir} && \
51 LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \
52 + verbose_opt (env, ' --verbose') \
53 + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\
56 doc_stems = map (lambda x: os.path.splitext (x)[0], sources)
57 texis = map (env.Tely2texi, doc_stems)
58 dvis = map (env.Texi2dvi, doc_stems)
59 pss = map (env.PostScript, map (lambda x: x + '.dvi', doc_stems))
60 pdfs = map (env.Dvi2pdf, doc_stems)
63 def file_subst (file_name, find, subst):
64 find_re = re.compile (find, re.MULTILINE)
65 s = open (file_name).read ()
66 t = re.sub (find_re, subst, s)
68 os.rename (file_name, file_name + '~')
69 h = open (file_name, "w")
73 docdir = os.path.join (env['srcdir'], 'Documentation')
75 srcdir = env['srcdir']
76 verbose = verbose_opt (env, ' --verbose')
77 a = ('makeinfo -I%(reldir)s -I${SOURCE.dir}'\
78 + ' --output=${TARGET.dir}'\
79 + ' --css-include=%(docdir)s/texinfo.css'\
80 + ' --html%(verbose)s'\
82 + ' makeinfo -I%(reldir)s -I${SOURCE.dir}' \
83 + ' --output=$TARGET' \
84 + ' --css-include=%(docdir)s/texinfo.css' \
85 + ' --html --no-split --no-headers %(verbose)s' \
86 + ' $SOURCE') % vars ()
87 def url_fixup (target, source, env):
88 file_subst (str (target[0]),
89 '\.\./lilypond-internals', 'lilypond-internals/')
90 c = 'pwd; ln -f %(userbuild)s/*.png %(userbuild)s/*.ly ${TARGET.dir}/' % vars ()
92 e.Command ('lilypond/lilypond.html', 'lilypond.texi', [a, url_fixup, c])
93 e.Command ('lilypond-internals/lilypond-internals.html',
94 'lilypond-internals.texi', a)
96 env.Alias ('doc', texis)
97 env.Alias ('doc', dvis)
98 env.Alias ('doc', pss)
99 env.Alias ('doc', pdfs)
101 env.Alias ('doc', 'lilypond-internals/lilypond.html')
102 env.Alias ('doc', 'lilypond-internals/lilypond-internals.html')
105 all_sources = ['SConscript',] + sources + pngs
106 x = env.Tar (env['tarball'], all_sources)