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