1 ################################################################
2 # website (without the rest of the docs)
4 ################################################################
5 ##### SECURITY -- check these values for lilypond.org #########
6 ################################################################
8 ifeq ($(WEBSITE_ONLY_BUILD),1)
10 TOP_SRC_DIR=$(LILYPOND_GIT)
11 TRUSTED_DIR=$(HOME)/lilypond/trusted-scripts
12 top-src-dir=$(TOP_SRC_DIR)
14 trusted-dir=$(TRUSTED_DIR)
15 script-dir=$(trusted-dir)
16 texi2html-init-file=$(trusted-dir)/lilypond-texi2html.init
17 top-htaccess=$(trusted-dir)/lilypond.org.htaccess
18 dir-htaccess=$(trusted-dir)/website-dir.htaccess
20 TEXI2HTML_PROGRAM=texi2html
22 PYTHONPATH=$(TRUSTED_DIR)
25 script-dir=$(top-src-dir)/scripts/build
26 texi2html-init-file=$(top-src-dir)/Documentation/lilypond-texi2html.init
27 top-htaccess=$(top-src-dir)/Documentation/web/server/lilypond.org.htaccess
28 dir-htaccess=$(top-src-dir)/Documentation/web/server/website-dir.htaccess
29 include $(config_make)
32 include $(top-src-dir)/VERSION
34 ################################################################
35 #The 4 lines below present an option to force make website to run
36 # quietly only when it is run as make -s website. However, we've
37 # decided not to use this switch, and run the scripts quietly all
39 ################################################################
40 #quiet-run = $(findstring s, $(MAKEFLAGS))
41 #ifeq ($(quiet-run),s)
45 #Nothing clever here - just allows the use of a boolean to control
48 ifeq ($(quiet-run),true)
52 ################################################################
55 WEB_LANGS := $(shell MAKEWEB=1 $(PYTHON) $(top-src-dir)/python/langdefs.py)
57 TEXI2HTML=ONLY_WEB_VERSION=v$(MAJOR_VERSION).$(MINOR_VERSION) TOP_SRC_DIR=$(top-src-dir) DEPTH=$(depth) PERL_UNICODE=SD \
58 $(TEXI2HTML_PROGRAM) -D web_version --prefix=index --split=section \
59 --init-file=$(texi2html-init-file) \
61 --I=$(top-src-dir)/Documentation \
65 EXTRACT_TEXI_FILENAMES=$(PYTHON) $(script-dir)/extract_texi_filenames.py $(quiet-flag) \
66 --known-missing-files=$(top-src-dir)/scripts/build/website-known-missing-files.txt \
67 -I $(top-src-dir)/Documentation \
71 CREATE_VERSION=$(PYTHON) $(script-dir)/create-version-itexi.py
72 CREATE_WEBLINKS=$(PYTHON) $(script-dir)/create-weblinks-itexi.py
73 MASS_LINK=$(PYTHON) $(script-dir)/mass-link.py
74 WEB_POST=$(PYTHON) $(script-dir)/website_post.py
75 WEB_BIBS=$(PYTHON) $(script-dir)/bib2texi.py
77 EXAMPLES=$(LILYPOND_WEB_MEDIA_GIT)/ly-examples
78 PICTURES=$(LILYPOND_WEB_MEDIA_GIT)/pictures
79 PDFS=$(LILYPOND_WEB_MEDIA_GIT)/pdf
81 SERVER_FILES=$(top-src-dir)/Documentation/web/server
84 MANUALS = $(MANUALS_TELY) $(MANUALS_TEXI) $(MANUALS_TRANSLATION)
85 MANUALS_TELY := $(notdir $(wildcard $(top-src-dir)/Documentation/*.tely))
86 MANUALS_TEXI := contributor.texi
88 # Harvest the translated manuals.
89 # - Store each manual in a language-specific macro, e.g. when we find
90 # de/learning.tely we add learning.tely to MANUALS_de,
91 # - Store each manual with an added language suffix in MANUALS_TRANSLATION,
92 # e.g. learning.de.tely for the German learning manual.
93 $(eval $(foreach l,$(WEB_LANGS),\
94 $(eval MANUALS_$(l) := $(notdir $(wildcard $(top-src-dir)/Documentation/$(l)/*.tely))) \
95 $(eval MANUALS_TRANSLATION += $(MANUALS_$(l):%.tely=%.$(l).tely)) \
98 # The web.texi manuals, English and translated
99 MANUALS_WEB := web.texi $(WEB_LANGS:%=web.%.texi)
101 # The basename of all manuals (basename includes the language suffix)
102 MANUALS_BASE = $(basename $(MANUALS) $(MANUALS_WEB))
105 #######################
106 ### Dependency tracking
108 # Find the file $(1) within the texinfo include dirs and return its path.
109 # If not found, i.e. it is a generated file, then the file is ignored.
112 $(wildcard $(dir $<)$(1)) \
113 $(wildcard $(top-src-dir)/Documentation/$(1)) \
116 # Recursively scan the file $(1) for @include, search for included files
117 # within the texinfo include dirs, and return all dependencies.
119 $(foreach f, $(shell echo | sed -ne "/^@include[[:space:]]/s/@include//p" $(1)), \
120 $(call find-texi,$(f)) \
121 $(call scan-texi,$(call find-texi,$(f))) \
124 # Find dependencies for the target $@, based on the texinfo source file $<,
125 # and write the dependencies to a .dep file.
126 DO_TEXI_DEP = ( mkdir -p $(dir $@) && echo ./$@: $(call scan-texi,$<) > $@.dep ) &&
128 # This is where we import the .dep files so that `make' knows about
129 # the various dependencies.
130 -include dummy.dep $(wildcard $(OUT)/*.dep) $(wildcard $(OUT)/*/*.dep)
136 bib-files = $(OUT)/others-did.itexi $(OUT)/we-wrote.itexi
138 css-src-files := $(notdir $(wildcard $(top-src-dir)/Documentation/css/*.css))
139 css-files = $(css-src-files:%=$(OUT)/website/css/%)
141 example-src-files := $(notdir $(wildcard $(EXAMPLES)/*))
142 example-files = $(example-src-files:%=$(OUT)/website/ly-examples/%)
144 misc-src-files := $(notdir $(wildcard $(top-src-dir)/Documentation/misc/*.*))
145 misc-files += $(misc-src-files:%=$(OUT)/website/misc/%)
147 picture-src-files := $(notdir $(wildcard $(PICTURES)/*))
148 picture-files = $(picture-src-files:%=$(OUT)/website/pictures/%)
150 pdf-src-files := $(notdir $(wildcard $(PDFS)/*))
151 pdf-files = $(pdf-src-files:%=$(OUT)/website/pdf/%)
153 post-files = $(OUT)/website/index.html
155 root-files = $(OUT)/.htaccess \
156 $(OUT)/website/.htaccess \
157 $(OUT)/website/favicon.ico \
158 $(OUT)/website/tweets.xml \
159 $(OUT)/website/robots.txt
161 texinfo-files = $(OUT)/index.html $(WEB_LANGS:%=$(OUT)/%/index.html)
163 version-files = $(OUT)/version.itexi $(OUT)/weblinks.itexi
165 xref-files = $(MANUALS_BASE:%=$(OUT)/%.xref-map)
171 .PHONY: website website-bibs website-css website-examples website-misc \
172 website-pictures website-post website-test website-texinfo \
173 website-version website-xrefs check-setup website-pdf
176 ifeq ($(LILYPOND_WEB_MEDIA_GIT),)
177 echo "Need a LILYPOND_WEB_MEDIA_GIT environment variable!"
181 website: check-setup website-post website-examples website-pictures website-css website-misc website-pdf
183 website-bibs: website-version $(OUT) $(bib-files)
185 website-css: $(OUT)/website/css $(css-files)
187 website-examples: $(OUT)/website/ly-examples $(example-files)
189 website-misc: $(OUT)/website $(OUT)/website/misc $(misc-files) $(root-files)
191 website-pictures: $(OUT)/website/pictures $(OUT)/pictures $(picture-files)
193 website-pdf: $(OUT)/website/pdf $(pdf-files)
195 website-post: website-texinfo $(post-files)
200 website-texinfo: website-version website-xrefs website-bibs $(texinfo-files)
202 website-version: $(OUT) $(version-files)
204 website-xrefs: website-version $(OUT) $(xref-files)
211 $(OUT) $(OUT)/website $(OUT)/website/css $(OUT)/website/ly-examples $(OUT)/website/misc $(OUT)/website/pdf $(OUT)/website/pictures: %:
214 $(OUT)/pictures: $(OUT)/website/pictures
215 ln -sf website/pictures $(OUT)/pictures
217 # Generated itexi files
218 $(OUT)/version.itexi: $(top-src-dir)/VERSION
219 $(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi
221 $(OUT)/weblinks.itexi: $(top-src-dir)/VERSION
222 $(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi
224 $(bib-files): $(OUT)/%.itexi: $(top-src-dir)/Documentation/web/%.bib
225 BSTINPUTS=$(top-src-dir)/Documentation/web \
227 -s $(top-src-dir)/Documentation/lily-bib \
232 # Get xrefs for English tely manuals
233 $(MANUALS_TELY:%.tely=$(OUT)/%.xref-map): $(OUT)/%.xref-map: $(top-src-dir)/Documentation/%.tely
234 $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) $<
236 # Get xrefs for English texi manuals
237 $(MANUALS_TEXI:%.texi=$(OUT)/%.xref-map): $(OUT)/%.xref-map: $(top-src-dir)/Documentation/%.texi
238 $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) $<
240 # Get xrefs for translated tely manuals
241 $(eval $(foreach l,$(WEB_LANGS),\
242 $(eval $(MANUALS_$(l):%.tely=$(OUT)/%.$(l).xref-map): $(OUT)/%.$(l).xref-map: $(top-src-dir)/Documentation/$(l)/%.tely; \
243 $$(DO_TEXI_DEP) $$(EXTRACT_TEXI_FILENAMES) $$< ) \
246 # Get xrefs for the English web.texi manual
247 $(OUT)/web.xref-map: $(top-src-dir)/Documentation/web.texi
248 $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) --split=node $<
250 # Get xrefs for translated web.texi manuals
251 $(OUT)/web.%.xref-map: $(top-src-dir)/Documentation/%/web.texi
252 $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) --split=node $<
254 # Build the English website
255 $(OUT)/index.html: $(top-src-dir)/Documentation/web.texi $(version-files) $(xref-files)
256 $(DO_TEXI_DEP) $(TEXI2HTML) $<
258 # Build translated websites
259 $(eval $(foreach l,$(WEB_LANGS),\
260 $(eval $(OUT)/$(l)/index.html: $(top-src-dir)/Documentation/$(l)/web.texi $(version-files) $(xref-files); \
261 $$(DO_TEXI_DEP) $$(TEXI2HTML) --lang="$(l)" $$<; ) \
264 # Website post-processing
265 $(OUT)/website/index.html: $(wildcard $(OUT)/*.html)
266 ls $(OUT)/*.html | sed 's!$(OUT)/!!g' | xargs $(MASS_LINK) --prepend-suffix="" hard $(OUT)/ $(OUT)/website/
267 $(foreach l,$(WEB_LANGS), \
268 ls $(OUT)/$(l)/*.html | xargs grep -L 'UNTRANSLATED NODE: IGNORE ME' | sed 's!$(OUT)/$(l)/!!g' | xargs $(MASS_LINK) --prepend-suffix=".$(l)" hard $(OUT)/$(l)/ $(OUT)/website/; )
269 $(WEB_POST) $(OUT)/website
272 $(css-files): $(OUT)/website/css/%: $(top-src-dir)/Documentation/css/%
275 $(example-files): $(OUT)/website/ly-examples/%: $(EXAMPLES)/%
278 $(misc-files): $(OUT)/website/misc/%: $(top-src-dir)/Documentation/misc/%
281 $(picture-files): $(OUT)/website/pictures/%: $(PICTURES)/%
284 $(pdf-files): $(OUT)/website/pdf/%: $(PDFS)/%
287 $(OUT)/website/favicon.ico: $(SERVER_FILES)/favicon.ico
290 $(OUT)/website/robots.txt: $(SERVER_FILES)/robots.txt
293 $(OUT)/website/tweets.xml: $(SERVER_FILES)/tweets.xml
296 $(OUT)/.htaccess: $(top-htaccess)
299 $(OUT)/website/.htaccess: $(dir-htaccess)