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	  cp -t $(infodir) "$$f" && \
22	  $(INSTALL_INFO) --info-dir=$(infodir) "$$f" ; \
23	done
24
25uninstall-info: info
26	for f in *.info; do \
27	  rm -f "$(infodir)/$$f"  ; \
28	  $(INSTALL_INFO) --delete --info-dir=$(infodir) "$$f" ; \
29	done
30
31%.info: %.texi
32	$(MAKEINFO) -o '$@' '$<'
33
34%.txt: %.texi
35	$(MAKEINFO_plaintext) -o '$@' '$<'
36
37%.html: %.texi
38	$(MAKEINFO_html) -o '$@' '$<'
39
40%.pdf: %.texi
41	-$(TEXI2PDF) '$<'
42	-$(TEXI2PDF) '$<'
43	-$(TEXI2PDF) '$<'
44
45clean:
46	-rm -f *.info *.pdf *.txt *.html
47	-rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla *.ky *.pg
48	-rm -f *.vr *.tp *.fn *.fns *.def *.defs *.cp *.cps *.ge *.ges *.mo
49
50.PHONY: all info plaintext html pdf install-info uninstall-info clean
51