]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/SConscript
* SConstruct: Further development.
[lilypond.git] / Documentation / user / SConscript
1 # -*-python-*-
2
3 import os
4 import string
5
6 Import ('env')
7 telys = env['glob'] (env, '*.tely')
8 pngs = env['glob'] (env, '*.png')
9
10 env.Depends ('lilypond.texi', env['LILYPOND_BIN'])
11 env.Depends ('lilypond.texi', 'lilypond-internals.texi')
12
13 epss = map (env.Png2eps, pngs)
14 env.Depends ('lilypond.texi', epss)
15
16 e = env.Copy (
17         LILYPOND_BOOK_FLAGS = '''--process="lilypond-bin -I$srcdir/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"''',
18         __verbose = ' --verbose',
19         )
20
21 e.Command ('lilypond-internals.texi', env['LILYPOND_BIN'],
22              'cd ${TARGET.dir} \
23              && LILYPONDPREFIX=$LILYPONDPREFIX $LILYPOND_BIN $__verbose \
24              $srcdir/ly/generate-documentation')
25
26 texis = map (env.TEXI, telys)
27 dvis = map (env.Texi2dvi, telys)
28 pss = map (env.PostScript, map (lambda x: x + '.dvi', telys))
29 pdfs = map (env.Dvi2pdf, telys)
30 infos = map (env.INFO, telys)
31
32 def file_subst (file_name, find, subst):
33         s = open (file_name).read ()
34         t = string.replace (s, find, subst)
35         if s != t:
36                 os.rename (file_name, file_name + '~')
37                 h = open (file_name, "w")
38                 h.write (t)
39                 h.close ()
40
41 e['usersrc'] = Dir ('.').srcnode ().abspath
42 def url_fixup (target, source, env):
43         file_subst (str (target[0]),
44                     '../lilypond-internals', 'lilypond-internals/')
45 a = ['$MAKEINFO -I$srcdir/Documenation/user -I${SOURCE.dir} --html \
46 --css-include=$srcdir/Documentation/texinfo.css $__verbose \
47 --output=${TARGET.dir} $SOURCE',
48      '$MAKEINFO -I$srcdir/Documentation/user -I${SOURCE.dir} --html \
49      --no-split --no-headers \
50      --css-include=$srcdir/Documentation/../texinfo.css $__verbose \
51      --output=$TARGET $SOURCE',
52      url_fixup,
53      'ln -f ${SOURCE.dir}/*.png ${SOURCE.dir}/*.ly ${TARGET.dir}/']
54      
55 e.Command ('lilypond/lilypond.html', 'lilypond.texi', a)
56 e.Command ('lilypond-internals/lilypond-internals.html',
57              'lilypond-internals.texi', a)
58
59 #Hmm -- why not just mv ./Documentation/{*,*/*} ./doc :-)
60 env.Alias ('doc', texis)
61 env.Alias ('doc', dvis)
62 env.Alias ('doc', pss)
63 env.Alias ('doc', pdfs)
64
65 env.Alias ('doc', 'lilypond/lilypond.html')
66 env.Alias ('doc', 'lilypond-internals/lilypond-internals.html')