5
5
SPHINXOPTS =
6
6
SPHINXBUILD = sphinx-build
7
7
PAPER =
8
- BUILDDIR = _build
9
- RELEASE = v0.1
8
+ BUILDDIR = build
9
+ BASENAME = $( subst .,, $( subst $() $() ,,diffpy.nmf_mapping) )
10
10
11
+ # User-friendly check for sphinx-build
12
+ ifeq ($(shell which $(SPHINXBUILD ) >/dev/null 2>&1; echo $$? ) , 1)
13
+ $(error The '$(SPHINXBUILD ) ' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD ) ' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http ://sphinx-doc.org/)
14
+ endif
11
15
12
16
# Internal variables.
13
17
PAPEROPT_a4 = -D latex_paper_size=a4
14
18
PAPEROPT_letter = -D latex_paper_size=letter
15
- ALLSPHINXOPTS = -d $(BUILDDIR ) /doctrees $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) .
19
+ ALLSPHINXOPTS = -d $(BUILDDIR ) /doctrees $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) source
16
20
# the i18n builder cannot share the environment and doctrees with the others
17
- I18NSPHINXOPTS = $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) .
21
+ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) source
18
22
19
23
.PHONY : help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
20
24
21
- DOCREPONAME = <your_repo>.github.io
22
- DOCREPOURL = <your_github_repo>
23
-
24
-
25
25
help :
26
26
@echo " Please use \` make <target>' where <target> is one of"
27
27
@echo " html to make standalone HTML files"
@@ -35,17 +35,20 @@ help:
35
35
@echo " epub to make an epub"
36
36
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
37
37
@echo " latexpdf to make LaTeX files and run them through pdflatex"
38
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
38
39
@echo " text to make text files"
39
40
@echo " man to make manual pages"
40
41
@echo " texinfo to make Texinfo files"
41
42
@echo " info to make Texinfo files and run them through makeinfo"
42
43
@echo " gettext to make PO message catalogs"
43
44
@echo " changes to make an overview of all changed/added/deprecated items"
45
+ @echo " xml to make Docutils-native XML files"
46
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
44
47
@echo " linkcheck to check all external links for integrity"
45
48
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
46
49
47
50
clean :
48
- - rm -rf $(BUILDDIR ) /*
51
+ rm -rf $(BUILDDIR ) /*
49
52
50
53
html :
51
54
$(SPHINXBUILD ) -b html $(ALLSPHINXOPTS ) $(BUILDDIR ) /html
@@ -83,17 +86,17 @@ qthelp:
83
86
@echo
84
87
@echo " Build finished; now you can run " qcollectiongenerator" with the" \
85
88
" .qhcp project file in $( BUILDDIR) /qthelp, like this:"
86
- @echo " # qcollectiongenerator $( BUILDDIR) /qthelp/fief .qhcp"
89
+ @echo " # qcollectiongenerator $( BUILDDIR) /qthelp/$( BASENAME ) .qhcp"
87
90
@echo " To view the help file:"
88
- @echo " # assistant -collectionFile $( BUILDDIR) /qthelp/fief .qhc"
91
+ @echo " # assistant -collectionFile $( BUILDDIR) /qthelp/$( BASENAME ) .qhc"
89
92
90
93
devhelp :
91
94
$(SPHINXBUILD ) -b devhelp $(ALLSPHINXOPTS ) $(BUILDDIR ) /devhelp
92
95
@echo
93
96
@echo " Build finished."
94
97
@echo " To view the help file:"
95
- @echo " # mkdir -p $$ HOME/.local/share/devhelp/fief "
96
- @echo " # ln -s $( BUILDDIR) /devhelp $$ HOME/.local/share/devhelp/fief "
98
+ @echo " # mkdir -p $$ HOME/.local/share/devhelp/$( BASENAME ) "
99
+ @echo " # ln -s $( BUILDDIR) /devhelp $$ HOME/.local/share/devhelp/$( BASENAME ) "
97
100
@echo " # devhelp"
98
101
99
102
epub :
@@ -114,6 +117,12 @@ latexpdf:
114
117
$(MAKE ) -C $(BUILDDIR ) /latex all-pdf
115
118
@echo " pdflatex finished; the PDF files are in $( BUILDDIR) /latex."
116
119
120
+ latexpdfja :
121
+ $(SPHINXBUILD ) -b latex $(ALLSPHINXOPTS ) $(BUILDDIR ) /latex
122
+ @echo " Running LaTeX files through platex and dvipdfmx..."
123
+ $(MAKE ) -C $(BUILDDIR ) /latex all-pdf-ja
124
+ @echo " pdflatex finished; the PDF files are in $( BUILDDIR) /latex."
125
+
117
126
text :
118
127
$(SPHINXBUILD ) -b text $(ALLSPHINXOPTS ) $(BUILDDIR ) /text
119
128
@echo
@@ -158,37 +167,28 @@ doctest:
158
167
@echo " Testing of doctests in the sources finished, look at the " \
159
168
" results in $( BUILDDIR) /doctest/output.txt."
160
169
161
- push-latest :
162
- cd $(BUILDDIR ) && \
163
- test -d $(DOCREPONAME ) || git clone $(DOCREPOURL ) $(DOCREPONAME ) && \
164
- cd $(DOCREPONAME ) && \
165
- git pull origin gh-pages && \
166
- test -d latest || mkdir latest && touch latest/_ && \
167
- rm -r latest/* && \
168
- cp -r ../html/* latest/ && \
169
- git add latest/ && \
170
- git commit -am " Pushed latest docs at $( date) " && \
171
- git push
172
-
173
- push-release :
174
- cd $(BUILDDIR ) && \
175
- test -d $(DOCREPONAME ) || git clone $(DOCREPOURL ) $(DOCREPONAME ) && \
176
- cd $(DOCREPONAME ) && \
177
- git pull origin gh-pages && \
178
- test -d $(RELEASE ) || mkdir $(RELEASE ) && touch $(RELEASE ) /_ && \
179
- rm -r $(RELEASE ) /* && \
180
- cp -r ../html/* $(RELEASE ) / && \
181
- git add $(RELEASE ) / && \
182
- git commit -am " Pushed $( RELEASE) docs at $( date) " && \
183
- git push
184
-
185
- push-root :
186
- cd $(BUILDDIR ) && \
187
- test -d $(DOCREPONAME ) || git clone $(DOCREPOURL ) $(DOCREPONAME ) && \
188
- cd $(DOCREPONAME ) && \
189
- git pull origin gh-pages && \
190
- rm -rf libref previous _sources _static * .html * .js * .inv && \
191
- cp -r ../html/* . && \
192
- git add . && \
193
- git commit -am " Pushed root-level docs at $( date) " && \
194
- git push
170
+ # Manual publishing to the gh-pages branch
171
+
172
+ GITREPOPATH = $(shell cd $(CURDIR ) && git rev-parse --git-dir)
173
+ GITREMOTE = origin
174
+ GITREMOTEURL = $(shell git config --get remote.$(GITREMOTE ) .url)
175
+ GITLASTCOMMIT = $(shell git rev-parse --short HEAD)
176
+
177
+ publish :
178
+ @test -d build/html || \
179
+ ( echo >&2 " Run 'make html' first!" ; false )
180
+ git show-ref --verify --quiet refs/heads/gh-pages || \
181
+ git branch --track gh-pages $(GITREMOTE ) /gh-pages
182
+ test -d build/gh-pages || \
183
+ git clone -s -b gh-pages $(GITREPOPATH ) build/gh-pages
184
+ cd build/gh-pages && \
185
+ git pull $(GITREMOTEURL ) gh-pages
186
+ rsync -acv --delete --exclude=.git --exclude=.rsync-exclude \
187
+ --exclude-from=build/gh-pages/.rsync-exclude \
188
+ --link-dest=$(CURDIR ) /build/html build/html/ build/gh-pages/
189
+ cd build/gh-pages && \
190
+ git add --all . && \
191
+ git diff --cached --quiet || \
192
+ git commit -m " Sync with the source at $( GITLASTCOMMIT) ."
193
+ cd build/gh-pages && \
194
+ git push origin gh-pages
0 commit comments