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=$(HOME)/lilypond/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
19 TEXI2HTML_PROGRAM=$(HOME)/usr/bin/texi2html
21 PYTHONPATH=$(TRUSTED_DIR)
24 script-dir=$(top-src-dir)/scripts/build
25 texi2html-init-file=$(top-src-dir)/Documentation/lilypond-texi2html.init
26 top-htaccess=$(top-src-dir)/Documentation/web/server/lilypond.org.htaccess
27 dir-htaccess=$(top-src-dir)/Documentation/web/server/website-dir.htaccess
28 include $(config_make)
31 ################################################################
32 #The 4 lines below present an option to force make website to run
33 # quietly only when it is run as make -s website. However, we've
34 # decided not to use this switch, and run the scripts quietly all
36 ################################################################
37 #quiet-run = $(findstring s, $(MAKEFLAGS))
38 #ifeq ($(quiet-run),s)
42 #Nothing clever here - just allows the use of a boolean to control
45 ifeq ($(quiet-run),true)
49 ################################################################
52 WEB_LANGS := $(shell MAKEWEB=1 $(PYTHON) $(top-src-dir)/python/langdefs.py)
54 TEXI2HTML=ONLY_WEB=1 TOP_SRC_DIR=$(top-src-dir) DEPTH=$(depth) PERL_UNICODE=SD \
55 $(TEXI2HTML_PROGRAM) -D web_version --prefix=index --split=section \
56 --init-file=$(texi2html-init-file) \
58 --I=$(top-src-dir)/Documentation \
62 EXTRACT_TEXI_FILENAMES=$(PYTHON) $(script-dir)/extract_texi_filenames.py $(quiet-flag) \
63 --known-missing-files=$(top-src-dir)/scripts/build/website-known-missing-files.txt \
64 -I $(top-src-dir)/Documentation \
68 CREATE_VERSION=python $(script-dir)/create-version-itexi.py
69 CREATE_WEBLINKS=python $(script-dir)/create-weblinks-itexi.py
70 MASS_LINK=python $(script-dir)/mass-link.py
71 WEB_POST=python $(script-dir)/website_post.py
72 WEB_BIBS=python $(script-dir)/bib2texi.py
74 EXAMPLES=$(LILYPOND_WEB_MEDIA_GIT)/ly-examples
75 PICTURES=$(LILYPOND_WEB_MEDIA_GIT)/pictures
77 SERVER_FILES=$(top-src-dir)/Documentation/web/server
80 MANUALS = $(MANUALS_TELY) $(MANUALS_TEXI) $(MANUALS_TRANSLATION)
81 MANUALS_TELY := $(notdir $(wildcard $(top-src-dir)/Documentation/*.tely))
82 MANUALS_TEXI := contributor.texi
84 # Harvest the translated manuals.
85 # - Store each manual in a language-specific macro, e.g. when we find
86 # de/learning.tely we add learning.tely to MANUALS_de,
87 # - Store each manual with an added language suffix in MANUALS_TRANSLATION,
88 # e.g. learning.de.tely for the German learning manual.
89 $(eval $(foreach l,$(WEB_LANGS),\
90 $(eval MANUALS_$(l) := $(notdir $(wildcard $(top-src-dir)/Documentation/$(l)/*.tely))) \
91 $(eval MANUALS_TRANSLATION += $(MANUALS_$(l):%.tely=%.$(l).tely)) \
94 # The web.texi manuals, English and translated
95 MANUALS_WEB := web.texi $(WEB_LANGS:%=web.%.texi)
97 # The basename of all manuals (basename includes the language suffix)
98 MANUALS_BASE = $(basename $(MANUALS) $(MANUALS_WEB))
104 bib-files = $(OUT)/others-did.itexi $(OUT)/we-wrote.itexi
106 css-src-files := $(notdir $(wildcard $(top-src-dir)/Documentation/css/*.css))
107 css-files = $(css-src-files:%=$(OUT)/website/css/%)
109 example-src-files := $(notdir $(wildcard $(EXAMPLES)/*))
110 example-files = $(example-src-files:%=$(OUT)/website/ly-examples/%)
112 misc-files = $(OUT)/.htaccess \
113 $(OUT)/website/.htaccess \
114 $(OUT)/website/favicon.ico \
115 $(OUT)/website/robots.txt
117 picture-src-files := $(notdir $(wildcard $(PICTURES)/*))
118 picture-files = $(picture-src-files:%=$(OUT)/website/pictures/%)
120 post-files = $(OUT)/website/index.html
122 texinfo-files = $(OUT)/index.html $(WEB_LANGS:%=$(OUT)/%/index.html)
124 version-files = $(OUT)/version.itexi $(OUT)/weblinks.itexi
126 xref-files = $(MANUALS_BASE:%=$(OUT)/%.xref-map)
132 .PHONY: website website-bibs website-css website-examples website-misc \
133 website-pictures website-post website-test website-texinfo \
134 website-version website-xrefs check-setup
137 ifeq ($(LILYPOND_WEB_MEDIA_GIT),)
138 echo "Need a $LILYPOND_WEB_MEDIA_GIT environment variable!"
142 website: check-setup website-post website-examples website-pictures website-css website-misc
144 website-bibs: website-version $(OUT) $(bib-files)
146 website-css: $(OUT)/website/css $(css-files)
148 website-examples: $(OUT)/website/ly-examples $(example-files)
150 website-misc: $(OUT)/website $(misc-files)
152 website-pictures: $(OUT)/website/pictures $(OUT)/pictures $(picture-files)
154 website-post: website-texinfo $(post-files)
159 website-texinfo: website-version website-xrefs website-bibs $(texinfo-files)
161 website-version: $(OUT) $(version-files)
163 website-xrefs: website-version $(OUT) $(xref-files)
170 $(OUT) $(OUT)/website $(OUT)/website/css $(OUT)/website/ly-examples $(OUT)/website/pictures: %:
173 $(OUT)/pictures: $(OUT)/website/pictures
174 ln -sf website/pictures $(OUT)/pictures
176 # Generated itexi files
177 $(OUT)/version.itexi: #FIXME: add dependencies
178 $(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi
180 $(OUT)/weblinks.itexi: #FIXME: add dependencies
181 $(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi
183 $(bib-files): $(OUT)/%.itexi: $(top-src-dir)/Documentation/web/%.bib
184 BSTINPUTS=$(top-src-dir)/Documentation/web \
186 -s $(top-src-dir)/Documentation/lily-bib \
191 # Get xrefs for English tely manuals
192 $(MANUALS_TELY:%.tely=$(OUT)/%.xref-map): $(OUT)/%.xref-map: $(top-src-dir)/Documentation/%.tely
193 $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) $<
195 # Get xrefs for English texi manuals
196 $(MANUALS_TEXI:%.texi=$(OUT)/%.xref-map): $(OUT)/%.xref-map: $(top-src-dir)/Documentation/%.texi
197 $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) $<
199 # Get xrefs for translated tely manuals
200 $(eval $(foreach l,$(WEB_LANGS),\
201 $(eval $(MANUALS_$(l):%.tely=$(OUT)/%.$(l).xref-map): $(OUT)/%.$(l).xref-map: $(top-src-dir)/Documentation/$(l)/%.tely; \
202 $$(DO_TEXI_DEP) $$(EXTRACT_TEXI_FILENAMES) $$< ) \
205 # Get xrefs for the English web.texi manual
206 $(OUT)/web.xref-map: $(top-src-dir)/Documentation/web.texi
207 $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) --split=node $<
209 # Get xrefs for translated web.texi manuals
210 $(OUT)/web.%.xref-map: $(top-src-dir)/Documentation/%/web.texi
211 $(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) --split=node $<
213 # Build the English website
214 $(OUT)/index.html: $(top-src-dir)/Documentation/web.texi
215 $(DO_TEXI_DEP) $(TEXI2HTML) $<
217 # Build translated websites
218 $(eval $(foreach l,$(WEB_LANGS),\
219 $(eval $(OUT)/$(l)/index.html: $(top-src-dir)/Documentation/$(l)/web.texi; \
220 $$(DO_TEXI_DEP) $$(TEXI2HTML) --lang="$(l)" $$<; ) \
223 # Website post-processing
224 $(OUT)/website/index.html: $(wildcard $(OUT)/*.html)
225 ls $(OUT)/*.html | sed 's!$(OUT)/!!g' | xargs $(MASS_LINK) --prepend-suffix="" hard $(OUT)/ $(OUT)/website/
226 $(foreach l,$(WEB_LANGS), \
227 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/; )
228 $(WEB_POST) $(OUT)/website
231 $(css-files): $(OUT)/website/css/%: $(top-src-dir)/Documentation/css/%
234 $(example-files): $(OUT)/website/ly-examples/%: $(EXAMPLES)/%
237 $(picture-files): $(OUT)/website/pictures/%: $(PICTURES)/%
240 $(OUT)/website/favicon.ico: $(SERVER_FILES)/favicon.ico
243 $(OUT)/website/robots.txt: $(SERVER_FILES)/robots.txt
246 $(OUT)/.htaccess: $(top-htaccess)
249 $(OUT)/website/.htaccess: $(dir-htaccess)