1depth = ..
2
3########################
4#  Documentation build #
5########################
6
7#############
8### Variables
9
10NAME = documentation
11
12SUBDIRS = po
13LOCALSTEPMAKE_TEMPLATES = lilypond ly lilypond-book
14
15### Extra flags
16
17LILYPOND_BOOK_FLAGS = --extra-options '-e "(ly:set-option (quote internal-type-checking) \#t)"'
18TEXI2PDF_FLAGS = \
19  -I $(outdir) \
20  -I $(top-build-dir)/Documentation/$(outconfbase)
21
22### ly examples
23
24LY_EXAMPLES=$(call src-wildcard,ly-examples/*.ly)
25OUT_BITMAP_IMAGES += $(LY_EXAMPLES:%.ly=$(outdir)/%.png) $(LY_EXAMPLES:%.ly=$(outdir)/%-small.png)
26LILYPOND_PREVIEW = $(LILYPOND_BINARY) -dpreview -dresolution=150
27
28### Pictures
29
30BITMAP_IMAGES = $(call src-wildcard,pictures/*.png) $(call src-wildcard,pictures/*.jpg)
31EPS_ILLUSTRATIONS = $(call src-wildcard,pictures/*.eps)
32SVG_FILES = $(call src-wildcard,pictures/*.svg)
33PDF_DIR = $(call src-wildcard,pictures/pdf/*.pdf)
34
35OUT_PDF_IMAGES = $(EPS_ILLUSTRATIONS:%.eps=$(outdir)/%.pdf)
36OUT_BITMAP_IMAGES += $(BITMAP_IMAGES:%=$(outdir)/%)
37OUT_BITMAP_IMAGES += $(EPS_ILLUSTRATIONS:%.eps=$(outdir)/%.png)
38
39MISC_FILES = ANNOUNCE-0.1 ANNOUNCE-1.0 ANNOUNCE-1.2 announce-v2.0.html \
40announce-v2.10.html announce-v2.12.ca.html announce-v2.12.de.html \
41announce-v2.12.es.html announce-v2.12.fr.html announce-v2.12.html \
42announce-v2.2.html announce-v2.4.html announce-v2.6.html \
43announce-v2.8.html browser-language.ca.html browser-language.de.html \
44browser-language.es.html browser-language.fr.html \
45browser-language.html browser-language.hu.html \
46browser-language.it.html browser-language.ja.html \
47browser-language.nl.html ChangeLog-1.5 ChangeLog-2.1 ChangeLog-2.10 \
48ChangeLog-2.3 CHANGES-0.0 CHANGES-0.1 CHANGES-1.0 CHANGES-1.1 \
49CHANGES-1.2 CHANGES-1.3 CHANGES-1.4 CHANGES-1.5 NEWS-1.2 NEWS-1.4 \
50THANKS-1.8 THANKS-2.0 THANKS-2.10 THANKS-2.12 THANKS-2.14 THANKS-2.16 \
51THANKS-2.18 THANKS-2.2 THANKS-2.4 THANKS-2.6 THANKS-2.8
52
53OUT_MISC_FILES = $(addprefix $(outdir)/misc/,$(MISC_FILES))
54OUT_CSS_FILES =  $(addprefix $(outdir)/,$(call src-wildcard,css/*.css))
55
56
57## Snippets:
58# the base files (.ly with english doc) are synced in from the LSR
59# project. Each language adds translated titles under LANGUAGE/texidocs/
60# All translated titles are merged by makesnippets.py. lilypond-book
61# texi language support picks up the right header based on document
62# language.
63
64IN_ITELY_FILES = $(call src-wildcard,snippets/*-intro.itely)
65SNIPPET_LY_FILES = $(call src-wildcard,snippets/*.ly)
66OUT_SNIPPET_LY_FILES = $(SNIPPET_LY_FILES:%.ly=$(outdir)/%.ly)
67
68### Out files
69
70LANG_TELY_FILES=$(call src-wildcard,$(1)/*.tely)
71LANG_TEXI_FILES=$(call src-wildcard,$(1)/*.texi)
72
73DOC_TELY_FILES=$(foreach L,$(LANGS),$(call LANG_TELY_FILES,$(L)))
74DOC_TEXI_FILES=$(foreach L,$(LANGS),$(call LANG_TEXI_FILES,$(L)))
75
76# All .xref-map files for a single language
77LANG_XREF_FILES=$(addprefix $(outdir)/,$(patsubst %.tely,%.xref-map,$(patsubst %.texi,%.xref-map,$(call LANG_TEXI_FILES,$(1)) $(call LANG_TELY_FILES,$(1)))))
78
79DOC_BASENAMES=contributor changes essay extending internals learning music-glossary notation snippets usage web
80
81# Main manuals
82TEXINFO_MANUALS = en/internals \
83 $(DOC_TELY_FILES:%.tely=%)\
84 $(DOC_TEXI_FILES:%.texi=%)
85
86# In info, images will be loaded from this dir
87INFO_IMAGES_DIR = lilypond
88
89# Some PDF files require extra packages to build
90#
91# Czech - needs xetex
92#
93# Chinese/Japanese - needs:
94#
95#   XeTeX 0.9998+ (TeX Live 2012+)
96#     The modern TeX engine used for LilyPond's PDF documents.
97#     It might be contained in texlive-xetex package.
98#
99#   IPAex fonts
100#     Japanese fonts.
101#     It might be contained in texlive-lang-japanese package.
102#
103#   zhspacing
104#     Spacing for mixed CJK-English documents in XeTeX.
105#     It might be contained in texlive-lang-chinese package.
106#     (This package is for Chinese, but can also be used for Japanese.)
107#
108# Note: Even if Japanese PDF documents have been built,
109# links from HTML documents to Japanese PDF will not be created.
110#
111
112ALL_PDF_FILES=$(TEXINFO_MANUALS:%=$(outdir)/%.pdf)
113
114# uncomment below to build PDF in cs/ja/zh
115# PDF_FILES=$(ALL_PDF_FILES)
116PDF_FILES = $(filter-out $(outdir)/cs/% $(outdir)/zh/% $(outdir)/ja/%, $(ALL_PDF_FILES))
117
118target_language=$(word 2, $(subst /, ,$@))
119
120TEXI2HTML_INIT = \
121  --init-file=$(top-src-dir)/Documentation/lilypond-texi2html-lang.init \
122  --document-language=$(call target_language) \
123  --init-file=$(top-src-dir)/Documentation/lilypond-texi2html.init
124
125TEXI2HTML_INCLUDES += $(DOCUMENTATION_INCLUDES)
126
127TEXI2HTML_FLAGS += $(TEXI2HTML_ERROR_LIMIT) $(TEXI2HTML_INCLUDES) $(TEXI2HTML_INIT) \
128	$(if $(VERBOSE),--verbose)
129TEXI2HTML = TOP_SRC_DIR=$(top-src-dir) PERL_UNICODE=SD $(TEXI2HTML_PROGRAM)
130
131ifeq ($(WEB_VERSION),yes)
132TEXI2HTML_FLAGS += -D web_version
133TEXI2PDF_LOCAL_FLAGS += -D web_version
134WEB_ENV=ONLY_WEB_VERSION=v$(MAJOR_VERSION).$(MINOR_VERSION)
135endif
136
137SPLIT_HTML_MANUALS = $(TEXINFO_MANUALS)
138SPLIT_HTML_INDEX_FILES = $(SPLIT_HTML_MANUALS:%=$(outdir)/%/index.html)
139
140# Other out files
141
142MAIN_INFO_DOC = lilypond-web
143
144# This list must stay in sync with the corresponding @direntry block
145# in file `web.texi`.
146INFO_DOCS = \
147  lilypond-changes \
148  lilypond-contributor \
149  lilypond-essay \
150  lilypond-extending \
151  lilypond-internals \
152  lilypond-learning \
153  lilypond-notation \
154  lilypond-snippets \
155  lilypond-usage \
156  music-glossary
157# Some info files should only be processed if `$(out)` is equal to
158# `www`, but we generate them anyway.  Reason is that we use repeated
159# calls to `install-info` during installation to properly remove old
160# entries in info's `dir` file, and older LilyPond versions inserted
161# more entries that are no longer present.
162ALL_INFO_DOCS = \
163  $(INFO_DOCS) \
164  lilypond-web
165ifeq ($(out),www)
166INFO_DOCS += lilypond-web
167endif
168INFO_FILES = $(INFO_DOCS:%=$(outdir)/%.info)
169ALL_INFO_FILES = $(ALL_INFO_DOCS:%=$(outdir)/%.info)
170
171include $(depth)/make/stepmake.make
172
173# must be here, or overwritten by lilypond-book-var
174OUT_HTML_FILES = $(foreach m, $(SPLIT_HTML_MANUALS),$(outdir)/$(m)-big-page.html)
175EXTRACT_TEXI_FILENAMES_FLAGS+= $(if $(VERBOSE),,--quiet)
176
177# xref map maps section titles <> node names for translated split HTML docs.
178$(outdir)/%.xref-map: $(outdir)/%.texi
179	$(call ly_progress,Making,$@,< texi)
180	$(PYTHON) -tt $(buildscript-dir)/extract_texi_filenames.py \
181		$(EXTRACT_TEXI_FILENAMES_FLAGS) \
182		$(if $(call target_language), \
183			--master-map-file=$(subst $(call target_language)/,en/,$@)) \
184		$(DOCUMENTATION_INCLUDES) -o $(dir $@) $<
185
186$(outdir)/%.pdf: $(outdir)/%.texi \
187                 $(outdir)/version.itexi \
188                 $(outdir)/weblinks.itexi \
189                 $(OUT_PDF_IMAGES) \
190                 $(OUT_BITMAP_IMAGES) \
191                 | pre-pdf
192	$(call ly_progress,Making,$@,< texi)
193	TEX=$(PDFTEX) PDFTEX=$(PDFTEX) PDFLATEX=$(PDFLATEX) \
194		$(buildscript-dir)/run-and-check.sh \
195"cd $(dir $@); \
196   texi2pdf --batch $(TEXI2PDF_LOCAL_FLAGS) \
197   -I ../ \
198   -I $(abs-src-dir)/$(call target_language) \
199   -I $(abs-src-dir) \
200   -I $(abs-src-dir)/en/ \
201   -o $(CURDIR)/$(outdir)/$*.tmp.pdf \
202   $(CURDIR)/$< \
203   < /dev/null" \
204		"$(outdir)/$*.texi2pdf.log"
205ifeq ($(USE_EXTRACTPDFMARK),yes)
206	$(EXTRACTPDFMARK) -o $(outdir)/$*.pdfmark $(outdir)/$*.tmp.pdf
207	$(GS920) -dBATCH \
208                 -dNOSAFER \
209                 -dNOPAUSE \
210		 -q \
211                 -sDEVICE=pdfwrite \
212                 -dAutoRotatePages=/None \
213                 -dPrinted=false \
214                 -sOutputFile=$@ \
215                 -c "30000000 setvmthreshold" \
216                 -I $(top-build-dir)/out-fonts \
217                 -I $(top-build-dir)/out-fonts/Font \
218                 $(outdir)/$*.pdfmark \
219                 $(outdir)/$*.tmp.pdf
220	rm $(outdir)/$*.tmp.pdf
221else
222	mv $(outdir)/$*.tmp.pdf $@
223endif
224
225# LilyPond uses Cyrillic in its documentation; the used fonts are from the
226# LH family.  By default, its metrics files are generated on the fly, which
227# might cause problems in parallel make jobs.  For this reason we make
228# TeXLive generate the needed TFM files in advance.
229pre-pdf:
230	$(call ly_info,Making latt1095.tfm in TeXLive (mktextfm))
231	$(buildscript-dir)/run-and-check.sh \
232          "mktextfm latt1095" "$(outdir)/latt1095.mktextfm.log"
233	$(call ly_info,Making larm1095.tfm in TeXLive (mktextfm))
234	$(buildscript-dir)/run-and-check.sh \
235          "mktextfm larm1095" "$(outdir)/larm1095.mktextfm.log"
236
237$(outdir)/%/index.html: $(outdir)/%.texi $(outdir)/version.itexi $(outdir)/weblinks.itexi $(OUT_BITMAP_IMAGES) $(OUT_CSS_FILES)
238	$(call ly_progress,Making,$@,< texi)
239	mkdir -p $(dir $@)
240	rm -f $(dir $@)/pictures && ln -s ../pictures $(dir $@)/pictures
241	rm -f $(dir $@)/css && ln -s ../../css $(dir $@)/css
242	$(buildscript-dir)/run-and-check.sh "$(WEB_ENV) DEPTH=$(depth)/../ $(TEXI2HTML)  --prefix=index --split=section $(TEXI2HTML_FLAGS) --output=$(dir $@) $<"  "$(outdir)/$*.splittexi.log"
243
244$(outdir)/%-big-page.html: $(outdir)/%.texi $(outdir)/version.itexi $(outdir)/weblinks.itexi
245	$(call ly_progress,Making,$@,< texi)
246	$(buildscript-dir)/run-and-check.sh "DEPTH=$(depth) $(TEXI2HTML) $(TEXI2HTML_FLAGS) -D bigpage --output=$@ $<"  "$(outdir)/$*.bigtexi.log"
247
248DOCUMENTATION_INCLUDE_DIRS = \
249  $(src-dir)/$(call target_language) \
250  $(src-dir)/pictures \
251  $(dir $@) \
252  $(outdir)/en \
253  $(src-dir)/en \
254  $(src-dir)/en/included \
255  $(outdir) \
256  $(src-dir)
257
258DOCUMENTATION_INCLUDES = $(addprefix -I ,$(DOCUMENTATION_INCLUDE_DIRS))
259
260# Before calling lilypond-book, we change directory to $(outdir) which is
261# thereby prependend to the list of include directories. This also means
262# all other directories listed below must be absolute.
263LILYPOND_BOOK_INCLUDE_DIRS = \
264  $(src-dir)/$(call target_language) \
265  $(src-dir)/pictures \
266  $(src-dir)/en \
267  $(src-dir)/en/included \
268  $(src-dir)
269
270LILYPOND_BOOK_INCLUDES = $(addprefix -I ,$(LILYPOND_BOOK_INCLUDE_DIRS))
271
272### bad hack for badly-integrated roadmap.
273# TODO: move into CG.
274$(outdir)/en/ROADMAP: $(top-src-dir)/ROADMAP
275	$(call ly_progress,Making,$@,(copy))
276	mkdir -p $(dir $@)
277	cp $(top-src-dir)/ROADMAP $@
278
279$(outdir)/en/contributor.texi: $(outdir)/en/ROADMAP
280
281$(outdir)/topdocs/NEWS.texi: $(outdir)/en/changes.texi
282	mkdir -p $(dir $@)
283	cp $< $@
284
285### bad hack for badly-integrated bibliography
286$(outdir)/%.itexi: bib/%.bib
287	$(call ly_progress,Making,$@,< bib)
288	BSTINPUTS=$(src-dir)/essay $(PYTHON) $(buildscript-dir)/bib2texi.py \
289		-s $(top-src-dir)/Documentation/lily-bib -o $@ -q $<
290
291$(DOC_TELY_FILES:%.tely=$(outdir)/%.texi):
292
293###########
294### Targets
295
296default: $(ALL_INFO_FILES)
297
298local-help: extra-local-help
299
300extra-local-help:
301	@echo "  check-xrefs [ISOLANG=LL] validate Texinfo cross-references"
302	@echo "  fix-xrefs [ISOLANG=LL]   interactively fix Texinfo cross-references"
303	@echo "                             (use with caution)"
304	@echo "  info                     update info pages"
305	@echo
306	@echo "Translations specific targets (see TRANSLATION for details):"
307	@echo "  new-lang ISOLANG=LL           create and initialize"
308	@echo "                                  subdirectory \'LL' for language \'LL"
309	@echo "                                  (if \'LL exists, update missing file)"
310	@echo "  po-update                     update and replace PO files for"
311	@echo "                                  documentation with msgmerged versions"
312	@echo "  check-translation ISOLANG=LL  show changes in English docs since"
313	@echo "                                  last translation update"
314	@echo "  update-translation ISOLANG=LL call $$$$EDITOR to help updating"
315	@echo "                                  the translation"
316	@echo "  snippet-update ISOLANG=LL     update ly snippets in Texinfo translation"
317	@echo "                                  according to docs in English"
318	@echo "                                  (use with caution)"
319	@echo
320	@echo "  LL refers to the desired locale"
321	@echo "    (most often only the ISO 639 language code)."
322	@echo
323
324####
325## Info targets (optionally with images)
326
327info: $(ALL_INFO_FILES)
328
329local-install: install-info
330
331install-info: $(INFO_FILES) install-info-images update-info-directory-file-install
332	$(INSTALLPY) -d $(DESTDIR)$(infodir) ; \
333	$(INSTALLPY) -c -m 644 $(addsuffix *, $(INFO_FILES)) $(DESTDIR)$(infodir)
334
335uninstall-info: uninstall-info-images update-info-directory-file-uninstall
336	rm -f $(addprefix $(DESTDIR)$(infodir)/,$(addsuffix *, $(INFO_DOCS)))
337
338ifeq ($(out),www)
339UPDATE_IMAGE_SYMLINKS=mkdir -p $(outdir)/$(INFO_IMAGES_DIR) && \
340  cd $(outdir)/$(INFO_IMAGES_DIR) && \
341  ln -sf ../en/[a-f0-9][a-f0-9] .
342else
343UPDATE_IMAGE_SYMLINKS=true
344endif
345
346install-info-images: $(INFO_FILES)
347ifeq ($(out),www)
348# remove $(infodir)/$(INFO_IMAGES_DIR) in case it is a symlink
349	rm -rf $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
350ifneq ($(COPY_INFO_IMAGES),)
351	$(INSTALL) -d $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
352	rsync --copy-links -r  $(outdir)/lilypond/?? $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
353# There is probably an rsync invocation to just copy the png files,
354# but I am too lazy to try harder to find it.
355	find $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR) -type f -not -name '*.png' -delete
356else # !COPY_INFO_IMAGES
357	$(INSTALL) -d $(DESTDIR)$(infodir)
358	cd $(DESTDIR)$(infodir) && \
359		ln -sf $$($(PYTHON) $(buildscript-dir)/relative.py \
360			$(DESTDIR)$(webdir)/Documentation ) \
361		$(INFO_IMAGES_DIR)
362endif #!COPY_INFO_IMAGES
363else
364	true
365endif #out=www
366
367uninstall-info-images:
368	rm -rf $(DESTDIR)$(infodir)/$(INFO_IMAGES_DIR)
369
370ifeq ($(patsubst %/local,%,$(DESTDIR)$(prefix)),/usr)
371
372# installing directly into standard /usr/...
373update-info-directory-file-install: \
374  $(ALL_INFO_FILES) \
375  update-info-directory-file-uninstall
376	-$(INSTALL) -d $(DESTDIR)$(infodir)
377	install-info --info-dir=$(infodir) $(outdir)/$(MAIN_INFO_DOC).info
378
379update-info-directory-file-uninstall:
380	$(foreach f, \
381                  $(ALL_INFO_FILES), \
382                  install-info --remove \
383                               --info-dir=$(infodir) \
384                               $(f) &> /dev/null ; )true
385
386else
387## installing elsewhere; probably part of a packaging step.
388## install-info can't do all its job for binary packages' build systems.
389## Best we can do is to notify the builder or packager.
390update-info-directory-file-install: $(INFO_FILES)
391	-$(INSTALL) -d $(DESTDIR)$(infodir)
392	@echo
393	@echo "***************************************************************"
394	@echo "Please add or update the LilyPond direntries,"
395	@echo "do or add in the postinstall script"
396	@echo
397	@echo "    install-info --info-dir=$(infodir) $(DESTDIR)$(infodir)/$(MAIN_INFO_DOC).info"
398	@echo
399
400update-info-directory-file-uninstall:
401# nothing to be done: we can't remove the dir because it might have
402# other info files.
403	true
404
405endif
406
407### Web targets
408
409PICTURE_SYMLINKS=$(foreach L,$(LANGS),$(outdir)/$(L)/pictures)
410
411PDF_TARGETS = $(OUT_PDF_IMAGES) $(PDF_FILES)
412pdf: $(PDF_TARGETS)
413
414HTML_TARGETS = $(OUT_HTML_FILES) $(SPLIT_HTML_INDEX_FILES)
415HTML_MISC_TARGETS = $(OUT_BITMAP_IMAGES) $(OUT_CSS_FILES) $(OUT_MISC_FILES)
416html: $(HTML_TARGETS) $(HTML_MISC_TARGETS)
417
418# Do not specify phony targets (pdf, html) as dependencies to avoid bulding the
419# webdoc tree every time.
420$(outdir)/webdoc/dep: $(PDF_TARGETS) $(PICTURE_SYMLINKS) $(HTML_TARGETS) $(HTML_MISC_TARGETS)
421	$(call ly_progress,Making,$(dir $@),)
422	cd $(outdir) && $(buildscript-dir)/build-doc-tree.sh webdoc "$(LANGS)" $(LYS_OUTPUT_DIR) "$(DOC_BASENAMES)"
423	touch $@
424
425local-WWW: $(outdir)/webdoc/dep
426
427WEB_HTML_TARGETS = $(foreach L,$(LANGS),$(outdir)/$(L)/web/index.html $(outdir)/$(L)/web-big-page.html)
428$(outdir)/website/dep: $(WEB_HTML_TARGETS) $(HTML_MISC_TARGETS) $(PICTURE_SYMLINKS)
429	$(call ly_progress,Making,$(dir $@),)
430	cd $(outdir) && $(buildscript-dir)/build-doc-tree.sh website "$(LANGS)" "" "web"
431	cp $(foreach F, favicon.ico robots.txt tweets.xml, $(src-dir)/webserver/$(F)) $(outdir)/website/web/
432	cp $(src-dir)/webserver/website-dir.htaccess $(outdir)/website/web/.htaccess
433	touch $@
434
435website: $(outdir)/website/dep
436
437#########
438### Rules
439
440$(outdir)/misc/%: misc/%
441	$(call ly_progress,Copying,$@,< source)
442	mkdir -p $(dir $@)
443	cp -f $< $@
444
445# Copy files while tracking their dependencies.
446$(outdir)/%.texi: %.texi
447	$(call ly_progress,Making,$@,(copy))
448	mkdir -p $(dir $@)
449	cp -f $< $@
450
451$(outdir)/%.txt: $(outdir)/%.texi $(outdir)/version.itexi $(outdir)/weblinks.itexi
452	$(call ly_progress,Making,$@,< texi)
453	$(buildscript-dir)/run-and-check.sh "$(MAKEINFO) $(DOCUMENTATION_INCLUDES) --no-split --no-headers --output $@ $<"  "$(outdir)/$*.makeinfotxt.log"
454
455$(outdir)/version.itexi: $(top-src-dir)/VERSION
456	$(call ly_progress,Making,$@,)
457	$(PYTHON) -tt $(buildscript-dir)/create-version-itexi.py > $@
458
459$(outdir)/weblinks.itexi: $(top-src-dir)/VERSION
460	$(call ly_progress,Making,$@,)
461	$(PYTHON) -tt $(buildscript-dir)/create-weblinks-itexi.py > $@
462
463$(outdir)/lilypond-%.info: $(outdir)/en/%.texi $(outdir)/version.itexi $(outdir)/weblinks.itexi
464	$(call ly_progress,Making,$@,< texi)
465	$(buildscript-dir)/run-and-check.sh "$(MAKEINFO) $(DOCUMENTATION_INCLUDES)  --output=$@ $<"  "$(outdir)/$*.makeinfo.log"
466	$(UPDATE_IMAGE_SYMLINKS)
467
468$(outdir)/lilypond-internals.info: $(outdir)/en/internals.texi $(outdir)/version.itexi $(outdir)/weblinks.itexi
469	$(call ly_progress,Making,$@,< texi)
470	$(buildscript-dir)/run-and-check.sh "$(MAKEINFO) $(DOCUMENTATION_INCLUDES) -I$(outdir) --output=$@ $<"  "$(outdir)/$*.makeinfo.log"
471	$(UPDATE_IMAGE_SYMLINKS)
472
473$(outdir)/music-glossary.info: $(outdir)/en/music-glossary.texi $(outdir)/version.itexi $(outdir)/weblinks.itexi
474	$(call ly_progress,Making,$@,< texi)
475	$(buildscript-dir)/run-and-check.sh "$(MAKEINFO) $(DOCUMENTATION_INCLUDES) --output=$@ $<"  "$(outdir)/$*.makeinfo.log"
476	$(UPDATE_IMAGE_SYMLINKS)
477
478$(outdir)/learning.texi $(outdir)/notation.texi: $(OUT_PDF_IMAGES)
479
480## Snippets rules idiosyncrasies.
481# The snippets are generated by combining the .ly files in snippets (imported from LSR)
482# with the translations in ${LANG}/texidocs/
483$(outdir)/snippets/%.itely: snippets/%-intro.itely snippets/%.snippet-list
484	$(call ly_progress,Making,$@,)
485	mkdir -p $(dir $@)
486	xargs $(LYS_TO_TELY) --prefix=snippets/ -f doctitle,texidoc,verbatim --name=$@ --template=$< < $(filter %.snippet-list, $^)
487
488$(outdir)/snippets/dep: $(SNIPPET_LY_FILES)
489	$(call ly_progress,Making,$@,)
490	mkdir -p $(dir $@)
491	$(PYTHON) $(buildscript-dir)/makesnippets.py $(src-dir)/snippets $(dir $@) "$(LANGS)" $(src-dir)
492	mkdir -p out
493	touch $@
494
495$(outdir)/en/internals.texi:
496	$(call ly_progress,Making,$@,)
497	mkdir -p $(dir $@)
498	cd $(dir $@) && $(buildscript-dir)/run-and-check.sh "$(LILYPOND_BINARY) --verbose $(top-src-dir)/ly/generate-documentation" "generate-documentation.log"
499
500
501## Different manuals within a language link to each other. This can only work if
502## the target document has an xref-map too
503define per_lang_per_doc_deps
504
505# lilypond-book automatically generates .dep files, but only for .itely files.
506$(outdir)/$(1)/$(2).texi: $(call src-wildcard,$(1)/$(2)/*.itexi) $(outdir)/version.itexi
507
508$(outdir)/$(1)/$(2).xref-map: $(outdir)/$(1)/$(2).texi
509
510ifneq ($(1),en)
511$(outdir)/$(1)/$(2).xref-map: $(outdir)/en/$(2).xref-map
512endif
513
514$(outdir)/$(1)/$(2)/index.html: $(call LANG_XREF_FILES,$(1))
515
516$(outdir)/$(1)/$(2)-big-page.html: $(call LANG_XREF_FILES,$(1))
517
518endef
519
520
521## Dependencies on the automatically generated content
522define per_lang_dep
523
524include $(wildcard $(outdir)/$(1)/*.dep)
525
526$(outdir)/$(1)/snippets.texi: $(IN_ITELY_FILES:snippets/%-intro.itely=$(outdir)/snippets/%.itely) $(outdir)/snippets/dep
527
528$(outdir)/$(1)/notation.texi: $(outdir)/snippets/dep
529
530$(outdir)/$(1)/learning.texi: $(outdir)/snippets/dep
531
532$(outdir)/$(1)/usage.texi: $(outdir)/snippets/dep
533
534$(outdir)/$(1)/web.xref-map: EXTRACT_TEXI_FILENAMES_FLAGS += --split=node
535
536$(outdir)/$(1)/pictures:
537	rm -f $$@ && mkdir -p $$(dir $$@) && ln -s ../pictures $$@
538
539# Adjust the @direntry block to only list installed info files.
540$(outdir)/$(1)/web.texi: \
541  $(1)/web.texi \
542  $(outdir)/we-wrote.itexi \
543  $(outdir)/others-did.itexi \
544  $(outdir)/weblinks.itexi \
545  $(outdir)/version.itexi
546ifneq ($(out),www)
547	$(call ly_progress,Making,$$@,(sed))
548	mkdir -p $$(dir $$@)
549	sed -e '/^\*.*lilypond-snippets/d' \
550            -e '/^\*.*lilypond-web/d' \
551            < $$< > $$@
552endif
553
554$(outdir)/$(1)/essay.texi: \
555  $(outdir)/colorado.itexi \
556  $(outdir)/computer-notation.itexi \
557  $(outdir)/engravingbib.itexi
558
559# notation.tely includes, via notation/notation-appendices.itely, many
560# generated files (like markup-commands.tely). These are the result of
561# processing ly/generate-documentation.ly for internals.texi (see above).
562$(outdir)/$(1)/notation.texi: $(outdir)/en/internals.texi
563
564$(foreach D,$(DOC_BASENAMES),$(eval $(call per_lang_per_doc_deps,$(1),$(D))))
565endef
566
567$(foreach L, $(LANGS),$(eval $(call per_lang_dep,$(L))))
568
569###############################################
570#  Documentation and translations maintenance #
571###############################################
572po-update:
573	$(MAKE) -C po po-update
574
575ifneq ($(NO_COLOR),)
576CHECK_TRANSLATION_FLAGS = --no-color
577endif
578
579ifneq ($(ISOLANG),)
580new-lang-dir:
581	mkdir -p $(ISOLANG)/$(DIR)
582	rm -f $(outdir)/*.*tely $(outdir)/*.*texi
583	$(PYTHON) $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) -o doc.pot --skeleton --gettext $$(cd $(ISOLANG) && ls -1 ../$(DIR).tely ../$(DIR).texi)
584	for i in $$(cd $(outdir) && ls -1 $(DIR).tely $(DIR).texi); do\
585	    test -e $(ISOLANG)/$$i || mv $(outdir)/$$i $(ISOLANG)/$$i;\
586	done
587	rm -f $(outdir)/$(DIR).tely $(outdir)/$(DIR).texi
588	for i in $$(cd $(outdir) && ls -1 *.*tely *.*texi); do\
589	    test -e $(ISOLANG)/$(DIR)/$$i\
590		|| test -e $(ISOLANG)/$$i\
591		|| mv $(outdir)/$$i $(ISOLANG)/$(DIR)/$$i;\
592	done
593
594new-lang:
595# Also for updating/adding missing files
596	mkdir -p $(ISOLANG)/included
597	if test -z "`ls $(ISOLANG)/included`"; then touch $(ISOLANG)/included/.gitignore; fi
598	$(foreach i,$(TRANSLATION_DIRS),$(MAKE) new-lang-dir DIR=$(i) &&) :
599	msgmerge -U po/lilypond-doc.pot $(outdir)/doc.pot
600	test -e po/$(ISOLANG).po || cp po/lilypond-doc.pot po/$(ISOLANG).po
601	@echo "***  Please add a language definition for $(ISOLANG) in python/langdefs.py  ***"
602
603TRANSLATION_DIRS = web texidocs
604TRANSLATION_FILES = $(shell git ls-files $(ISOLANG))
605
606TELY_FILES = $(call src-wildcard,$(ISOLANG)/*.tely)
607
608snippet-update:
609	$(PYTHON) $(auxscript-dir)/update-snippets.py user $(ISOLANG) '*.itely'
610
611endif # ISOLANG
612
613check-xrefs:
614	$(PYTHON) $(auxscript-dir)/check_texi_refs.py --batch \
615	$(DOCUMENTATION_INCLUDES) $(auxpython-dir)/manuals_definitions.py
616
617fix-xrefs:
618	$(PYTHON) $(auxscript-dir)/check_texi_refs.py --auto-fix \
619	$(DOCUMENTATION_INCLUDES) $(auxpython-dir)/manuals_definitions.py
620
621check-translation:
622	cd $(src-dir) && ISOLANG=$(ISOLANG) $(PYTHON) $(auxscript-dir)/check_translation.py $(CHECK_TRANSLATION_FLAGS) $(TRANSLATION_FILES)
623
624update-translation:
625	cd $(src-dir) && ISOLANG=$(ISOLANG) $(PYTHON) $(auxscript-dir)/check_translation.py --update $(CHECK_TRANSLATION_FLAGS) $(TRANSLATION_FILES)
626
627translation-status:
628	cd $(src-dir) && PYTHONPATH=$(top-src-dir)/python:$(top-src-dir)/python/auxiliar $(PYTHON) $(top-src-dir)/scripts/auxiliar/translations-status.py
629
630
631#########
632### Image rules
633
634$(outdir)/%-flat-gray.png: %-flat-gray.png
635	$(call ly_progress,Making,$@,(convert))
636	mkdir -p $(dir $@)
637	convert -strip -depth 8 -geometry 50x50% $< $@
638
639$(outdir)/%-flat-bw.png: %-flat-bw.png
640	$(call ly_progress,Making,$@,(convert))
641	mkdir -p $(dir $@)
642	convert -strip -depth 8 -geometry 50x50% $< $@
643
644$(outdir)/%.png: %.png
645	$(call ly_progress,Making,$@,)
646	mkdir -p $(dir $@)
647	cp $< $@
648
649$(outdir)/%.jpg: %.jpg
650	$(call ly_progress,Making,$@,)
651	mkdir -p $(dir $@)
652	cp $< $@
653
654$(outdir)/%.png: %.eps
655	$(call ly_progress,Making,$@,< eps)
656	mkdir -p $(dir $@)
657	gs -dAutoRotatePages=/None \
658           -dPrinted=false \
659           -dTextAlphaBits=4 \
660           -dGraphicsAlphaBits=4 \
661           -q \
662           -sOutputFile=$@ \
663           -sDEVICE=png16m \
664           -dEPSCrop \
665           -dNOPAUSE \
666           -f $< \
667           -c quit
668
669$(outdir)/%.pdf: %.eps
670	$(call ly_progress,Making,$@,< eps)
671	mkdir -p $(dir $@)
672	gs -dAutoRotatePages=/None \
673           -dPrinted=false \
674           -q \
675           -sDEVICE=pdfwrite \
676           -dNOPAUSE \
677           -dBATCH \
678           -sOutputFile=$@ \
679           -dEPSCrop \
680           -f $<
681
682# ly-examples/
683$(outdir)/%.png: %.ly
684	$(call ly_progress,Making,$@,< ly)
685	mkdir -p $(dir $@)
686	$(buildscript-dir)/run-and-check.sh "$(LILYPOND_PREVIEW) -o $(dir $@) $<" "$(outdir)/$*.preview.log"
687	mv $(outdir)/$*.preview.png $@
688
689# Must have ly-examples/ , to avoid conflicts with xxx-small.png from pictures/
690$(outdir)/ly-examples/%-small.png: $(outdir)/ly-examples/%.png
691	$(call ly_progress,Making,$@,(convert))
692	convert -strip -resize 600 -posterize 8 $< png8:$@
693
694## LOGO
695
696ifeq ($(PLATFORM_WINDOWS),yes)
697
698$(outdir)/%.ico: %.xpm
699	$(call ly_progress,Making,$@,< xpm)
700	mkdir -p $(dir $@)
701	$(PYTHON) $(buildscript-dir)/genicon.py $< $@
702
703endif # PLATFORM_WINDOWS
704
705$(outdir)/%.css: %.css
706	$(call ly_progress,Making,$@,(hard link))
707	mkdir -p $(dir $@)
708	cp -f $< $@
709