]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/GNUmakefile
Docs: reorganize documentation directory structure
[lilypond.git] / Documentation / GNUmakefile
1 depth = ..
2
3 NAME = documentation
4 LANGS = $(shell $(PYTHON) $(top-src-dir)/python/langdefs.py)
5 SUBDIRS = application contributor learning notation snippets\
6   bibliography pictures misc po $(LANGS)
7 STEPMAKE_TEMPLATES = documentation texinfo tex omf
8 LOCALSTEPMAKE_TEMPLATES = lilypond ly
9
10 ### Extra flags
11
12 LILYPOND_BOOK_FLAGS = --extra-options '-e "(ly:set-option (quote internal-type-checking) \#t)"'
13 TEXI2PDF_FLAGS = \
14   -I $(outdir) \
15   -I $(top-build-dir)/Documentation/$(outconfbase)
16 $(outdir)/snippets-big-page.html: TEXI2HTML_FLAGS += -D short_toc
17 $(outdir)/snippets/index..html: TEXI2HTML_FLAGS += -D short_toc
18
19 ### Extra source files
20
21 README_TOP_FILES= DEDICATION THANKS
22 LATEX_FILES =$(call src-wildcard,*.latex)
23 IMAGES=$(call src-wildcard,*.png)
24 EPS_ILLUSTRATIONS=context-example.eps
25
26 IN_ITELY_FILES = $(call src-wildcard,snippets/*-intro.itely)
27 SNIPPET_LY_FILES = $(call src-wildcard,snippets/*.ly)
28
29
30 ### Extra out files
31
32 # Dependencies
33 GENERATED_ITELY_FILES = $(IN_ITELY_FILES:snippets/%-intro.itely=$(outdir)/%.itely)
34
35 OUT_PDF_IMAGES = $(IMAGES:%.png=$(outdir)/%.pdf)
36 OUT_PDF_IMAGES += $(EPS_ILLUSTRATIONS:%.eps=$(outdir)/%.pdf)
37 OUT_PNG_IMAGES = $(OUT_PDF_IMAGES:%.pdf=%.png)
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
44 OUT_MASTER_TEXI_FILES = $(outdir)/internals.texi
45 #OUT_TEXI_FILES=$(ITEXI_FILES:%.itexi=$(outdir)/%.texi)\
46 # $(ITELY_FILES:%.itely=$(outdir)/%.texi)
47
48 HTML_FILES = \
49 $(TELY_FILES:%.tely=$(outdir)/%-big-page.html)\
50  $(TEXI_FILES:%.texi=$(outdir)/%-big-page.html)\
51  $(outdir)/internals-big-page.html
52
53 PDF_FILES = \
54 $(TELY_FILES:%.tely=$(outdir)/%.pdf)\
55  $(TELY_FILES:%.texi=$(outdir)/%.pdf)\
56  $(outdir)/internals.pdf
57
58
59 HTML_PAGE_NAMES= index translations devel
60 OUT_HTML_FILES= $(HTML_PAGE_NAMES:%=$(outdir)/%.html)
61 OUT_CSS_FILES= $(CSS_FILES:%.css=$(outdir)/%.css)
62
63 MAIN_INFO_DOC = lilypond-notation
64 INFO_DOCS = lilypond-application lilypond-changes lilypond-contributor lilypond-internals \
65  lilypond-learning lilypond-notation music-glossary
66 ifeq ($(out),www)
67 INFO_DOCS += lilypond-snippets 
68 endif
69 INFO_FILES = $(INFO_DOCS:%=$(outdir)/%.info)
70
71 ifeq ($(out),www)
72 INFO_IMAGES_DIR = lilypond
73 DEST_INFO_IMAGES_SUBDIR = Documentation/
74 endif
75
76
77 include $(depth)/make/stepmake.make
78
79
80 default: local-doc
81
82 ifeq ($(out),www)
83 local-WWW-2: txt-to-html $(OUT_HTML_FILES)
84
85 local-WWW-clean: deep-WWW-clean
86
87 deep-WWW-clean:
88         rm -rf $(outdir)/wiki-dump
89 endif
90
91 OUT_TXT_FILES = $(addprefix $(outdir)/, $(addsuffix .txt, $(README_TOP_FILES)))
92
93 # cd $(outdir) rule gets bit hairy for --srcdir configure builds
94 txt-to-html:
95         $(foreach a, $(README_TOP_FILES), cp $(top-src-dir)/$(a) $(outdir)/$(a).txt && ) true
96         $(PYTHON) $(step-bindir)/text2html.py $(OUT_TXT_FILES)
97
98 $(OUT_HTML_FILES): $(OUT_CSS_FILES)
99
100 $(outdir)/%.css: %.css
101         ln -f $< $@
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 #####################################
124 # Texinfo 
125
126 info: $(INFO_FILES)
127         @echo export LILYPOND_DATADIR=$(LILYPOND_DATADIR)
128         @echo export PYTHONPATH=$(PYTHONPATH)
129
130 xml: $(outdir)/notation/notation.xml $(outdir)/internals/internals.xml
131
132
133 local-clean:
134         rm -f $(INFO_IMAGES_DIR)
135
136
137 #
138 # Split manuals in HTML
139 #
140 $(outdir)/learning/index.html: $(OUT_PNG_IMAGES) $(OUT_EPS_IMAGES)
141 $(outdir)/notation/index.html: $(OUT_PNG_IMAGES) $(OUT_EPS_IMAGES)
142
143
144 #
145 # Manuals in one big HTML page
146 #
147 $(outdir)/learning-big-page.html: $(OUT_PNG_IMAGES)
148 $(outdir)/notation-big-page.html: $(OUT_PNG_IMAGES)
149
150 # Ugh, using '%' twice not possible
151 $(outdir)/notation/notation.xml: $(outdir)/notation.texi
152         mkdir -p $(dir $@)
153         $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<
154
155 $(outdir)/internals/internals.xml: $(outdir)/internals.texi
156         mkdir -p $(dir $@)
157         $(MAKEINFO) -I$(src-dir) -I$(outdir) --output=$(dir $@) --docbook $<
158
159 $(outdir)/learning.texi $(outdir)/notation.texi: $(OUT_PDF_IMAGES)
160
161 $(foreach manual, application contributor learning notation,\
162 $(eval $(outdir)/(i).texi: $(call src-wildcard,$(i)/*.ite??)))
163
164 $(outdir)/%.png: %.png
165         convert -depth 8 -geometry 50x50% $< $@
166
167 $(outdir)/%.png: %.eps
168         gs -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=$@ -sDEVICE=png16m -dEPSCrop -dNOPAUSE -f $< -c quit
169
170 $(outdir)/%.pdf: %.png
171         convert -depth 8 $< $@
172
173 $(outdir)/%.pdf: %.eps
174         gs -dAutoRotatePages=/None -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -sOutputFile=$@ -dEPSCrop -c .setpdfwrite -f $<
175
176
177 ### Splitted HTML manuals
178
179 DEEP_HTML_FILES =\
180  $(outdir)/application/index.html\
181  $(outdir)/internals/index.html\
182  $(outdir)/learning/index.html\
183  $(outdir)/notation/index.html\
184  $(outdir)/music-glossary/index.html\
185  $(outdir)/snippets/index.html
186
187 # Symlinks to refer to external source documents from split and non-split HTML
188 source-links = $(outdir)/source $(outdir)/notation/source $(outdir)/music-glossary/source \
189  $(outdir)/application/source $(outdir)/learning/source $(outdir)/internals/source \
190  $(outdir)/snippets/source
191
192 $(outdir)/source:
193         @rm -f $(@)
194         ln -sf $(depth) $(@)
195
196 $(outdir)/%/source:
197         @rm -f $(@)
198         mkdir -p $(dir $@)
199         ln -sf $(depth)/.. $(@)
200
201 ################################
202 ### Snippets rules idiosyncrases
203
204 $(outdir)/%.itely: snippets/%-intro.itely snippets/%.snippet-list
205         xargs $(LYS_TO_TELY) -f doctitle,texidoc,verbatim --name=$@ --template=$< < $(filter %.snippet-list, $^)
206
207 $(outdir)/snippets.texi: $(GENERATED_ITELY_FILES) $(SNIPPET_LY_FILES)
208
209 ###############
210 ### Web targets
211
212 ifeq ($(out),www)
213 local-WWW-1: $(MASTER_TEXI_FILES) $(PDF_FILES) info
214
215 local-WWW-2: $(HTML_FILES) $(DEEP_HTML_FILES) $(source-links)
216 endif
217
218 $(outdir)/%.bib: %.bib
219         ln -f $< $@
220
221 # lilypond.texi deps
222 $(top-build-dir)/mf/$(outconfbase)/feta16list.ly:
223         $(MAKE) -C $(top-src-dir)/mf
224
225 $(outdir)/notation.texi: $(outdir)/ly-grammar.txt
226
227 # Rules for the automatically generated documentation
228
229 $(outdir)/ly-grammar.txt: $(top-src-dir)/lily/parser.yy
230         cd $(outdir) && $(BISON) -v $<
231         $(auxscript-dir)/yyout2grammar.py $(outdir)/parser.output $@
232
233 # There used to be a dependency on a dummy target, to force a rebuild
234 # of internals every time.  however, this triggers
235 # compilation during install, which is a bad thing (tm).
236
237 $(outdir)/internals.texi: $(LILYPOND_BINARY)
238         cd $(outdir) && $(LILYPOND_BINARY) --verbose $(top-src-dir)/ly/generate-documentation
239
240 .SECONDARY:
241
242
243 #####################################
244 #  Translations maintenance targets #
245 #####################################
246 po-update:
247         make -C po po-update
248
249 all-translations-update: po-update translation-status
250         $(foreach lang, $(LANGS), make ISOLANG=$(lang) skeleton-update snippet-update &&) true
251
252 ifneq ($(NO_COLOR),)
253 CHECK_TRANSLATION_FLAGS = --no-color
254 endif
255
256 ifneq ($(ISOLANG),)
257 new-lang:
258         @if (( $$(file -b $(ISOLANG)) == directory )) 2>/dev/null; \
259         then echo "Error: $(ISOLANG) directory already exists. Exiting." ; \
260         exit 3 ; \
261         fi
262         mkdir -p $(ISOLANG)/user
263         cp fr/GNUmakefile $(ISOLANG)
264         cp fr/user/GNUmakefile $(ISOLANG)/user
265         sed -i -e 's/ISOLANG *= *fr/ISOLANG = $(ISOLANG)/' $(ISOLANG)/GNUmakefile $(ISOLANG)/user/GNUmakefile
266         $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) -o doc.pot --skeleton --gettext ../learning.tely
267         mv $(outdir)/*.*tely $(ISOLANG)/user
268         msgmerge -U po/lilypond-doc.pot $(outdir)/doc.pot
269         cp po/lilypond-doc.pot po/$(ISOLANG).po
270         @echo "***  Please add a language definition for $(ISOLANG) in python/langdefs.py  ***"
271
272 CHECKED_FILES = $(ISOLANG)/index.html.in $(shell find $(ISOLANG)/user/ -maxdepth 1 -name '*.*te??') \
273   $(shell find $(depth)/input/texidocs/ -name '*.texidoc')
274
275 TELY_FILES = $(call src-wildcard,$(ISOLANG)/user/*.tely)
276 skeleton-update:
277         $(auxscript-dir)/texi-langutils.py -d $(outdir) -l $(ISOLANG) --skeleton $(TELY_FILES:$(ISOLANG)/user/%.tely=../user/%.tely)
278         $(auxscript-dir)/texi-skeleton-update.py $(ISOLANG)/user $(outdir)
279
280 snippet-update:
281         $(auxscript-dir)/update-snippets.py user $(ISOLANG)/user '*.itely'
282
283 DOCUMENTS_INCLUDES:=-I $(ISOLANG)/user \
284 -I $(top-build-dir)/Documentation/$(ISOLANG)/user/out-www \
285 -I $(top-src-dir)/input/lsr \
286 -I $(top-build-dir)/input/lsr/out-www \
287 -I user -I $(top-build-dir)/Documentation/user/out-www
288
289 else # ISOLANG is empty
290
291 DOCUMENTS_INCLUDES:=-I user \
292 -I $(top-build-dir)/Documentation/user/out-www \
293 -I $(top-src-dir)/input/lsr \
294 -I $(top-build-dir)/input/lsr/out-www
295
296 endif # ISOLANG
297
298 check-xrefs:
299         $(auxscript-dir)/check_texi_refs.py --batch \
300         $(DOCUMENTS_INCLUDES) $(auxpython-dir)/manuals_definitions.py
301
302 fix-xrefs:
303         $(auxscript-dir)/check_texi_refs.py --auto-fix \
304         $(DOCUMENTS_INCLUDES) $(auxpython-dir)/manuals_definitions.py
305
306 check-translation:
307         ISOLANG=$(ISOLANG) $(auxscript-dir)/check_translation.py $(CHECK_TRANSLATION_FLAGS) $(CHECKED_FILES)
308
309 update-translation:
310         ISOLANG=$(ISOLANG) $(auxscript-dir)/check_translation.py --update $(CHECK_TRANSLATION_FLAGS) $(CHECKED_FILES)
311
312 translation-status:
313         make -C po out=www messages
314         $(auxscript-dir)/translations-status.py
315
316 .SECONDARY: