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