Debian Codegraph @

eyes17/helpFiles/hi/Makefile

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