33# You can set these variables from the command line.
44SPHINXOPTS = -c ./
55SPHINXBUILD = sphinx-build
6- SITEMAPBUILD = bin/sitemap_gen.py
76PAPER =
87
98# change this to reflect the location of the public repo
2827ifeq ($(UNAME ) , Darwin)
2928SED_ARGS_FILE = -i "" -E
3029SED_ARGS_REGEX = -E
30+ PYTHONBIN = python
3131endif
3232
33+ ifeq ($(shell test -f /etc/arch-release && echo arch || echo Linux) ,arch)
34+ PYTHONBIN = python2
35+ else
36+ PYTHONBIN = python
37+ endif
38+
39+
3340# Internal variables.
3441PAPEROPT_a4 = -D latex_paper_size=a4
3542PAPEROPT_letter = -D latex_paper_size=letter
@@ -98,7 +105,7 @@ setup:
98105 mkdir -p $(BUILDDIR ) /{dirhtml,singlehtml,html,epub,latex} $(CURRENTBUILD ) /single
99106
100107deploy-one :source/about.txt $(BUILDDIR ) /html
101- deploy-two :$(CURRENTBUILD ) $(CURRENTBUILD ) /release.txt $(CURRENTBUILD ) /MongoDB-Manual.pdf $(CURRENTBUILD ) /MongoDB-Manual.epub
108+ deploy-two :$(CURRENTBUILD ) $(CURRENTBUILD ) /release.txt $(CURRENTBUILD ) /MongoDB-Manual.pdf $(CURRENTBUILD ) /MongoDB-Manual.epub $( CURRENTBUILD ) /sitemap.xml.gz
102109deploy-three :$(CURRENTBUILD ) /single $(CURRENTBUILD ) /single/search.html $(CURRENTBUILD ) /single/genindex.html $(CURRENTBUILD ) /single/index.html
103110deploy-four :$(publication-output ) /index.html $(publication-output ) /10gen-gpg-key.asc $(CURRENTBUILD ) /tutorials $(CURRENTBUILD ) /.htaccess
104111
@@ -108,6 +115,7 @@ deploy-four:$(publication-output)/index.html $(publication-output)/10gen-gpg-key
108115$(BUILDDIR ) /epub/MongoDB.epub :epub
109116$(BUILDDIR ) /latex/MongoDB.tex :latex
110117$(BUILDDIR ) /latex/MongoDB.pdf :$(BUILDDIR ) /latex/MongoDB.tex
118+ $(BUILDDIR ) /sitemap.xml.gz :$(BUILDDIR ) /dirhtml
111119
112120$(BUILDDIR ) /singlehtml/contents.html :$(BUILDDIR ) /singlehtml
113121$(BUILDDIR ) /dirhtml/search/index.html :$(BUILDDIR ) /dirhtml
@@ -152,6 +160,8 @@ $(CURRENTBUILD)/single/index.html:$(BUILDDIR)/singlehtml/contents.html
152160 @sed $(SED_ARGS_FILE ) -e ' s/href="contents.html/href="index.html/g' $@
153161 @sed $(SED_ARGS_FILE ) -e ' s/name="robots" content="index"/name="robots" content="noindex"/g' $@
154162 @echo " [SINGLE]: generating '$@ '"
163+ $(CURRENTBUILD ) /sitemap.xml.gz :$(BUILDDIR ) /sitemap.xml.gz
164+ cp $< $@
155165
156166# Deployment related work for the non-Sphinx aspects of the build.
157167$(CURRENTBUILD ) /release.txt :$(publication-output ) /manual
@@ -207,10 +217,11 @@ epub:
207217 @{ $(epub-command ) 2>&1 1>&3 | $(epub-filter ) 1>&2 ; } 3>&1
208218 @echo " [EPUB] Build complete."
209219
210- # --testing creates sitemap but does not notify Google of new
211- # sitemap.xml
212- sitemap :
213- $(SITEMAPBUILD ) --testing --config=sitemap-config.xml
220+ SITEMAPBUILD = $(PYTHONBIN ) bin/sitemap_gen.py
221+ sitemap :$(BUILDDIR ) /sitemap.xml.gz
222+ $(BUILDDIR ) /sitemap.xml.gz :
223+ $(SITEMAPBUILD ) --testing --config=conf-sitemap.xml
224+ @echo " [SITEMAP] sitemap built."
214225
215226
216227# #####################################################################
0 commit comments