]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/GNUmakefile
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / Documentation / user / GNUmakefile
1 depth=../..
2
3 LATEX_FILES =$(call src-wildcard,*.latex)
4
5
6 EXTRA_DIST_FILES = $(LATEX_FILES) $(IMAGES) $(EPS_ILLUSTRATIONS)
7 EXTRA_DIST_FILES += README.txt writing-texinfo.txt policy.txt writing-sections.txt
8
9 IMAGES=$(call src-wildcard,*.png)
10 EPS_ILLUSTRATIONS=context-example.eps
11 PDF_ILLUSTRATIONS=context-example.pdf
12
13 OUT_PDF_IMAGES=$(IMAGES:%.png=$(outdir)/%.pdf) $(addprefix $(outdir)/,$(PDF_ILLUSTRATIONS))
14
15 OUT_PNG_IMAGES=$(OUT_PDF_IMAGES:%.pdf=%.png)
16
17 OUT_TEXI_FILES=$(ITEXI_FILES:%.itexi=$(outdir)/%.texi)\
18  $(ITELY_FILES:%.itely=$(outdir)/%.texi)
19 HTML_FILES = $(TELY_FILES:%.tely=$(outdir)/%-big-page.html)\
20  $(outdir)/lilypond-internals-big-page.html
21
22 # todo: add latex.
23 PDF_FILES = $(TELY_FILES:%.tely=$(outdir)/%.pdf)
24 # this prevents aux files from being reused for translated docs
25 TEXI2PDF_FLAGS = --tidy
26
27 INFO_DOCS = lilypond lilypond-internals music-glossary lilypond-program lilypond-learning
28 INFO_FILES = $(INFO_DOCS:%=$(outdir)/%.info)
29
30 ifeq ($(out),www)
31 INFO_IMAGES_DIR = lilypond
32 endif
33
34 STEPMAKE_TEMPLATES=tex texinfo omf documentation
35 OMF_FILES += $(outdir)/lilypond-internals.html.omf
36
37 LOCALSTEPMAKE_TEMPLATES=lilypond ly
38
39
40 TEXINPUTS=$(top-src-dir)/tex::
41 export TEXINPUTS
42
43 include $(depth)/make/stepmake.make
44
45 info: $(INFO_FILES)
46
47         @echo export LILYPOND_DATADIR=$(LILYPOND_DATADIR)
48         @echo export PYTHONPATH=$(PYTHONPATH)
49
50 xml: $(outdir)/lilypond/lilypond.xml $(outdir)/lilypond-internals/lilypond-internals.xml
51
52 # There are two modes for info: with and without images.
53 ifeq ($(out),www)
54
55 # This builds all .info targets with images, in out-www.
56 # Viewable with a recent Emacs, doing: C-u C-h i out-www/lilypond.info
57
58 # Cancel the special, non-image info generation rule that skips images:
59 $(outdir)/%.info: $(outdir)/%.nexi
60
61 # "makeinfo --info" MUST be able to read PNGs from CWD for info images
62 # to work, hence lilypond/ -> $(outdir)/ symlink.
63 # $(outdir)/lilypond/*.png symlinks are only needed to view
64 # out-www/*.info with Emacs -- HTML docs no longer need these
65 # symlinks, see replace_symlinks_urls in
66 # buildscripts/add_html_footer.py.
67 $(outdir)/%.info: lilypond
68 lilypond: $(OUT_PNG_IMAGES)
69         rm -f lilypond
70         ln -s $(outdir) lilypond
71         mkdir -p $(outdir)/lilypond
72         find $(outdir)/lilypond/ -name '*'.png | xargs rm -f
73         (cd $(outdir)/lilypond/ ; ln -sf ../*.png . )
74
75 local-install-info: info
76         -$(INSTALL) -d $(DESTDIR)$(infodir)
77 ifneq ($(patsubst %/local,%,$(DESTDIR)$(prefix)),/usr)
78 ## Can not have absolute symlinks because some binary packages build schemes
79 ## install files in nonstandard root.  Best we can do is to notify the
80 ## builder or packager.
81         @echo
82         @echo "***************************************************************"
83         @echo "Please add or update the LilyPond direntries, do"
84         @echo
85         @echo "    install-info --info-dir=$(infodir) $(outdir)/lilypond.info"
86         @echo
87         @echo "For images in the INFO docs to work, do: "
88         @echo
89         @echo "    (cd $(infodir) && ln -sfT ../doc/lilypond/html/Documentation/user lilypond)"
90         @echo "or add something like that to the postinstall script."
91         @echo
92 else # installing directly into standard /usr/...
93         -$(INSTALL) -d $(DESTDIR)$(infodir)
94         -install-info --remove --info-dir=$(infodir) $(outdir)/lilypond.info
95         -install-info --remove --info-dir=$(infodir) $(outdir)/lilypond-program.info
96         -install-info --remove --info-dir=$(infodir) $(outdir)/lilypond-learning.info
97         -install-info --remove --info-dir=$(infodir) $(outdir)/lilypond-internals.info
98         -install-info --remove --info-dir=$(infodir) $(outdir)/music-glossary.info
99         install-info --info-dir=$(infodir) $(outdir)/lilypond.info
100         cd $(infodir) && ln -sfT $(webdir)/Documentation/user lilypond
101 endif # installing directly into standard /usr/...
102
103 local-uninstall-WWW:
104         rm -f $(infodir)/lilypond
105
106 else # out!=www
107
108 # Cancel the default info generation rule that generates images:
109 $(outdir)/%.info: $(outdir)/%.texi
110
111 local-install-info: info
112         -$(INSTALL) -d $(DESTDIR)$(package_infodir)
113 ifneq ($(patsubst %/local,%,$(DESTDIR)$(prefix)),/usr)
114 ## Can not have absolute symlinks because some binary packages build schemes
115 ## install files in nonstandard root.  Best we can do is to notify the
116 ## builder or packager.
117         @echo
118         @echo "***************************************************************"
119         @echo "Please add or update the LilyPond direntries, do"
120         @echo
121         @echo "    install-info --info-dir=$(infodir) out/lilypond.info"
122         @echo
123         @echo "For images in the INFO docs to work, do"
124         @echo
125         @echo "    make out=www install-info "
126         @echo
127         @echo "and read the extra instructions."
128         @echo
129 else # installing directly into standard /usr/...
130         -$(INSTALL) -d $(DESTDIR)$(infodir)
131         -install-info --remove --info-dir=$(infodir) $(outdir)/lilypond.info
132         -install-info --remove --info-dir=$(infodir) $(outdir)/lilypond-program.info
133         -install-info --remove --info-dir=$(infodir) $(outdir)/lilypond-learning.info
134         -install-info --remove --info-dir=$(infodir) $(outdir)/lilypond-internals.info
135         -install-info --remove --info-dir=$(infodir) $(outdir)/music-glossary.info
136         install-info --info-dir=$(infodir) $(outdir)/lilypond.info
137         @echo
138         @echo "***************************************************************"
139         @echo "For images in the INFO docs to work, do"
140         @echo
141         @echo "    make out=www install-info "
142         @echo
143 endif # installing into standard /usr/* root# installing into /usr/...
144
145 endif # out!=www
146
147 # All web targets, except info image symlinks and info docs are
148 # installed in non-recursing target from TOP-SRC-DIR
149 local-install-WWW: local-install-info
150 local-uninstall-WWW: local-uninstall-info
151
152 default:
153
154 local-clean:
155         rm -f lilypond
156
157 local-help: extra-local-help
158
159 extra-local-help:
160         @echo -e "\
161   info        update info pages\n\
162   ps          update PostScript documents\n\
163   xml         update Docbook xml documentation\n\
164 "
165
166 # Generic rule using % twice not possible?
167 # $(outdir)/%/%.html: $(outdir)/%.texi
168 $(outdir)/lilypond.texi: $(outdir)/lilypond-internals.texi
169 $(outdir)/lilypond.nexi: $(outdir)/lilypond-internals.texi
170
171 #
172 # Split manuals in HTML
173 #
174 $(outdir)/lilypond/index.html: $(OUT_PNG_IMAGES) $(OUT_EPS_IMAGES)
175 $(outdir)/lilypond-program/index.html: $(OUT_PNG_IMAGES) $(OUT_EPS_IMAGES)
176 $(outdir)/lilypond-learning/index.html: $(OUT_PNG_IMAGES) $(OUT_EPS_IMAGES)
177 $(outdir)/music-glossary/index.html: $(OUT_PNG_IMAGES) $(OUT_EPS_IMAGES)
178
179
180 #
181 # Manuals in one big HTML page
182 #
183 $(outdir)/lilypond-big-page.html: $(OUT_PNG_IMAGES)
184 $(outdir)/lilypond-program-big-page.html: $(OUT_PNG_IMAGES)
185 $(outdir)/lilypond-learning-big-page.html: $(OUT_PNG_IMAGES)
186
187 $(outdir)/lilypond.xml: $(outdir)/lilypond.texi
188         mkdir -p $(dir $@)
189         $(MAKEINFO) -I$(outdir) --output=$@ --docbook $<
190
191 $(outdir)/lilypond-internals/lilypond-internals.xml: $(outdir)/lilypond-internals.texi
192         mkdir -p $(dir $@)
193         $(MAKEINFO) --output=$(outdir)/lilypond-internals --docbook $<
194
195 $(outdir)/lilypond.pdf $(outdir)/lilypond-program.pdf: $(OUT_PDF_IMAGES) $(OUT_PNG_IMAGES)
196 $(outdir)/lilypond-learning.pdf $(outdir)/music-glossary.pdf: $(OUT_PDF_IMAGES) $(OUT_PNG_IMAGES)
197
198 $(outdir)/%.png: %.png
199         convert -depth 8 -geometry 50x50% $< $@
200
201 $(outdir)/%.png: %.eps
202         gs -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=$@ -sDEVICE=png16m -dEPSCrop -dNOPAUSE -f $< -c quit
203
204 $(outdir)/%.pdf: %.png
205         convert -depth 8 $< $@
206
207 $(outdir)/%.pdf: %.eps
208         gs -dAutoRotatePages=/None -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -sOutputFile=$@ -dEPSCrop -c .setpdfwrite -f $<
209
210
211 DEEP_HTML_FILES =\
212  $(outdir)/lilypond/index.html\
213  $(outdir)/lilypond-internals/index.html\
214  $(outdir)/music-glossary/index.html\
215  $(outdir)/lilypond-program/index.html\
216  $(outdir)/lilypond-learning/index.html
217
218 # Symlinks to refer to external source documents from split and non-split HTML
219 source-links = $(outdir)/source $(outdir)/lilypond/source $(outdir)/music-glossary/source $(outdir)/lilypond-program/source $(outdir)/lilypond-learning/source
220
221 $(outdir)/source:
222         @rm -f $(@)
223         ln -sf ../../ $(@)
224
225 $(outdir)/%/source:
226         @rm -f $(@)
227         mkdir -p $(dir $@)
228         ln -sf ../../../ $(@)
229
230 local-WWW: $(HTML_FILES) $(DEEP_HTML_FILES)\
231  $(datafiles) $(PDF_FILES) $(source-links) info
232
233 $(outdir)/%.bib: %.bib
234         ln -f $< $@
235
236
237 # lilypond.texi deps
238 $(top-build-dir)/mf/$(outconfbase)/feta16list.ly:
239         $(MAKE) -C $(top-src-dir)/mf
240
241 $(outdir)/lilypond.texi $(outdir)/lilypond-program.texi $(outdir)/lilypond-learning.texi: $(ITELY_FILES) $(ITEXI_FILES)
242 $(outdir)/lilypond.nexi $(outdir)/lilypond-program.nexi $(outdir)/lilypond-learning.nexi: $(ITELY_FILES) $(ITEXI_FILES)
243
244
245 # Rules for the automatically generated documentation
246
247 # There used to be a dependency on a dummy target, to force a rebuild
248 # of lilypond-internals every time.  however, this triggers
249 # compilation during install, which is a bad thing (tm).
250
251 $(outdir)/lilypond-internals.nexi $(outdir)/lilypond-internals.texi: $(LILYPOND_BINARY)
252         cd $(outdir) && $(LILYPOND_BINARY) --verbose $(top-src-dir)/ly/generate-documentation
253         rm -f $(outdir)/lilypond-internals.nexi
254         -ln $(outdir)/lilypond-internals.texi $(outdir)/lilypond-internals.nexi
255
256
257 ## unused
258 $(outdir)/interfaces.itexi: dummy
259         cd $(outdir) && lilypond $(top-src-dir)/ly/generate-interface-doc