]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/GNUmakefile
Merge branch 'lilypond/translation' of ssh://jomand@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 = application contributor essay general learning notation
13 SUBDIRS = $(MANUALS_SUBDIRS) snippets bibliography logo pictures misc po $(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 LATEX_FILES =$(call src-wildcard,*.latex)
30
31 IN_ITELY_FILES = $(call src-wildcard,snippets/*-intro.itely)
32 SNIPPET_LY_FILES = $(call src-wildcard,snippets/*.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 = $(subst $(outdir)/general.pdf,,$(TEXINFO_MANUALS:%=$(outdir)/%.pdf))
55
56 UNSPLITTED_HTML_MANUALS = changes
57 SPLITTED_HTML_MANUALS = $(foreach manual, $(TEXINFO_MANUALS),\
58  $(if $(findstring $(manual), $(UNSPLITTED_HTML_MANUALS)),,$(manual)))
59
60 OUT_HTML_FILES = $(UNSPLITTED_HTML_MANUALS:%=$(outdir)/%.html)\
61  $(SPLITTED_HTML_MANUALS:%=$(outdir)/%-big-page.html)
62 DEEP_HTML_FILES = $(SPLITTED_HTML_MANUALS:%=$(outdir)/%/index.html)
63
64 # Symlinks to refer to external source documents from split and non-split HTML
65 source-links = $(outdir)/source\
66  $(foreach manual, $(SPLITTED_HTML_MANUALS), $(outdir)/$(manual)/source)
67
68 # Other out files
69
70 HTML_PAGE_NAMES= index translations devel
71 OUT_HTML_FILES += $(HTML_PAGE_NAMES:%=$(outdir)/%.html)
72
73 MAIN_INFO_DOC = lilypond-notation
74 INFO_DOCS = lilypond-application lilypond-changes lilypond-contributor lilypond-internals \
75  lilypond-essay lilypond-learning lilypond-notation music-glossary lilypond
76 ifeq ($(out),www)
77 INFO_DOCS += lilypond-snippets 
78 endif
79 INFO_FILES = $(INFO_DOCS:%=$(outdir)/%.info)
80
81 ifeq ($(out),www)
82 INFO_IMAGES_DIR = lilypond
83 DEST_INFO_IMAGES_SUBDIR = Documentation/
84 endif
85
86 include $(depth)/make/stepmake.make
87
88 OUT_TXT_FILES = $(addprefix $(outdir)/, $(addsuffix .txt, $(README_TOP_FILES)))
89
90 ### Web site idiosyncrases
91 ## No big page
92 OUT_HTML_FILES := $(subst $(outdir)/general-big-page.html,,$(OUT_HTML_FILES))
93
94 ## Different init file and CSS
95 $(outdir)/general/index.html: \
96  TEXI2HTML_INIT = --init-file=$(top-src-dir)/Documentation/web-texi2html.init
97
98 ###########
99 ### Targets
100
101 default: local-txt-doc
102
103 local-help: extra-local-help
104
105 extra-local-help:
106         @echo -e "\
107   check-xrefs [ISOLANG=LL] validate Texinfo cross-references\n\
108   fix-xrefs [ISOLANG=LL]   interactively fix Texinfo cross-references (use with caution)\n\
109   info        update info pages\n\
110   xml         update Docbook xml documentation\n\
111 \n\
112 Translations specific targets (see TRANSLATION for details):\n\
113   new-lang ISOLANG=LL  create and initialize subdirectory \'LL' for language \'LL\n\
114   po-update            update and replace PO files for documentation with msgmerged versions\n\
115   check-translation ISOLANG=LL   show changes in English docs since last translation update\n\
116   update-translation ISOLANG=LL  call $$$$EDITOR to help updating the translation\n\
117   skeleton-update ISOLANG=LL     update Texinfo skeleton files\n\
118   snippet-update ISOLANG=LL      update ly snippets in Texinfo translation according to\n\
119                               docs in English (use with caution)\n\
120 \n\
121 LL refers to the desired locale (most often only the ISO 639 language code).\n"
122
123 info: $(INFO_FILES)
124         @echo export LILYPOND_DATADIR=$(LILYPOND_DATADIR)
125         @echo export PYTHONPATH=$(PYTHONPATH)
126
127 xml: $(outdir)/notation/notation.xml $(outdir)/internals/internals.xml
128
129
130 local-clean:
131         rm -f $(INFO_IMAGES_DIR)
132
133 ### Web targets
134
135 ifeq ($(out),www)
136 local-WWW-1: $(OUT_TEXINFO_MANUALS) $(PDF_FILES) info
137
138 local-WWW-2: txt-to-html $(OUT_HTML_FILES) $(DEEP_HTML_FILES) $(source-links) $(OMF_FILES)
139 endif
140
141
142 #########
143 ### Rules
144
145 # cd $(outdir) rule gets bit hairy for --srcdir configure builds
146 txt-to-html:
147         $(foreach a, $(README_TOP_FILES), cp $(top-src-dir)/$(a) $(outdir)/$(a).txt && ) true
148         $(PYTHON) $(step-bindir)/text2html.py $(OUT_TXT_FILES)
149
150 ifeq ($(out),www)
151 ## Extra images dependencies
152 $(OUT_TEXINFO_MANUALS): $(outdir)/pictures
153
154 $(outdir)/pictures:
155         $(MAKE) -C pictures WWW-1
156         ln -sf ../pictures/$(outdir) $@
157 endif
158
159 # Ugh, using '%' twice not possible
160 $(outdir)/notation/notation.xml: $(outdir)/notation.texi
161         mkdir -p $(dir $@)
162         $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<
163
164 $(outdir)/internals/internals.xml: $(outdir)/internals.texi
165         mkdir -p $(dir $@)
166         $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<
167
168 $(outdir)/learning.texi $(outdir)/notation.texi: $(OUT_PDF_IMAGES)
169
170 $(foreach manual, $(MANUAL_SUBDIRS),\
171 $(eval $(outdir)/(manual).texi: $(call src-wildcard,$(manual)/*.ite??)))
172
173
174
175 $(outdir)/source:
176         @rm -f $(@)
177         ln -sf $(depth) $(@)
178
179 $(outdir)/%/source:
180         @rm -f $(@)
181         mkdir -p $(dir $@)
182         ln -sf $(depth)/.. $(@)
183
184
185 ## Snippets rules idiosyncrases
186 $(outdir)/%.itely: snippets/%-intro.itely snippets/%.snippet-list
187         xargs $(LYS_TO_TELY) -f doctitle,texidoc,verbatim --name=$@ --template=$< < $(filter %.snippet-list, $^)
188
189 $(outdir)/snippets.texi: $(GENERATED_ITELY_FILES) $(SNIPPET_LY_FILES)
190
191 $(outdir)/%.bib: %.bib
192         ln -f $< $@
193
194 ## notation.texi deps
195 $(top-build-dir)/mf/$(outconfbase)/feta16list.ly:
196         $(MAKE) -C $(top-src-dir)/mf
197
198 $(outdir)/notation.texi: $(outdir)/ly-grammar.txt
199
200 ## Rules for the automatically generated documentation
201 $(outdir)/ly-grammar.txt: $(top-src-dir)/lily/parser.yy
202         cd $(outdir) && $(BISON) -v $<
203         $(auxscript-dir)/yyout2grammar.py $(outdir)/parser.output $@
204
205 # There used to be a dependency on a dummy target, to force a rebuild
206 # of internals every time.  however, this triggers
207 # compilation during install, which is a bad thing (tm).
208
209 $(outdir)/internals.texi: $(LILYPOND_BINARY)
210         cd $(outdir) && $(LILYPOND_BINARY) --verbose $(top-src-dir)/ly/generate-documentation
211
212
213 ###############################################
214 #  Documentation and translations maintenance #
215 ###############################################
216 po-update:
217         make -C po po-update
218
219 all-translations-update: po-update translation-status
220         $(foreach lang, $(LANGS), make ISOLANG=$(lang) skeleton-update snippet-update &&) true
221
222 ifneq ($(NO_COLOR),)
223 CHECK_TRANSLATION_FLAGS = --no-color
224 endif
225
226 ifneq ($(ISOLANG),)
227 new-lang:
228         @if (( $$(file -b $(ISOLANG)) == directory )) 2>/dev/null; \
229         then echo "Error: $(ISOLANG) directory already exists. Exiting." ; \
230         exit 3 ; \
231         fi
232         mkdir -p $(ISOLANG)/learning
233         cp fr/GNUmakefile $(ISOLANG)
234         cp fr/learning/GNUmakefile $(ISOLANG)/learning
235         sed -i -e 's/ISOLANG *= *fr/ISOLANG = $(ISOLANG)/' $(ISOLANG)/GNUmakefile $(ISOLANG)/learning/GNUmakefile
236         $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) -o doc.pot --skeleton --gettext ../learning.tely
237         mv $(outdir)/*.*tely $(ISOLANG)/learning
238         msgmerge -U po/lilypond-doc.pot $(outdir)/doc.pot
239         cp po/lilypond-doc.pot po/$(ISOLANG).po
240         @echo "***  Please add a language definition for $(ISOLANG) in python/langdefs.py  ***"
241
242 CHECKED_FILES = $(ISOLANG)/index.html.in $(foreach i,learning notation application, \
243   $(shell find $(ISOLANG)/$(manual) -name '*.*te??' -not -wholename '*out-www*')) \
244   $(shell find $(ISOLANG)/texidocs/ -name '*.texidoc')
245
246 TELY_FILES = $(call src-wildcard,$(ISOLANG)/*.tely)
247 skeleton-update:
248         $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) --skeleton $(TELY_FILES:$(ISOLANG)/%.tely=../%.tely)
249         $(auxscript-dir)/texi-skeleton-update.py $(ISOLANG) $(outdir)
250
251 snippet-update:
252         $(auxscript-dir)/update-snippets.py user $(ISOLANG) '*.itely'
253
254 DOCUMENTS_INCLUDES:=-I $(ISOLANG) \
255 -I $(top-build-dir)/Documentation/$(ISOLANG)/out-www \
256 -I $(top-src-dir)/Documentation/snippets \
257 -I $(top-build-dir)/Documentation/out-www
258
259 else # ISOLANG is empty
260
261 DOCUMENTS_INCLUDES:=-I . \
262 -I $(top-build-dir)/Documentation/out-www \
263 -I $(top-src-dir)/Documentation/snippets \
264 -I $(top-build-dir)/Documentation/snippets/out-www
265
266 endif # ISOLANG
267
268 check-xrefs:
269         $(auxscript-dir)/check_texi_refs.py --batch \
270         $(DOCUMENTS_INCLUDES) $(auxpython-dir)/manuals_definitions.py
271
272 fix-xrefs:
273         $(auxscript-dir)/check_texi_refs.py --auto-fix \
274         $(DOCUMENTS_INCLUDES) $(auxpython-dir)/manuals_definitions.py
275
276 check-translation:
277         ISOLANG=$(ISOLANG) $(auxscript-dir)/check_translation.py $(CHECK_TRANSLATION_FLAGS) $(CHECKED_FILES)
278
279 update-translation:
280         ISOLANG=$(ISOLANG) $(auxscript-dir)/check_translation.py --update $(CHECK_TRANSLATION_FLAGS) $(CHECKED_FILES)
281
282 translation-status:
283         make -C po out=www messages
284         $(auxscript-dir)/translations-status.py
285
286 .SECONDARY: