aboutsummaryrefslogtreecommitdiffstats
path: root/docs/Makefile
blob: 12e35219e460982cc926ef67671f7426e9435f6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/make -f

INSTALL		= install
INSTALL_DIR	= $(INSTALL) -d -m0755

PS2PDF		:= ps2pdf
DVIPS		:= dvips
LATEX		:= latex
FIG2DEV		:= fig2dev
LATEX2HTML	:= latex2html
DOXYGEN		:= doxygen

pkgdocdir	:= /usr/share/doc/xen

DOC_TEX		:= $(wildcard src/*.tex)
DOC_PS		:= $(patsubst src/%.tex,ps/%.ps,$(DOC_TEX))
DOC_PDF		:= $(patsubst src/%.tex,pdf/%.pdf,$(DOC_TEX))
DOC_HTML	:= $(patsubst src/%.tex,html/%/index.html,$(DOC_TEX))

GFX = $(patsubst %.fig, %.eps, $(wildcard figs/*.fig))

.PHONY:	all build dev-docs python-dev-docs ps pdf html clean install

all: build
build: ps pdf html
	rm -f *.aux *.dvi *.bbl *.blg *.glo *.idx *.ilg *.log *.ind *.toc

dev-docs: python-dev-docs

ps: $(DOC_PS)

pdf: $(DOC_PDF)

html:
	@if which $(LATEX2HTML) 1>/dev/null 2>/dev/null; then \
	$(MAKE) $(DOC_HTML); fi

python-dev-docs:
	@mkdir -v -p api/tools/python
	@if which $(DOXYGEN) 1>/dev/null 2>/dev/null; then         \
        echo "Running doxygen to generate Python tools APIs ... "; \
	$(DOXYGEN) Doxyfile;                                       \
	$(MAKE) -C api/tools/python/latex ; else                   \
        echo "Doxygen not installed; skipping python-dev-docs."; fi

clean:
	rm -rf .word_count *.aux *.dvi *.bbl *.blg *.glo *.idx *~ 
	rm -rf *.ilg *.log *.ind *.toc *.bak core
	rm -rf $(GFX) ps pdf html
	rm -rf api

install: all
	rm -rf $(DESTDIR)$(pkgdocdir)
	$(INSTALL_DIR) $(DESTDIR)$(pkgdocdir)
	cp -dR ps $(DESTDIR)$(pkgdocdir)
	cp -dR pdf $(DESTDIR)$(pkgdocdir)
	[ ! -d html ] || cp -dR html $(DESTDIR)$(pkgdocdir)

pdf/%.pdf: ps/%.ps
	$(INSTALL_DIR) $(@D)
	$(PS2PDF) $< $@.new
	mv $@.new $@

ps/%.ps: %.dvi
	$(INSTALL_DIR) $(@D)
	$(DVIPS) -Ppdf -G0 -o $@.new $<
	mv $@.new $@

%.dvi: src/%.tex $(GFX)
	$(LATEX) $< >/dev/null
	if [ -e $*.toc ] ; then $(LATEX) $< >/dev/null ; fi

%.eps: %.fig
	$(FIG2DEV) -L eps $< $@

html/%/index.html: src/%.tex
	$(INSTALL_DIR) $(@D)
	$(LATEX2HTML) -split 0 -show_section_numbers -toc_depth 3 -nonavigation \
	-numbered_footnotes -local_icons -noinfo -math -dir $(@D) \
	$< 1>/dev/null 2>/dev/null