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