]> git.donarmstrong.com Git - lilypond.git/blob - make/website.make
Merge branch 'master' into lilypond/translation
[lilypond.git] / make / website.make
1 ################################################################
2 # website (without the rest of the docs)
3
4 ################################################################
5 #####  SECURITY -- check these values for lilypond.org #########
6 ################################################################
7
8 ifeq ($(WEBSITE_ONLY_BUILD),1)
9   ### for lilypond.org
10   TOP_SRC_DIR=$(HOME)/lilypond/lilypond-git
11   TRUSTED_DIR=$(HOME)/lilypond/trusted-scripts
12   top-src-dir=$(TOP_SRC_DIR)
13   depth=.
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
20   EXAMPLES=$(HOME)/lilypond/media/ly-examples
21   PICTURES=$(HOME)/lilypond/media/pictures
22   PYTHON=python
23   PYTHONPATH=$(TRUSTED_DIR)
24 else
25   ### for normal git
26   script-dir=$(top-src-dir)/scripts/build
27   texi2html-init-file=$(top-src-dir)/Documentation/lilypond-texi2html.init
28   top-htaccess=$(top-src-dir)/Documentation/web/server/lilypond.org.htaccess
29   dir-htaccess=$(top-src-dir)/Documentation/web/server/website-dir.htaccess
30   include $(config_make)
31   # I assume this is run from top-build-dir
32   EXAMPLES=Documentation/web/ly-examples/out-www
33   PICTURES=Documentation/pictures/out-www
34 endif
35
36 ################################################################
37 #The 4 lines below present an option to force make website to run
38 # quietly only when it is run as make -s website.  However, we've
39 # decided not to use this switch, and run the scripts quietly all
40 # the time
41 ################################################################
42 #quiet-run = $(findstring s, $(MAKEFLAGS))
43 #ifeq ($(quiet-run),s)
44 #  quiet-flag=-q
45 #endif
46
47 #Nothing clever here - just allows the use of a boolean to control
48 #  quiet running
49 quiet-run = true
50 ifeq ($(quiet-run),true)
51   quiet-flag=-q
52 endif
53
54 ################################################################
55 OUT=out-website
56
57 WEB_LANGS = $(shell MAKEWEB=1 $(PYTHON) $(top-src-dir)/python/langdefs.py)
58
59 TEXI2HTML=ONLY_WEB=1 TOP_SRC_DIR=$(top-src-dir) DEPTH=$(depth) PERL_UNICODE=SD $(TEXI2HTML_PROGRAM)
60
61 EXTRACT_TEXI_FILENAMES=python $(script-dir)/extract_texi_filenames.py
62 CREATE_VERSION=python $(script-dir)/create-version-itexi.py
63 CREATE_WEBLINKS=python $(script-dir)/create-weblinks-itexi.py
64 MASS_LINK=python $(script-dir)/mass-link.py
65 WEB_POST=python $(script-dir)/website_post.py
66 WEB_BIBS=python $(script-dir)/bib2texi.py
67
68 SERVER_FILES=$(top-src-dir)/Documentation/web/server
69
70 # don't include web
71 MANUALS=$(wildcard $(top-src-dir)/Documentation/*.tely)
72 MANUALS+=$(top-src-dir)/Documentation/contributor.texi
73
74 website-test:
75         echo $(TEXI2HTML)
76
77 website-version:
78         mkdir -p $(OUT)
79         $(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi
80         $(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi
81
82 website-xrefs: website-version
83         for l in '' $(WEB_LANGS); do \
84                 len="$${#l}" ; \
85                 r="$$l"; \
86                 if [ "$$len" -gt "0" ] ; then \
87                         r="$$r"/; \
88                 fi ; \
89                 $(EXTRACT_TEXI_FILENAMES) \
90                         -I $(top-src-dir)/Documentation \
91                         -I $(top-src-dir)/Documentation/"$$l" \
92                         -I $(OUT) -o $(OUT) --split=node \
93                         --known-missing-files=$(top-src-dir)/scripts/build/website-known-missing-files.txt \
94                         $(quiet-flag) \
95                         $(top-src-dir)/Documentation/"$$l"/web.texi ;\
96                 for m in $(MANUALS); do \
97                         n=`echo "$$m" | sed 's/Documentation/Documentation\/'$$l'/'` ; \
98                         b=`basename "$$n" .texi`; \
99                         d=`basename "$$b" .tely`; \
100                         if [ -e "$$n" ] ; then \
101                                 $(EXTRACT_TEXI_FILENAMES) \
102                                 -I $(top-src-dir)/Documentation \
103                                 -I $(top-src-dir)/Documentation/"$$l" \
104                                 -I $(top-src-dir)/Documentation/"$$r""$$d" \
105                                 --known-missing-files=$(top-src-dir)/scripts/build/website-known-missing-files.txt \
106                           $(quiet-flag) \
107                                 -I $(OUT) -o $(OUT) "$$n" ; \
108                         fi ; \
109                 done; \
110         done;
111
112 website-bibs: website-version
113         BSTINPUTS=$(top-src-dir)/Documentation/web \
114                 $(WEB_BIBS) -s web \
115                 -s $(top-src-dir)/Documentation/lily-bib \
116                 -o $(OUT)/others-did.itexi \
117                 $(quiet-flag) \
118                 $(top-src-dir)/Documentation/web/others-did.bib
119         BSTINPUTS=$(top-src-dir)/Documentation/web \
120                 $(WEB_BIBS) -s web \
121                 -s $(top-src-dir)/Documentation/lily-bib \
122                 -o $(OUT)/we-wrote.itexi \
123                 $(quiet-flag) \
124                 $(top-src-dir)/Documentation/web/we-wrote.bib
125
126
127 website-texinfo: website-version website-xrefs website-bibs
128         for l in '' $(WEB_LANGS); do \
129                 if test -n "$$l"; then \
130                         langopt=--lang="$$l"; \
131                         langsuf=.$$l; \
132                 fi; \
133                 $(TEXI2HTML) --prefix=index \
134                         --split=section \
135                         --I=$(top-src-dir)/Documentation/"$$l" \
136                         --I=$(top-src-dir)/Documentation \
137                         --I=$(OUT) \
138                         $$langopt \
139                         --init-file=$(texi2html-init-file) \
140                         -D web_version \
141                         --output=$(OUT)/"$$l" \
142                         $(top-src-dir)/Documentation/"$$l"/web.texi ; \
143                 ls $(OUT)/$$l/*.html | xargs grep -L 'UNTRANSLATED NODE: IGNORE ME' | sed 's!$(OUT)/'$$l'/!!g' | xargs $(MASS_LINK) --prepend-suffix="$$langsuf" hard $(OUT)/$$l/ $(OUT)/website/ ; \
144         done
145
146
147 website-css:
148         cp $(top-src-dir)/Documentation/css/*.css $(OUT)/website
149
150 website-pictures:
151         mkdir -p $(OUT)/website/pictures
152         if [ -d $(PICTURES) ]; \
153         then \
154                 cp $(PICTURES)/* $(OUT)/website/pictures ; \
155                 ln -sf website/pictures $(OUT)/pictures  ;\
156         fi
157
158 website-examples:
159         mkdir -p $(OUT)/website/ly-examples
160         if [ -d $(EXAMPLES) ]; \
161         then \
162                 cp $(EXAMPLES)/* $(OUT)/website/ly-examples ; \
163         fi
164
165 web-post:
166         $(WEB_POST) $(OUT)/website
167
168 website: website-texinfo website-css website-pictures website-examples web-post
169         cp $(SERVER_FILES)/favicon.ico $(OUT)/website
170         cp $(SERVER_FILES)/robots.txt $(OUT)/website
171         cp $(top-htaccess) $(OUT)/.htaccess
172         cp $(dir-htaccess) $(OUT)/website/.htaccess
173
174