]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/GNUmakefile
Merge branch 'lilypond/translation' of ssh://git.sv.gnu.org/srv/git/lilypond
[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 "  skeleton-update ISOLANG=LL    update Texinfo skeleton files"
149         @echo "  snippet-update ISOLANG=LL     update ly snippets in Texinfo translation"
150         @echo "                                  according to docs in English"
151         @echo "                                  (use with caution)"
152         @echo
153         @echo "  LL refers to the desired locale"
154         @echo "    (most often only the ISO 639 language code)."
155         @echo
156
157 info: $(INFO_FILES)
158         @echo export LILYPOND_DATADIR=$(LILYPOND_DATADIR)
159         @echo export PYTHONPATH=$(PYTHONPATH)
160
161 xml: $(outdir)/notation/notation.xml $(outdir)/internals/internals.xml
162
163
164 local-clean:
165         rm -f $(INFO_IMAGES_DIR)
166
167 ### Web targets
168
169 ifeq ($(out),www)
170 local-WWW-1: $(OUT_TEXINFO_MANUALS) $(PDF_FILES) info
171
172 local-WWW-2: txt-to-html $(OUT_HTML_FILES) $(DEEP_HTML_FILES) $(source-links) $(OMF_FILES)
173 endif
174
175
176 #########
177 ### Rules
178
179 $(outdir)/lilypond-%.info: $(outdir)/%.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir-dep $(outdir)/version.itexi $(outdir)/weblinks.itexi
180         $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$@ $<
181
182 # cd $(outdir) rule gets bit hairy for --srcdir configure builds
183 txt-to-html:
184         $(foreach a, $(README_TOP_FILES), cp $(top-src-dir)/$(a) $(outdir)/$(a).txt && ) true
185         $(PYTHON) $(step-bindir)/text2html.py $(OUT_TXT_FILES)
186
187 ifeq ($(out),www)
188 ## Extra images dependencies
189 $(OUT_TEXINFO_MANUALS): $(outdir)/pictures
190
191 $(outdir)/pictures:
192         $(MAKE) -C pictures WWW-1
193         ln -sf ../pictures/$(outdir) $@
194
195 $(outdir)/web.texi: $(outdir)/ly-examples
196
197 $(outdir)/ly-examples:
198         $(MAKE) -C web/ly-examples
199         ln -sf ../web/ly-examples/$(outdir) $@
200 endif
201
202 # Ugh, using '%' twice not possible
203 $(outdir)/notation/notation.xml: $(outdir)/notation.texi
204         mkdir -p $(dir $@)
205         $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<
206
207 $(outdir)/internals/internals.xml: $(outdir)/internals.texi
208         mkdir -p $(dir $@)
209         $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<
210
211 $(outdir)/learning.texi $(outdir)/notation.texi: $(OUT_PDF_IMAGES)
212
213 $(foreach manual, $(MANUAL_SUBDIRS),\
214 $(eval $(outdir)/(manual).texi: $(call src-wildcard,$(manual)/*.ite??)))
215
216
217
218 $(outdir)/source:
219         @rm -f $(@)
220         ln -sf $(depth) $(@)
221
222 $(outdir)/%/source:
223         @rm -f $(@)
224         mkdir -p $(dir $@)
225         ln -sf $(depth)/.. $(@)
226
227
228 ## Snippets rules idiosyncrases
229 $(outdir)/%.itely: snippets/%-intro.itely snippets/%.snippet-list
230         xargs $(LYS_TO_TELY) -f doctitle,texidoc,verbatim --name=$@ --template=$< < $(filter %.snippet-list, $^)
231
232 $(outdir)/snippets.texi: $(GENERATED_ITELY_FILES) $(SNIPPET_LY_FILES)
233
234 $(outdir)/%.bib: %.bib
235         ln -f $< $@
236
237 ## notation.texi deps
238 $(top-build-dir)/mf/$(outconfbase)/feta16list.ly:
239         $(MAKE) -C $(top-src-dir)/mf
240
241 $(outdir)/notation.texi: $(outdir)/ly-grammar.txt
242
243 ## Rules for the automatically generated documentation
244 $(outdir)/ly-grammar.txt: $(top-src-dir)/lily/parser.yy
245         cd $(outdir) && $(BISON) -v $<
246         $(buildscript-dir)/yyout2grammar $(outdir)/parser.output $@
247
248 # There used to be a dependency on a dummy target, to force a rebuild
249 # of internals every time.  however, this triggers
250 # compilation during install, which is a bad thing (tm).
251
252 $(outdir)/internals.texi: $(LILYPOND_BINARY)
253         cd $(outdir) && $(LILYPOND_BINARY) --verbose $(top-src-dir)/ly/generate-documentation
254
255
256 ###############################################
257 #  Documentation and translations maintenance #
258 ###############################################
259 po-update:
260         make -C po po-update
261
262 all-translations-update: po-update translation-status
263         $(foreach lang, $(LANGS), make ISOLANG=$(lang) skeleton-update snippet-update &&) true
264
265 ifneq ($(NO_COLOR),)
266 CHECK_TRANSLATION_FLAGS = --no-color
267 endif
268
269 ifneq ($(ISOLANG),)
270 new-lang-dir:
271         mkdir -p $(ISOLANG)/$(DIR)
272         cp fr/GNUmakefile $(ISOLANG)
273         cp fr/$(DIR)/GNUmakefile $(ISOLANG)/$(DIR)
274         sed -i -e 's/ISOLANG *= *fr/ISOLANG = $(ISOLANG)/' $(ISOLANG)/GNUmakefile $(ISOLANG)/$(DIR)/GNUmakefile
275         rm -f $(outdir)/*.*tely $(outdir)/*.*texi
276         $(PYTHON) $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) -o doc.pot --skeleton --gettext $$(cd $(ISOLANG) && ls -1 ../$(DIR).tely ../$(DIR).texi)
277         for i in $$(cd $(outdir) && ls -1 $(DIR).tely $(DIR).texi); do\
278             test -e $(ISOLANG)/$$i || mv $(outdir)/$$i $(ISOLANG)/$$i;\
279         done
280         rm -f $(outdir)/$(DIR).tely $(outdir)/$(DIR).texi
281         for i in $$(cd $(outdir) && ls -1 *.*tely *.*texi); do\
282             test -e $(ISOLANG)/$(DIR)/$$i\
283                 || test -e $(ISOLANG)/$$i\
284                 || mv $(outdir)/$$i $(ISOLANG)/$(DIR)/$$i;\
285         done
286
287 new-lang:
288 # Also for updating/adding missing files
289         mkdir -p $(ISOLANG)
290         $(foreach i,$(TRANSLATION_DIRS),$(MAKE) new-lang-dir DIR=$(i) &&) :
291         msgmerge -U po/lilypond-doc.pot $(outdir)/doc.pot
292         test -e po/$(ISOLANG).po || cp po/lilypond-doc.pot po/$(ISOLANG).po
293         @echo "***  Please add a language definition for $(ISOLANG) in python/langdefs.py  ***"
294
295 TRANSLATION_DIRS = web texidocs
296 TRANSLATION_FILES = $(shell git ls-files $(ISOLANG) | grep -v GNUmakefile)
297 TEXI_LANGUTIL_FLAGS += --skeleton
298
299 TELY_FILES = $(call src-wildcard,$(ISOLANG)/*.tely)
300 skeleton-update:
301         mkdir -p $(ISOLANG)
302         $(PYTHON) $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) $(TEXI_LANGUTIL_FLAGS) $(TELY_FILES:$(ISOLANG)/%.tely=../%.tely)
303         $(PYTHON) $(auxscript-dir)/texi-skeleton-update.py $(ISOLANG) $(outdir)
304
305 snippet-update:
306         $(PYTHON) $(auxscript-dir)/update-snippets.py user $(ISOLANG) '*.itely'
307
308 DOCUMENTS_INCLUDES:=-I $(ISOLANG) \
309 -I $(top-build-dir)/Documentation/$(ISOLANG)/out-www \
310 -I $(top-src-dir)/Documentation/snippets \
311 -I $(top-build-dir)/Documentation/out-www \
312 -I $(top-build-dir)/Documentation/out
313
314 else # ISOLANG is empty
315
316 DOCUMENTS_INCLUDES:=-I . \
317 -I $(top-build-dir)/Documentation/out-www \
318 -I $(top-src-dir)/Documentation/snippets \
319 -I $(top-build-dir)/Documentation/snippets/out-www \
320 -I $(top-build-dir)/Documentation/out
321
322 endif # ISOLANG
323
324 check-xrefs:
325         $(PYTHON) $(auxscript-dir)/check_texi_refs.py --batch \
326         $(DOCUMENTS_INCLUDES) $(auxpython-dir)/manuals_definitions.py
327
328 fix-xrefs:
329         $(PYTHON) $(auxscript-dir)/check_texi_refs.py --auto-fix \
330         $(DOCUMENTS_INCLUDES) $(auxpython-dir)/manuals_definitions.py
331
332 check-translation:
333         ISOLANG=$(ISOLANG) $(PYTHON) $(auxscript-dir)/check_translation.py $(CHECK_TRANSLATION_FLAGS) $(TRANSLATION_FILES)
334
335 update-translation:
336         ISOLANG=$(ISOLANG) $(PYTHON) $(auxscript-dir)/check_translation.py --update $(CHECK_TRANSLATION_FLAGS) $(TRANSLATION_FILES)
337
338 translation-status:
339         @echo Target temporarily disabled
340
341 .SECONDARY: