Fix #348.
[lilypond/mpolesky.git] / make / website.make
blobdc21c6e15229e3c4619bff62a4fff6d6071e519f
1 ################################################################
2 # website (without the rest of the docs)
4 ################################################################
5 ##### SECURITY -- check these values for lilypond.org #########
6 ################################################################
7 ifeq ($(WEBSITE_ONLY_BUILD),1)
8 ### for lilypond.org
9 TOP_SRC_DIR=$(HOME)/src/lilypond
10 TRUSTED_DIR=$(HOME)/lilypond/trusted-scripts
11 top-src-dir=$(TOP_SRC_DIR)
12 depth=.
13 trusted-dir=$(TRUSTED_DIR)
14 script-dir=$(trusted-dir)
15 texi2html-init-file=$(trusted-dir)/lilypond-texi2html.init
16 top-htaccess=$(trusted-dir)/lilypond.org.htaccess
17 dir-htaccess=$(trusted-dir)/website-dir.htaccess
18 TEXI2HTML_PROGRAM=$(HOME)/usr/bin/texi2html
19 EXAMPLES=$(HOME)/media/ly-examples/
20 PICTURES=$(HOME)/media/pictures
21 else
22 ### for normal git
23 script-dir=$(top-src-dir)/scripts/build/
24 texi2html-init-file=$(top-src-dir)/Documentation/lilypond-texi2html.init
25 top-htaccess=$(top-src-dir)/Documentation/web/server/lilypond.org.htaccess
26 dir-htaccess=$(top-src-dir)/Documentation/web/server/website-dir.htaccess
27 include $(config_make)
28 # I assume this is run from top-build-dir
29 EXAMPLES=Documentation/web/ly-examples/out-www/
30 PICTURES=Documentation/pictures/out-www/
31 endif
34 ################################################################
35 OUT=out-website
37 ### only update this when the language compiles correctly!
38 #WEB_LANGS = es fr nl
39 WEB_LANGS = es
41 TEXI2HTML=ONLY_WEB=1 TOP_SRC_DIR=$(top-src-dir) DEPTH=$(depth) PERL_UNICODE=SD $(TEXI2HTML_PROGRAM)
43 EXTRACT_TEXI_FILENAMES=python $(script-dir)/extract_texi_filenames.py
44 CREATE_VERSION=python $(script-dir)/create-version-itexi.py
45 CREATE_WEBLINKS=python $(script-dir)/create-weblinks-itexi.py
46 MASS_LINK=python $(script-dir)/mass-link.py
47 WEB_POST=python $(script-dir)/website_post.py
49 SERVER_FILES=$(top-src-dir)/Documentation/web/server/
51 # don't include web
52 MANUALS=$(wildcard $(top-src-dir)/Documentation/*.tely)
53 MANUALS+=$(top-src-dir)/Documentation/contributor.texi
55 website-test:
56 echo $(TEXI2HTML)
58 website-version:
59 mkdir -p $(OUT)
60 $(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi
61 $(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi
63 website-xrefs: website-version
64 $(EXTRACT_TEXI_FILENAMES) -I $(top-src-dir)/Documentation/ \
65 -I $(OUT) -o $(OUT) --split=node \
66 $(top-src-dir)/Documentation/web.texi
67 # normal manuals
68 for m in $(MANUALS); do \
69 b=`basename "$$m" .texi`; \
70 d=`basename "$$b" .tely`; \
71 $(EXTRACT_TEXI_FILENAMES) \
72 -I $(top-src-dir)/Documentation/ \
73 -I $(top-src-dir)/Documentation/"$$d"/ \
74 -I $(OUT) -o $(OUT) "$$m" ; \
75 done
76 # translations
77 for l in $(WEB_LANGS); do \
78 $(EXTRACT_TEXI_FILENAMES) \
79 -I $(top-src-dir)/Documentation/ \
80 -I $(top-src-dir)/Documentation/"$$l" \
81 -I $(OUT) -o $(OUT) --split=node \
82 $(top-src-dir)/Documentation/"$$l"/web.texi ;\
83 for m in $(MANUALS); do \
84 n=`echo "$$m" | sed 's/Documentation/Documentation\/'$$l'/'` ; \
85 b=`basename "$$n" .texi`; \
86 d=`basename "$$b" .tely`; \
87 if [ -e "$$n" ] ; then \
88 $(EXTRACT_TEXI_FILENAMES) \
89 -I $(top-src-dir)/Documentation/ \
90 -I $(top-src-dir)/Documentation/"$$l" \
91 -I $(top-src-dir)/Documentation/"$$l"/"$$d"/ \
92 -I $(OUT) -o $(OUT) "$$n" ; \
93 fi ; \
94 done; \
95 done;
99 website-texinfo: website-version website-xrefs
100 $(TEXI2HTML) --prefix=index \
101 --split=section \
102 --I=$(top-src-dir)/Documentation/ \
103 --I=$(OUT) \
104 --init-file=$(texi2html-init-file) \
105 -D web_version \
106 --output=$(OUT)/website/ \
107 $(top-src-dir)/Documentation/web.texi
108 # translations
109 for l in $(WEB_LANGS); do \
110 $(TEXI2HTML) --prefix=index \
111 --split=section \
112 --I=$(top-src-dir)/Documentation/"$$l" \
113 --I=$(top-src-dir)/Documentation/ \
114 --I=$(OUT) \
115 --lang="$$l" \
116 --init-file=$(texi2html-init-file) \
117 -D web_version \
118 --output=$(OUT)/"$$l" \
119 $(top-src-dir)/Documentation/"$$l"/web.texi ; \
120 find $(OUT)/$$l/ -name '*.html' | xargs grep -L 'UNTRANSLATED NODE: IGNORE ME' | sed 's!$(OUT)/'$$l'/!!g' | xargs $(MASS_LINK) --prepend-suffix .$$l hard $(OUT)/$$l/ $(OUT)/website/ ; \
121 done
124 website-css:
125 cp $(top-src-dir)/Documentation/css/*.css $(OUT)/website/
127 website-pictures:
128 mkdir -p $(OUT)/website/pictures/
129 cp $(PICTURES)/* $(OUT)/website/pictures/
130 ln -sf website/pictures $(OUT)/pictures
132 website-examples:
133 mkdir -p $(OUT)/website/ly-examples
134 cp $(EXAMPLES)/* $(OUT)/website/ly-examples
136 web-post:
137 $(WEB_POST) $(OUT)/website/
139 website: website-texinfo website-css website-pictures website-examples web-post
140 cp $(SERVER_FILES)/favicon.ico $(OUT)/website/
141 cp $(SERVER_FILES)/robots.txt $(OUT)/website/
142 cp $(top-htaccess) $(OUT)/.htaccess
143 cp $(dir-htaccess) $(OUT)/website/.htaccess