11# Makefile for MongoDB Sphinx documentation
2- MAKEFLAGS += -j
3- MAKEFLAGS += -r
4- MAKEFLAGS += --no-print-directory
2+ MAKEFLAGS += -j -r --no-print-directory
53
64# Build directory tweaking.
75output = build
@@ -11,13 +9,11 @@ public-output = $(output)/public
119branch-output = $(output ) /$(current-branch )
1210public-branch-output = $(public-output ) /$(current-branch )
1311
14- # intuit the current branch and commit
12+ # get current branch & commit; set the branch that "manual/" points to; + a conditional
13+ manual-branch = master
1514current-branch := $(shell git symbolic-ref HEAD 2>/dev/null | cut -d "/" -f "3" )
1615last-commit := $(shell git rev-parse --verify HEAD)
1716timestamp := $(shell date +% Y% m% d% H% M)
18-
19- # change this to reflect the branch that "manual/" will point to
20- manual-branch = master
2117ifeq ($(current-branch ) ,$(manual-branch ) )
2218current-if-not-manual = manual
2319else
@@ -36,15 +32,14 @@ help:
3632 @echo " publish runs publication process and then deploys the build to $( public-output) "
3733 @echo " push runs publication process and pushes to docs site to production."
3834 @echo " draft builds a 'draft' build for pre-publication testing ."
39- @echo " pdfs generates pdfs more efficently than latexpdf ."
35+ @echo " pdfs generates pdfs."
4036
4137# ############ makefile includes #############
4238include bin/makefile.compatibility
4339include bin/makefile.push
4440
4541# Included, dynamically generated makefile sections, to build: sphinx
46- # targets, LaTeX/PDFs, tables, the installation guides, and symbolic
47- # links.
42+ # targets, LaTeX/PDFs, tables, the installation guides, and sym links.
4843
4944-include $(output ) /makefile.pdfs
5045-include $(output ) /makefile.tables
@@ -63,7 +58,7 @@ $(output)/makefile.%:bin/makefile-builder/%.py bin/makefile_builder.py bin/build
6358publish-if-up-to-date :
6459 @bin/published-build-check $(current-branch ) $(last-commit )
6560 @$(MAKE ) publish
66- publish :initial-dependencies pre-build-dependencies
61+ publish :initial-dependencies
6762 @echo [build]: starting build of sphinx components built at ` date`
6863 @$(MAKE ) sphinx-components
6964 @echo [build]: all sphinx components built at ` date`
@@ -74,17 +69,20 @@ publish:initial-dependencies pre-build-dependencies
7469
7570# Deployment targets to kick off the rest of the build process.
7671# Only access these targets through the ``publish`` or ``publish-if-up-to-date`` targets.
77- pre-build-dependencies :setup installation-guides tables
78- @echo [build]: completed $@ buildstep.
79- initial-dependencies :$(public-branch-output ) /MongoDB-Manual.epub
80- @echo [build]: completed $@ buildstep.
81- static-components :$(public-output ) /index.html $(public-output ) /10gen-gpg-key.asc $(public-output ) /10gen-security-gpg-key.asc $(public-branch-output ) /.htaccess $(public-branch-output ) /release.txt $(public-output ) /osd.xml
82- @echo [build]: completed $@ buildstep.
72+ static-components :security-keys static-pages meta-static
73+ @echo [build]: completed $1 @ buildstep.
8374post-processing :error-pages links
8475 @echo [build]: completed $@ buildstep.
85- sphinx-components :manual-pdfs $( public-branch-output ) / single $( public-branch- output) /single/index.html $( public-branch- output ) $( public-branch-output ) /sitemap.xml.gz
76+ sphinx-components :manual-pdfs single- output public-output
8677 @echo [build]: completed $@ buildstep.
8778
79+ initial-dependencies :$(public-branch-output ) /MongoDB-Manual.epub
80+ single-output :$(public-branch-output ) /single $(public-branch-output ) /single/index.html
81+ public-output :$(public-branch-output ) $(public-branch-output ) /sitemap.xml.gz
82+ security-keys :$(public-output ) /10gen-gpg-key.asc $(public-output ) /10gen-security-gpg-key.asc
83+ static-pages :$(public-output ) /index.html $(public-branch-output ) /release.txt
84+ meta-static :$(public-branch-output ) /.htaccess $(public-output ) /osd.xml
85+
8886# ############ Targets that define the production build process #############
8987.PHONY :source/about.txt source/includes/hash.rst setup $(public-branch-output ) /release.txt
9088
@@ -135,7 +133,7 @@ $(branch-output)/sitemap.xml.gz:$(public-output)/manual $(branch-output)/dirhtml
135133
136134LATEX_CORRECTION = "s/(index|bfcode)\{(.*!*)*--(.*)\}/\1\{\2-\{-\}\3\}/g"
137135LATEX_LINK_CORRECTION = "s%\\\code\{/%\\\code\{http://docs.mongodb.org/$(current-if-not-manual ) /%g"
138- PDFLATEXCOMMAND = TEXINPUTS=".:$(branch-output ) /latex/:" pdflatex --interaction batchmode --output-directory $(branch-output ) /latex/
136+ pdflatex-command = TEXINPUTS=".:$(branch-output ) /latex/:" pdflatex --interaction batchmode --output-directory $(branch-output ) /latex/ $( LATEXOPTS )
139137
140138# Uses 'latex' target to generate latex files.
141139pdfs :$(subst .tex,.pdf,$(wildcard $(branch-output ) /latex/* .tex) )
@@ -145,13 +143,13 @@ $(branch-output)/latex/%.tex:
145143% .pdf :% .tex
146144 @echo [pdf]: pdf compilation of $@ , started at ` date` .
147145 @touch $(basename $@ ) -pdflatex.log
148- @-$(PDFLATEXCOMMAND ) $( LATEXOPTS ) ' $<' >> $(basename $@ ) -pdflatex.log
146+ @-$(pdflatex-command ) ' $<' >> $(basename $@ ) -pdflatex.log
149147 @echo [pdf]: \( 1/4\) pdflatex $<
150148 @-makeindex -s $(branch-output ) /latex/python.ist ' $(basename $<).idx' >> $(basename $@ ) -pdflatex.log 2>&1
151149 @echo [pdf]: \( 2/4\) Indexing: $(basename $< ) .idx
152- @$(PDFLATEXCOMMAND ) $( LATEXOPTS ) ' $<' >> $(basename $@ ) -pdflatex.log
150+ @$(pdflatex-command ) ' $<' >> $(basename $@ ) -pdflatex.log
153151 @echo [pdf]: \( 3/4\) pdflatex $<
154- @$(PDFLATEXCOMMAND ) $( LATEXOPTS ) ' $<' >> $(basename $@ ) -pdflatex.log
152+ @$(pdflatex-command ) ' $<' >> $(basename $@ ) -pdflatex.log
155153 @echo [pdf]: \( 4/4\) pdflatex $<
156154 @echo [pdf]: see ' $(basename $@)-pdflatex.log' for a full report of the pdf build process.
157155 @echo [pdf]: pdf compilation of $@ , complete at ` date` .
@@ -171,7 +169,7 @@ clean-all:
171169
172170# Archiving $(public-output) for more sane testing, and risk free cleaning.
173171archive :$(public-output ) .$(timestamp ) .tar.gz
174- @echo [archive ]: created $< archive .
172+ @echo [$@ ]: created $< $@ .
175173$(public-output ) .% .tar.gz :$(public-output )
176174 tar -czvf $@ $<
177175
@@ -180,9 +178,12 @@ draft:draft-html
180178draft-pdfs :draft-latex $(subst .tex,.pdf,$(wildcard $(branch-output ) /draft-latex/* .tex) )
181179
182180# man page support, uses sphinx `man` builder output.
183- UNCOMPRESSED_MAN := $(wildcard $(branch-output ) /man/* .1)
184- COMPRESSED_MAN := $(subst .1,.1.gz,$(UNCOMPRESSED_MAN ) )
185- build-man :man $(COMPRESSED_MAN )
186- compress-man :$(COMPRESSED_MAN )
181+ .PHONY :$(manpages )
182+ manpages := $(wildcard $(branch-output ) /man/* .1)
183+ compressed-manpages := $(subst .1,.1.gz,$(manpages ) )
184+ manpages :$(compressed-manpages )
185+ $(compressed-manpages ) :$(manpages )
186+ $(manpages ) :man
187187$(branch-output ) /man/% .1.gz : $(branch-output ) /man/% .1
188- gzip $< -c > $@
188+ @gzip $< -c > $@
189+ @echo [man] compressing $< -- $@
0 commit comments