| 1 |
#! /usr/bin/make |
| 2 |
|
| 3 |
##### This part is to generate html files in the current directory ########### |
| 4 |
|
| 5 |
SOURCES = $(wildcard _sources/*.rst | grep -v index.rst | sed 's%_sources/%%') |
| 6 |
HTML_FILES = $(patsubst _sources/%.rst, %.html, $(SOURCES)) |
| 7 |
|
| 8 |
all: $(HTML_FILES) |
| 9 |
@echo |
| 10 |
@echo "[Done]" |
| 11 |
%.html: _sources/%.rst |
| 12 |
@echo -n "$@ " |
| 13 |
@rst2html $< $@ |
| 14 |
|
| 15 |
###### That part is for the User Manual ####################################### |
| 16 |
|
| 17 |
# Minimal makefile for Sphinx documentation |
| 18 |
# |
| 19 |
|
| 20 |
# You can set these variables from the command line. |
| 21 |
SPHINXOPTS = |
| 22 |
SPHINXBUILD = sphinx-build |
| 23 |
SOURCEDIR = _sources |
| 24 |
SOURCES = $(wildcard $(SOURCEDIR)/*.rst) |
| 25 |
BUILDDIR = build |
| 26 |
|
| 27 |
PAPER = a4 |
| 28 |
|
| 29 |
# Internal variables. |
| 30 |
PAPEROPT_a4 = -D latex_paper_size=a4 |
| 31 |
PAPEROPT_letter = -D latex_paper_size=letter |
| 32 |
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) |
| 33 |
# the i18n builder cannot share the environment and doctrees with the others |
| 34 |
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . |
| 35 |
|
| 36 |
|
| 37 |
# Put it first so that "make" without argument is like "make help". |
| 38 |
help: |
| 39 |
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 40 |
|
| 41 |
.PHONY: help Makefile |
| 42 |
|
| 43 |
.PHONY: latexpdf real_latexpdf |
| 44 |
|
| 45 |
# for languages without correct LaTeX babel, change this dependency |
| 46 |
# so latexpdf will not be called |
| 47 |
latexpdf: |
| 48 |
@if [ -f NoLaTeX ]; then \ |
| 49 |
printf "+----------------------------------+\n| No LaTeX build since it is not |\n| well supported for this language |\n+----------------------------------+\n"; \ |
| 50 |
else \ |
| 51 |
$(MAKE) real_latexpdf; \ |
| 52 |
fi |
| 53 |
|
| 54 |
real_latexpdf: cover/coverpage.pdf cover/preface.pdf $(SOURCES) |
| 55 |
$(SPHINXBUILD) -b latex "$(SOURCEDIR)" $(ALLSPHINXOPTS) $(BUILDDIR)/latex |
| 56 |
@echo copying a few files |
| 57 |
cp cover/*.pdf $(BUILDDIR)/latex |
| 58 |
@echo modifying the title page |
| 59 |
cd $(BUILDDIR)/latex; \ |
| 60 |
sed -i '/\\usepackage{sphinx}/r ../../include.tex' expEYES-Junior.tex; \ |
| 61 |
sed -i 's/\\sphinxmaketitle/\\includepdf{coverpage.pdf}\n\\includepdf{preface.pdf}/' expEYES-Junior.tex; |
| 62 |
@echo launching prettyLaTeX.py |
| 63 |
python3 prettyLaTeX.py $(BUILDDIR)/latex expEYES-Junior.tex |
| 64 |
@echo generating PDF images in the LaTeX directory |
| 65 |
rm -f $(BUILDDIR)/latex/Makefile-images |
| 66 |
ln -s ../../../Makefile-images $(BUILDDIR)/latex |
| 67 |
make -C $(BUILDDIR)/latex -f Makefile-images -j4 |
| 68 |
@echo "Running LaTeX files through xelatex..." |
| 69 |
$(MAKE) -C $(BUILDDIR)/latex all-pdf PDFLATEX="latexmk -xelatex -silent -f -dvi- -ps-" || cat $(BUILDDIR)/latex/expEYES-Junior.log |
| 70 |
@echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex." |
| 71 |
|
| 72 |
.PHONY: epub |
| 73 |
epub: |
| 74 |
$(SPHINXBUILD) -b epub "$(SOURCEDIR)" $(ALLSPHINXOPTS) $(BUILDDIR)/epub |
| 75 |
@echo |
| 76 |
@echo "Build finished. The epub file is in $(BUILDDIR)/epub." |
| 77 |
|
| 78 |
.PHONY: clean |
| 79 |
clean: |
| 80 |
rm -rf $(BUILDDIR)/* |
| 81 |
cd cover; rm -f *.aux *.log *~ |
| 82 |
|
| 83 |
.PHONY: distclean |
| 84 |
distclean: clean |
| 85 |
cd cover; rm -f *.pdf |