1# Makefile for Sphinx Texinfo output
2
3infodir ?= /usr/share/info
4
5MAKEINFO = makeinfo --no-split
6MAKEINFO_html = makeinfo --no-split --html
7MAKEINFO_plaintext = makeinfo --no-split --plaintext
8TEXI2PDF = texi2pdf --batch --expand
9INSTALL_INFO = install-info
10
11ALLDOCS = $(basename $(wildcard *.texi))
12
13all: info
14info: $(addsuffix .info,$(ALLDOCS))
15plaintext: $(addsuffix .txt,$(ALLDOCS))
16html: $(addsuffix .html,$(ALLDOCS))
17pdf: $(addsuffix .pdf,$(ALLDOCS))
18
19install-info: info
20	for f in *.info; do \
21	  mkdir -p $(infodir) && \
22	  cp "$$f" $(infodir) && \
23	  $(INSTALL_INFO) --info-dir=$(infodir) "$$f" && \
24	  \
25	  FIGURE_DIR="`basename \"$$f\" .info`-figures" && \
26	  if [ -e "$$FIGURE_DIR" ]; then \
27	    cp -r "$$FIGURE_DIR" $(infodir) ; \
28	  fi; \
29	done
30
31uninstall-info: info
32	for f in *.info; do \
33	  rm -f "$(infodir)/$$f"  ; \
34	  rm -rf "$(infodir)/`basename '$$f' .info`-figures" && \
35	  $(INSTALL_INFO) --delete --info-dir=$(infodir) "$$f" ; \
36	done
37
38%.info: %.texi
39	$(MAKEINFO) -o '$@' '$<'
40
41%.txt: %.texi
42	$(MAKEINFO_plaintext) -o '$@' '$<'
43
44%.html: %.texi
45	$(MAKEINFO_html) -o '$@' '$<'
46
47%.pdf: %.texi
48	-$(TEXI2PDF) '$<'
49	-$(TEXI2PDF) '$<'
50	-$(TEXI2PDF) '$<'
51
52clean:
53	rm -f *.info *.pdf *.txt *.html
54	rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla *.ky *.pg
55	rm -f *.vr *.tp *.fn *.fns *.def *.defs *.cp *.cps *.ge *.ges *.mo
56
57.PHONY: all info plaintext html pdf install-info uninstall-info clean
58