1
1
# Makefile for MongoDB Sphinx documentation
2
- MAKEFLAGS += -j
3
- MAKEFLAGS += -r
4
- MAKEFLAGS += --no-print-directory
2
+ MAKEFLAGS += -j -r --no-print-directory
5
3
6
4
# Build directory tweaking.
7
5
output = build
@@ -11,13 +9,11 @@ public-output = $(output)/public
11
9
branch-output = $(output ) /$(current-branch )
12
10
public-branch-output = $(public-output ) /$(current-branch )
13
11
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
15
14
current-branch := $(shell git symbolic-ref HEAD 2>/dev/null | cut -d "/" -f "3" )
16
15
last-commit := $(shell git rev-parse --verify HEAD)
17
16
timestamp := $(shell date +% Y% m% d% H% M)
18
-
19
- # change this to reflect the branch that "manual/" will point to
20
- manual-branch = master
21
17
ifeq ($(current-branch ) ,$(manual-branch ) )
22
18
current-if-not-manual = manual
23
19
else
@@ -36,15 +32,14 @@ help:
36
32
@echo " publish runs publication process and then deploys the build to $( public-output) "
37
33
@echo " push runs publication process and pushes to docs site to production."
38
34
@echo " draft builds a 'draft' build for pre-publication testing ."
39
- @echo " pdfs generates pdfs more efficently than latexpdf ."
35
+ @echo " pdfs generates pdfs."
40
36
41
37
# ############ makefile includes #############
42
38
include bin/makefile.compatibility
43
39
include bin/makefile.push
44
40
45
41
# 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.
48
43
49
44
-include $(output ) /makefile.pdfs
50
45
-include $(output ) /makefile.tables
@@ -63,7 +58,7 @@ $(output)/makefile.%:bin/makefile-builder/%.py bin/makefile_builder.py bin/build
63
58
publish-if-up-to-date :
64
59
@bin/published-build-check $(current-branch ) $(last-commit )
65
60
@$(MAKE ) publish
66
- publish :initial-dependencies pre-build-dependencies
61
+ publish :initial-dependencies
67
62
@echo [build]: starting build of sphinx components built at ` date`
68
63
@$(MAKE ) sphinx-components
69
64
@echo [build]: all sphinx components built at ` date`
@@ -74,17 +69,20 @@ publish:initial-dependencies pre-build-dependencies
74
69
75
70
# Deployment targets to kick off the rest of the build process.
76
71
# 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.
83
74
post-processing :error-pages links
84
75
@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
86
77
@echo [build]: completed $@ buildstep.
87
78
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
+
88
86
# ############ Targets that define the production build process #############
89
87
.PHONY :source/about.txt source/includes/hash.rst setup $(public-branch-output ) /release.txt
90
88
@@ -135,7 +133,7 @@ $(branch-output)/sitemap.xml.gz:$(public-output)/manual $(branch-output)/dirhtml
135
133
136
134
LATEX_CORRECTION = "s/(index|bfcode)\{(.*!*)*--(.*)\}/\1\{\2-\{-\}\3\}/g"
137
135
LATEX_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 )
139
137
140
138
# Uses 'latex' target to generate latex files.
141
139
pdfs :$(subst .tex,.pdf,$(wildcard $(branch-output ) /latex/* .tex) )
@@ -145,13 +143,13 @@ $(branch-output)/latex/%.tex:
145
143
% .pdf :% .tex
146
144
@echo [pdf]: pdf compilation of $@ , started at ` date` .
147
145
@touch $(basename $@ ) -pdflatex.log
148
- @-$(PDFLATEXCOMMAND ) $( LATEXOPTS ) ' $<' >> $(basename $@ ) -pdflatex.log
146
+ @-$(pdflatex-command ) ' $<' >> $(basename $@ ) -pdflatex.log
149
147
@echo [pdf]: \( 1/4\) pdflatex $<
150
148
@-makeindex -s $(branch-output ) /latex/python.ist ' $(basename $<).idx' >> $(basename $@ ) -pdflatex.log 2>&1
151
149
@echo [pdf]: \( 2/4\) Indexing: $(basename $< ) .idx
152
- @$(PDFLATEXCOMMAND ) $( LATEXOPTS ) ' $<' >> $(basename $@ ) -pdflatex.log
150
+ @$(pdflatex-command ) ' $<' >> $(basename $@ ) -pdflatex.log
153
151
@echo [pdf]: \( 3/4\) pdflatex $<
154
- @$(PDFLATEXCOMMAND ) $( LATEXOPTS ) ' $<' >> $(basename $@ ) -pdflatex.log
152
+ @$(pdflatex-command ) ' $<' >> $(basename $@ ) -pdflatex.log
155
153
@echo [pdf]: \( 4/4\) pdflatex $<
156
154
@echo [pdf]: see ' $(basename $@)-pdflatex.log' for a full report of the pdf build process.
157
155
@echo [pdf]: pdf compilation of $@ , complete at ` date` .
@@ -171,7 +169,7 @@ clean-all:
171
169
172
170
# Archiving $(public-output) for more sane testing, and risk free cleaning.
173
171
archive :$(public-output ) .$(timestamp ) .tar.gz
174
- @echo [archive ]: created $< archive .
172
+ @echo [$@ ]: created $< $@ .
175
173
$(public-output ) .% .tar.gz :$(public-output )
176
174
tar -czvf $@ $<
177
175
@@ -180,9 +178,12 @@ draft:draft-html
180
178
draft-pdfs :draft-latex $(subst .tex,.pdf,$(wildcard $(branch-output ) /draft-latex/* .tex) )
181
179
182
180
# 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
187
187
$(branch-output ) /man/% .1.gz : $(branch-output ) /man/% .1
188
- gzip $< -c > $@
188
+ @gzip $< -c > $@
189
+ @echo [man] compressing $< -- $@
0 commit comments