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