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