]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/GNUmakefile
Merge branch 'translation' into staging
[lilypond.git] / Documentation / GNUmakefile
1 depth = ..
2
3 ########################
4 #  Documentation build #
5 ########################
6
7 #############
8 ### Variables
9
10 OUT_DIST_FILES = $(outdir)/ly-grammar.txt
11
12 NAME = documentation
13 LANGS = $(shell $(PYTHON) $(top-src-dir)/python/langdefs.py)
14 SUBDIRS = logo pictures misc po css topdocs \
15   ly-examples $(LANGS)
16 STEPMAKE_TEMPLATES = documentation texinfo tex omf
17 LOCALSTEPMAKE_TEMPLATES = lilypond ly
18
19 ### Extra flags
20
21 LILYPOND_BOOK_FLAGS = --extra-options '-e "(ly:set-option (quote internal-type-checking) \#t)"'
22 TEXI2PDF_FLAGS = \
23   -I $(outdir) \
24   -I $(top-build-dir)/Documentation/$(outconfbase)
25 $(outdir)/snippets-big-page.html: TEXI2HTML_FLAGS += -D short_toc
26 $(outdir)/snippets/index.html: TEXI2HTML_FLAGS += -D short_toc
27
28 ### Extra source files
29
30 README_TOP_FILES= DEDICATION
31
32 IN_ITELY_FILES = $(call src-wildcard,snippets/*-intro.itely)
33 SNIPPET_LY_FILES = $(call src-wildcard,snippets/*.ly)
34 OUT_SNIPPET_LY_FILES = $(SNIPPET_LY_FILES:%.ly=out/%.ly)
35
36 ### Out files
37
38 # Dependencies
39 GENERATED_ITELY_FILES = $(IN_ITELY_FILES:snippets/%-intro.itely=$(outdir)/%.itely)
40
41 XREF_MAPS_FILES += $(XREF_MAPS_DIR)/internals.xref-map
42 OMF_FILES += $(outdir)/internals.html.omf $(outdir)/internals.pdf.omf
43
44 # Main manuals
45 TEXINFO_MANUALS = internals\
46  $(TELY_FILES:%.tely=%)\
47  $(TEXI_FILES:%.texi=%)
48 OUT_TEXINFO_MANUALS = $(TEXINFO_MANUALS:%=$(outdir)/%.texi)
49
50 ## CHAIN_RULE hack: keep the following line *before* including
51 # stepmake.make, so the Internals Reference is built before the
52 # Notation Reference, thus providing automatically generated sections
53 # of the NR
54 TEXI_FILES_FROM_TELY = $(outdir)/internals.texi
55
56 PDF_FILES = $(TEXINFO_MANUALS:%=$(outdir)/%.pdf)
57
58 TOPDIR_HTML_MANUALS =
59 UNSPLIT_HTML_MANUALS =
60 SPLIT_HTML_MANUALS = $(foreach manual, $(TEXINFO_MANUALS),\
61  $(if $(findstring $(manual), $(UNSPLIT_HTML_MANUALS)),,$(manual)))
62 NOT_TOPDIR_HTML_MANUALS = $(foreach manual, $(SPLIT_HTML_MANUALS),\
63  $(if $(findstring $(manual), $(TOPDIR_HTML_MANUALS)),,$(manual)))
64
65 OUT_HTML_FILES = $(UNSPLIT_HTML_MANUALS:%=$(outdir)/%.html)\
66  $(SPLIT_HTML_MANUALS:%=$(outdir)/%-big-page.html)
67 DEEP_HTML_FILES = $(NOT_TOPDIR_HTML_MANUALS:%=$(outdir)/%/index.html)
68
69 # Symlinks to refer to external source documents from split and non-split HTML
70 source-links = $(outdir)/source\
71  $(foreach manual, $(SPLIT_HTML_MANUALS), $(outdir)/$(manual)/source)
72
73 # Other out files
74
75 MAIN_INFO_DOC = lilypond-web
76 INFO_DOCS = lilypond-usage lilypond-changes lilypond-contributor lilypond-internals \
77  lilypond-essay lilypond-learning lilypond-notation music-glossary \
78  lilypond-web lilypond-extending
79 ifeq ($(out),www)
80 INFO_DOCS += lilypond-snippets
81 endif
82 INFO_FILES = $(INFO_DOCS:%=$(outdir)/%.info)
83
84 ifeq ($(out),www)
85 INFO_IMAGES_DIR = lilypond
86 DEST_INFO_IMAGES_SUBDIR = Documentation
87 endif
88
89 include $(depth)/make/stepmake.make
90
91 DOCUMENTATION_INCLUDES += -I $(outdir) \
92   -I $(top-build-dir)/Documentation/snippets/out \
93   -I $(top-src-dir)/Documentation/included \
94   -I $(top-src-dir)/Documentation/pictures \
95   -I $(top-src-dir)/Documentation \
96   -I $(top-src-dir)/input/regression
97
98 OUT_TXT_FILES = $(addprefix $(outdir)/, $(addsuffix .txt, $(README_TOP_FILES)))
99
100
101 ### Web site idiosyncrasies
102 $(XREF_MAPS_DIR)/web.xref-map: XREF_MAP_FLAGS += --split=node
103
104 ### AJAX scripts
105 JS_FILES = $(call src-wildcard,*.js)
106 PHP_FILES = $(call src-wildcard,*.php)
107
108 OUT_JS_FILES = $(JS_FILES:%.js=$(outdir)/%.js)
109 OUT_PHP_FILES = $(PHP_FILES:%.php=$(outdir)/%.php)
110
111
112
113 ### bad hack for badly-integrated roadmap.
114 $(outdir)/ROADMAP:
115         cp $(top-src-dir)/ROADMAP $(outdir)
116 $(outdir)/contributor.texi: $(outdir)/ROADMAP
117
118 ### bad hack for badly-integrated bibliography
119 $(outdir)/colorado.itexi:
120         BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \
121                 -s $(top-src-dir)/Documentation/lily-bib \
122                 -o $(outdir)/colorado.itexi \
123                 -q \
124                 $(src-dir)/essay/colorado.bib
125
126 $(outdir)/computer-notation.itexi:
127         BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \
128                 -s $(top-src-dir)/Documentation/lily-bib \
129                 -o $(outdir)/computer-notation.itexi \
130                 -q \
131                 $(src-dir)/essay/computer-notation.bib
132
133 $(outdir)/engravingbib.itexi:
134         BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \
135                 -s $(top-src-dir)/Documentation/lily-bib \
136                 -o $(outdir)/engravingbib.itexi \
137                 -q \
138                 $(src-dir)/essay/engravingbib.bib
139
140 $(outdir)/essay.texi: \
141   $(outdir)/colorado.itexi \
142   $(outdir)/computer-notation.itexi \
143   $(outdir)/engravingbib.itexi
144
145
146 ###########
147 ### Targets
148
149 default: local-txt-doc
150
151 local-help: extra-local-help
152
153 extra-local-help:
154         @echo "  check-xrefs [ISOLANG=LL] validate Texinfo cross-references"
155         @echo "  fix-xrefs [ISOLANG=LL]   interactively fix Texinfo cross-references"
156         @echo "                             (use with caution)"
157         @echo "  info                     update info pages"
158         @echo "  xml                      update Docbook xml documentation"
159         @echo
160         @echo "Translations specific targets (see TRANSLATION for details):"
161         @echo "  new-lang ISOLANG=LL           create and initialize"
162         @echo "                                  subdirectory \'LL' for language \'LL"
163         @echo "                                  (if \'LL exists, update missing file)"
164         @echo "  po-update                     update and replace PO files for"
165         @echo "                                  documentation with msgmerged versions"
166         @echo "  check-translation ISOLANG=LL  show changes in English docs since"
167         @echo "                                  last translation update"
168         @echo "  update-translation ISOLANG=LL call $$$$EDITOR to help updating"
169         @echo "                                  the translation"
170         @echo "  snippet-update ISOLANG=LL     update ly snippets in Texinfo translation"
171         @echo "                                  according to docs in English"
172         @echo "                                  (use with caution)"
173         @echo
174         @echo "  LL refers to the desired locale"
175         @echo "    (most often only the ISO 639 language code)."
176         @echo
177
178 info: $(INFO_FILES)
179
180 xml: $(outdir)/notation/notation.xml $(outdir)/internals/internals.xml
181
182
183 local-clean:
184         rm -f $(INFO_IMAGES_DIR)
185
186 ### Web targets
187
188 ifeq ($(out),www)
189 local-WWW-1: $(OUT_TEXINFO_MANUALS) $(PDF_FILES) info
190
191 ifeq ($(AJAX_SEARCH),1)
192 local-WWW-2: txt-to-html $(OUT_HTML_FILES) $(DEEP_HTML_FILES) $(OUT_JS_FILES) $(OUT_PHP_FILES) $(source-links) $(OMF_FILES)
193 else
194 local-WWW-2: txt-to-html $(OUT_HTML_FILES) $(DEEP_HTML_FILES) $(source-links) $(OMF_FILES)
195 endif
196
197 endif
198
199
200 #########
201 ### Rules
202
203 $(outdir)/lilypond-%.info: $(outdir)/%.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi $(outdir)/weblinks.itexi | $(OUT_TEXINFO_MANUALS)
204         $(buildscript-dir)/run-and-check "$(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<"  "$*.makeinfo.log"
205
206 txt-to-html: $(OUT_TXT_FILES) $(OUT_TXT_FILES:%.txt=%.html)
207
208 $(OUT_TXT_FILES): $(outdir)/%.txt: $(top-src-dir)/%
209         cp -f $< $@
210
211 $(OUT_TXT_FILES:%.txt=%.html): $(outdir)/%.html: $(outdir)/%.txt
212         $(buildscript-dir)/text2html $<
213
214 # Explicitly list the dependencies on generated content
215 $(outdir)/web.texi: $(outdir)/we-wrote.itexi $(outdir)/others-did.itexi $(outdir)/weblinks.itexi $(outdir)/version.itexi
216
217 ifeq ($(out),www)
218 ## Extra images dependencies
219 $(OUT_TEXINFO_MANUALS): $(outdir)/pictures
220
221 $(outdir)/pictures:
222         $(MAKE) -C pictures out=www WWW-1
223         ln -sf ../pictures/$(outdir) $@
224
225 $(outdir)/web.texi: $(outdir)/css $(outdir)/ly-examples
226
227 $(outdir)/css:
228         $(MAKE) -C css out=www WWW-1
229         ln -sf ../css/$(outdir) $@
230
231 $(outdir)/ly-examples:
232         $(MAKE) -C ly-examples out=www WWW-1
233         ln -sf ../ly-examples/$(outdir) $@
234 endif
235
236
237 # Ugh, using '%' twice not possible
238 $(outdir)/notation/notation.xml: $(outdir)/notation.texi
239         mkdir -p $(dir $@)
240         $(buildscript-dir)/run-and-check "$(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<"  "$*.makeinfoxml.log"
241
242 $(outdir)/internals/internals.xml: $(outdir)/internals.texi
243         mkdir -p $(dir $@)
244         $(buildscript-dir)/run-and-check "$(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<"  "$*.makeinfoxml.log"
245
246 $(outdir)/learning.texi $(outdir)/notation.texi: $(OUT_PDF_IMAGES)
247
248 $(outdir)/source:
249         @rm -f $(@)
250         ln -sf $(depth) $(@)
251
252 $(outdir)/%/source:
253         @rm -f $(@)
254         mkdir -p $(dir $@)
255         ln -sf $(depth)/.. $(@)
256
257
258 ## Snippets rules idiosyncrasies
259 $(outdir)/%.itely: snippets/%-intro.itely snippets/%.snippet-list
260         xargs $(LYS_TO_TELY) -f doctitle,texidoc,verbatim --name=$@ --template=$< < $(filter %.snippet-list, $^)
261
262 $(TEXI_FILES_FROM_TELY): $(GENERATED_ITELY_FILES) $(OUT_SNIPPET_LY_FILES)
263
264 $(OUT_SNIPPET_LY_FILES): out/ly-snippets.dep
265
266 out/ly-snippets.dep: $(SNIPPET_LY_FILES)
267         mkdir -p snippets/out
268         $(buildscript-dir)/makesnippets $(src-dir)/snippets snippets/out $(src-dir)
269         mkdir -p out
270         touch $@
271
272 $(outdir)/%.bib: %.bib
273         ln -f $< $@
274
275 $(outdir)/%.js: %.js
276         ln -f $< $@
277
278 $(outdir)/%.php: %.php
279         ln -f $< $@
280
281 ## notation.texi deps
282 $(top-build-dir)/mf/$(outconfbase)/feta16list.ly:
283         $(MAKE) -C $(top-src-dir)/mf
284
285 $(outdir)/notation.texi: $(outdir)/ly-grammar.txt
286
287 ## Rules for the automatically generated documentation
288 $(outdir)/ly-grammar.txt: $(top-src-dir)/lily/parser.yy
289         cd $(outdir) && $(BISON) -v $<
290         $(buildscript-dir)/yyout2grammar $(outdir)/parser.output $@
291
292 # There used to be a dependency on a dummy target, to force a rebuild
293 # of internals every time.  however, this triggers
294 # compilation during install, which is a bad thing (tm).
295
296 $(outdir)/internals.texi: $(LILYPOND_BINARY) $(INIT_LY_SOURCES) $(SCHEME_SOURCES)
297         cd $(outdir) && $(buildscript-dir)/run-and-check "$(LILYPOND_BINARY) --verbose $(top-src-dir)/ly/generate-documentation" "generate-documentation.log"
298
299 ###############################################
300 #  Documentation and translations maintenance #
301 ###############################################
302 po-update:
303         make -C po po-update
304
305 all-translations-update: po-update translation-status
306         $(foreach lang, $(LANGS), make ISOLANG=$(lang) skeleton-update snippet-update &&) true
307
308 ifneq ($(NO_COLOR),)
309 CHECK_TRANSLATION_FLAGS = --no-color
310 endif
311
312 ifneq ($(ISOLANG),)
313 new-lang-dir:
314         mkdir -p $(ISOLANG)/$(DIR)
315         rm -f $(outdir)/*.*tely $(outdir)/*.*texi
316         $(PYTHON) $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) -o doc.pot --skeleton --gettext $$(cd $(ISOLANG) && ls -1 ../$(DIR).tely ../$(DIR).texi)
317         for i in $$(cd $(outdir) && ls -1 $(DIR).tely $(DIR).texi); do\
318             test -e $(ISOLANG)/$$i || mv $(outdir)/$$i $(ISOLANG)/$$i;\
319         done
320         rm -f $(outdir)/$(DIR).tely $(outdir)/$(DIR).texi
321         for i in $$(cd $(outdir) && ls -1 *.*tely *.*texi); do\
322             test -e $(ISOLANG)/$(DIR)/$$i\
323                 || test -e $(ISOLANG)/$$i\
324                 || mv $(outdir)/$$i $(ISOLANG)/$(DIR)/$$i;\
325         done
326
327 new-lang:
328 # Also for updating/adding missing files
329         mkdir -p $(ISOLANG)/included
330         if test -z "`ls $(ISOLANG)/included`"; then touch $(ISOLANG)/included/.gitignore; fi
331         cp fr/GNUmakefile $(ISOLANG)
332         sed -i -e 's/ISOLANG *= *fr/ISOLANG = $(ISOLANG)/' $(ISOLANG)/GNUmakefile
333         $(foreach i,$(TRANSLATION_DIRS),$(MAKE) new-lang-dir DIR=$(i) &&) :
334         msgmerge -U po/lilypond-doc.pot $(outdir)/doc.pot
335         test -e po/$(ISOLANG).po || cp po/lilypond-doc.pot po/$(ISOLANG).po
336         @echo "***  Please add a language definition for $(ISOLANG) in python/langdefs.py  ***"
337
338 TRANSLATION_DIRS = web texidocs
339 TRANSLATION_FILES = $(shell git ls-files $(ISOLANG) | grep -v GNUmakefile)
340 TEXI_LANGUTIL_FLAGS += --skeleton
341
342 TELY_FILES = $(call src-wildcard,$(ISOLANG)/*.tely)
343 skeleton-update:
344         @echo "$@ has been discontinued"
345         @echo "simply copy .texi, .itexi files you want to translate"
346         exit 2
347         mkdir -p $(ISOLANG)
348         $(PYTHON) $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) $(TEXI_LANGUTIL_FLAGS) $(TELY_FILES:$(ISOLANG)/%.tely=../%.tely)
349         $(PYTHON) $(auxscript-dir)/texi-skeleton-update.py $(ISOLANG) $(outdir)
350
351 snippet-update:
352         $(PYTHON) $(auxscript-dir)/update-snippets.py user $(ISOLANG) '*.itely'
353
354 DOCUMENTS_INCLUDES:=-I $(ISOLANG) \
355 -I $(top-build-dir)/Documentation/$(ISOLANG)/out-www \
356 -I $(top-src-dir)/Documentation/snippets \
357 -I $(top-build-dir)/Documentation/out-www \
358 -I $(top-build-dir)/Documentation/out
359
360 else # ISOLANG is empty
361
362 DOCUMENTS_INCLUDES:=-I . \
363 -I $(top-build-dir)/Documentation/out-www \
364 -I $(top-src-dir)/Documentation/snippets \
365 -I $(top-build-dir)/Documentation/snippets/out-www \
366 -I $(top-build-dir)/Documentation/out
367
368 endif # ISOLANG
369
370 check-xrefs:
371         $(PYTHON) $(auxscript-dir)/check_texi_refs.py --batch \
372         $(DOCUMENTS_INCLUDES) $(auxpython-dir)/manuals_definitions.py
373
374 fix-xrefs:
375         $(PYTHON) $(auxscript-dir)/check_texi_refs.py --auto-fix \
376         $(DOCUMENTS_INCLUDES) $(auxpython-dir)/manuals_definitions.py
377
378 check-translation:
379         ISOLANG=$(ISOLANG) $(PYTHON) $(auxscript-dir)/check_translation.py $(CHECK_TRANSLATION_FLAGS) $(TRANSLATION_FILES)
380
381 update-translation:
382         ISOLANG=$(ISOLANG) $(PYTHON) $(auxscript-dir)/check_translation.py --update $(CHECK_TRANSLATION_FLAGS) $(TRANSLATION_FILES)
383
384 # what's it gonna be, boy...tranlationS-/translation-
385 translation-status:
386         PYTHONPATH=$(top-src-dir)/python:$(top-src-dir)/python/auxiliar $(PYTHON) $(top-src-dir)/scripts/auxiliar/translations-status.py