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