55SPHINXOPTS =
66SPHINXBUILD = sphinx-build
77PAPER =
8- BUILDDIR = _build
9- RELEASE = v0.1
8+ BUILDDIR = build
9+ BASENAME = $( subst .,, $( subst $() $() ,,diffpy.nmf_mapping) )
1010
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
1115
1216# Internal variables.
1317PAPEROPT_a4 = -D latex_paper_size=a4
1418PAPEROPT_letter = -D latex_paper_size=letter
15- ALLSPHINXOPTS = -d $(BUILDDIR ) /doctrees $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) .
19+ ALLSPHINXOPTS = -d $(BUILDDIR ) /doctrees $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) source
1620# the i18n builder cannot share the environment and doctrees with the others
17- I18NSPHINXOPTS = $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) .
21+ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER ) ) $(SPHINXOPTS ) source
1822
1923.PHONY : help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
2024
21- DOCREPONAME = <your_repo>.github.io
22- DOCREPOURL = <your_github_repo>
23-
24-
2525help :
2626 @echo " Please use \` make <target>' where <target> is one of"
2727 @echo " html to make standalone HTML files"
@@ -35,17 +35,20 @@ help:
3535 @echo " epub to make an epub"
3636 @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
3737 @echo " latexpdf to make LaTeX files and run them through pdflatex"
38+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
3839 @echo " text to make text files"
3940 @echo " man to make manual pages"
4041 @echo " texinfo to make Texinfo files"
4142 @echo " info to make Texinfo files and run them through makeinfo"
4243 @echo " gettext to make PO message catalogs"
4344 @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"
4447 @echo " linkcheck to check all external links for integrity"
4548 @echo " doctest to run all doctests embedded in the documentation (if enabled)"
4649
4750clean :
48- - rm -rf $(BUILDDIR ) /*
51+ rm -rf $(BUILDDIR ) /*
4952
5053html :
5154 $(SPHINXBUILD ) -b html $(ALLSPHINXOPTS ) $(BUILDDIR ) /html
@@ -83,17 +86,17 @@ qthelp:
8386 @echo
8487 @echo " Build finished; now you can run " qcollectiongenerator" with the" \
8588 " .qhcp project file in $( BUILDDIR) /qthelp, like this:"
86- @echo " # qcollectiongenerator $( BUILDDIR) /qthelp/fief .qhcp"
89+ @echo " # qcollectiongenerator $( BUILDDIR) /qthelp/$( BASENAME ) .qhcp"
8790 @echo " To view the help file:"
88- @echo " # assistant -collectionFile $( BUILDDIR) /qthelp/fief .qhc"
91+ @echo " # assistant -collectionFile $( BUILDDIR) /qthelp/$( BASENAME ) .qhc"
8992
9093devhelp :
9194 $(SPHINXBUILD ) -b devhelp $(ALLSPHINXOPTS ) $(BUILDDIR ) /devhelp
9295 @echo
9396 @echo " Build finished."
9497 @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 ) "
97100 @echo " # devhelp"
98101
99102epub :
@@ -114,6 +117,12 @@ latexpdf:
114117 $(MAKE ) -C $(BUILDDIR ) /latex all-pdf
115118 @echo " pdflatex finished; the PDF files are in $( BUILDDIR) /latex."
116119
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+
117126text :
118127 $(SPHINXBUILD ) -b text $(ALLSPHINXOPTS ) $(BUILDDIR ) /text
119128 @echo
@@ -158,37 +167,28 @@ doctest:
158167 @echo " Testing of doctests in the sources finished, look at the " \
159168 " results in $( BUILDDIR) /doctest/output.txt."
160169
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