[34] | 1 | #!/usr/bin/make -f |
---|
| 2 | |
---|
| 3 | XEN_ROOT=.. |
---|
| 4 | include $(XEN_ROOT)/Config.mk |
---|
| 5 | include $(XEN_ROOT)/docs/Docs.mk |
---|
| 6 | |
---|
| 7 | VERSION = xen-unstable |
---|
| 8 | |
---|
| 9 | DOC_MAN5SRC := $(wildcard man/*.pod.5) |
---|
| 10 | DOC_MAN1SRC := $(wildcard man/*.pod.1) |
---|
| 11 | DOC_MAN1 := $(patsubst man/%.pod.1,man1/%.1,$(DOC_MAN1SRC)) |
---|
| 12 | DOC_MAN5 := $(patsubst man/%.pod.5,man5/%.5,$(DOC_MAN5SRC)) |
---|
| 13 | DOC_TEX := src/user.tex src/interface.tex |
---|
| 14 | DOC_PS := $(patsubst src/%.tex,ps/%.ps,$(DOC_TEX)) |
---|
| 15 | DOC_PDF := $(patsubst src/%.tex,pdf/%.pdf,$(DOC_TEX)) |
---|
| 16 | DOC_HTML := $(patsubst src/%.tex,html/%/index.html,$(DOC_TEX)) |
---|
| 17 | |
---|
| 18 | GFX = $(patsubst %.fig, %.eps, $(wildcard figs/*.fig)) |
---|
| 19 | |
---|
| 20 | .PHONY: all |
---|
| 21 | all: build |
---|
| 22 | |
---|
| 23 | .PHONY: build |
---|
| 24 | build: ps pdf html man-pages |
---|
| 25 | @if which $(DOT) 1>/dev/null 2>/dev/null ; then \ |
---|
| 26 | $(MAKE) -C xen-api build ; else \ |
---|
| 27 | echo "Graphviz (dot) not installed; skipping xen-api." ; fi |
---|
| 28 | rm -f *.aux *.dvi *.bbl *.blg *.glo *.idx *.ilg *.log *.ind *.toc |
---|
| 29 | |
---|
| 30 | .PHONY: dev-docs |
---|
| 31 | dev-docs: python-dev-docs |
---|
| 32 | |
---|
| 33 | .PHONY: ps |
---|
| 34 | ps: $(DOC_PS) |
---|
| 35 | |
---|
| 36 | .PHONY: pdf |
---|
| 37 | pdf: $(DOC_PDF) |
---|
| 38 | |
---|
| 39 | .PHONY: html |
---|
| 40 | html: |
---|
| 41 | @if which $(LATEX2HTML) 1>/dev/null 2>/dev/null; then \ |
---|
| 42 | $(MAKE) $(DOC_HTML); fi |
---|
| 43 | |
---|
| 44 | .PHONY: python-dev-docs |
---|
| 45 | python-dev-docs: |
---|
| 46 | @mkdir -v -p api/tools/python |
---|
| 47 | @if which $(DOXYGEN) 1>/dev/null 2>/dev/null; then \ |
---|
| 48 | echo "Running doxygen to generate Python tools APIs ... "; \ |
---|
| 49 | $(DOXYGEN) Doxyfile; \ |
---|
| 50 | $(MAKE) -C api/tools/python/latex ; else \ |
---|
| 51 | echo "Doxygen not installed; skipping python-dev-docs."; fi |
---|
| 52 | |
---|
| 53 | .PHONY: man-pages |
---|
| 54 | man-pages: |
---|
| 55 | @if which $(POD2MAN) 1>/dev/null 2>/dev/null; then \ |
---|
| 56 | $(MAKE) $(DOC_MAN1) $(DOC_MAN5); fi |
---|
| 57 | |
---|
| 58 | man1/%.1: man/%.pod.1 Makefile |
---|
| 59 | $(INSTALL_DIR) $(@D) |
---|
| 60 | $(POD2MAN) --release=$(VERSION) --name=`echo $@ | sed 's/^man1.//'| \ |
---|
| 61 | sed 's/.1//'` -s 1 -c "Xen" $< $@ |
---|
| 62 | |
---|
| 63 | man5/%.5: man/%.pod.5 Makefile |
---|
| 64 | $(INSTALL_DIR) $(@D) |
---|
| 65 | $(POD2MAN) --release=$(VERSION) --name=`echo $@ | sed 's/^man5.//'| \ |
---|
| 66 | sed 's/.5//'` -s 5 -c "Xen" $< $@ |
---|
| 67 | |
---|
| 68 | .PHONY: clean |
---|
| 69 | clean: |
---|
| 70 | $(MAKE) -C xen-api clean |
---|
| 71 | rm -rf .word_count *.aux *.dvi *.bbl *.blg *.glo *.idx *~ |
---|
| 72 | rm -rf *.ilg *.log *.ind *.toc *.bak core |
---|
| 73 | rm -rf $(GFX) ps pdf html |
---|
| 74 | rm -rf api |
---|
| 75 | rm -rf man5 |
---|
| 76 | rm -rf man1 |
---|
| 77 | |
---|
| 78 | .PHONY: distclean |
---|
| 79 | distclean: clean |
---|
| 80 | |
---|
| 81 | .PHONY: install |
---|
| 82 | install: all |
---|
| 83 | rm -rf $(DESTDIR)$(pkgdocdir) |
---|
| 84 | $(INSTALL_DIR) $(DESTDIR)$(pkgdocdir) |
---|
| 85 | |
---|
| 86 | $(MAKE) -C xen-api install |
---|
| 87 | |
---|
| 88 | cp -dR ps $(DESTDIR)$(pkgdocdir) |
---|
| 89 | cp -dR pdf $(DESTDIR)$(pkgdocdir) |
---|
| 90 | $(INSTALL_DIR) $(DESTDIR)$(mandir) |
---|
| 91 | cp -dR man1 $(DESTDIR)$(mandir) |
---|
| 92 | cp -dR man5 $(DESTDIR)$(mandir) |
---|
| 93 | [ ! -d html ] || cp -dR html $(DESTDIR)$(pkgdocdir) |
---|
| 94 | |
---|
| 95 | pdf/%.pdf: ps/%.ps |
---|
| 96 | $(INSTALL_DIR) $(@D) |
---|
| 97 | $(PS2PDF) $< $@.new |
---|
| 98 | mv $@.new $@ |
---|
| 99 | |
---|
| 100 | ps/%.ps: %.dvi |
---|
| 101 | $(INSTALL_DIR) $(@D) |
---|
| 102 | $(DVIPS) -Ppdf -G0 -o $@.new $< |
---|
| 103 | mv $@.new $@ |
---|
| 104 | |
---|
| 105 | %.dvi: src/%.tex $(GFX) |
---|
| 106 | $(LATEX) $< >/dev/null |
---|
| 107 | if [ -e $*.toc ] ; then $(LATEX) $< >/dev/null ; fi |
---|
| 108 | |
---|
| 109 | %.eps: %.fig |
---|
| 110 | $(FIG2DEV) -L eps $< $@ |
---|
| 111 | |
---|
| 112 | html/%/index.html: src/%.tex |
---|
| 113 | $(INSTALL_DIR) $(@D) |
---|
| 114 | $(LATEX2HTML) -split 0 -show_section_numbers -toc_depth 3 -nonavigation \ |
---|
| 115 | -numbered_footnotes -local_icons -noinfo -math -dir $(@D) \ |
---|
| 116 | $< 1>/dev/null 2>/dev/null |
---|