Makefile 1.72 KB
Newer Older
Moritz Lipp's avatar
Moritz Lipp committed
1 2 3 4
# See LICENSE file for license and copyright information
#
include ../config.mk
include ../common.mk
Moritz Lipp's avatar
Moritz Lipp committed
5
include ../colors.mk
Moritz Lipp's avatar
Moritz Lipp committed
6 7
include config.mk

8
MAN_SOURCES=$(wildcard man/*.rst) $(wildcard man/*.txt) man/conf.py
Sebastian Ramacher's avatar
Sebastian Ramacher committed
9
DOXYGEN_SOURCES=$(wildcard ../zathura/*.h) Doxyfile
Moritz Lipp's avatar
Moritz Lipp committed
10
HTML_SOURCES=$(wildcard *.rst api/*.rst configuration/*.rst installation/*.rst usage/*.rst) conf.py
11 12 13 14

SPHINX_OPTS+=-d $(SPHINX_BUILDDIR)/doctrees

all: man html
Moritz Lipp's avatar
Moritz Lipp committed
15 16

clean:
Moritz Lipp's avatar
Moritz Lipp committed
17
	$(call colorecho,RM,doc/$(SPHINX_BUILDDIR))
Moritz Lipp's avatar
Moritz Lipp committed
18 19
	$(QUIET)rm -rf $(SPHINX_BUILDDIR)/

20
$(SPHINX_BUILDDIR)/html/index.html: $(HTML_SOURCES) $(SPHINX_BUILDDIR)/doxygen/xml/index.xml
21
	$(QUIET)mkdir -p $(SPHINX_BUILDDIR)/html
Moritz Lipp's avatar
Moritz Lipp committed
22
	$(call colorecho,DOC,"Build HTML documentation")
23
	$(QUIET)$(SPHINX_BIN) -b html $(SPHINX_OPTS) . $(SPHINX_BUILDDIR)/html
Moritz Lipp's avatar
Moritz Lipp committed
24

25
$(SPHINX_BUILDDIR)/zathura.1: $(MAN_SOURCES)
26
	$(QUIET)mkdir -p $(SPHINX_BUILDDIR)
Moritz Lipp's avatar
Moritz Lipp committed
27
	$(call colorecho,DOC,"Build man pages")
28
	$(QUIET)$(SPHINX_BIN) -b man $(SPHINX_OPTS) man $(SPHINX_BUILDDIR)
Moritz Lipp's avatar
Moritz Lipp committed
29

30 31 32 33 34 35
$(SPHINX_BUILDDIR)/zathurarc.5: $(SPHINX_BUILDDIR)/zathura.1
	@if test -f $@; then :; else \
		rm -f $(SPHINX_BUILDDIR)/zathura.1; \
		$(MAKE) $(SPHINX_BUILDDIR)/zathura.1; \
	fi

36
$(SPHINX_BUILDDIR)/doxygen/xml/index.xml: $(DOXYGEN_SOURCES)
37
	$(QUIET)mkdir -p $(SPHINX_BUILDDIR)/doxygen/xml
Moritz Lipp's avatar
Moritz Lipp committed
38
	$(call colorecho,DOC,"Run doxygen")
Moritz Lipp's avatar
Moritz Lipp committed
39 40
	$(QUIET)$(DOXYGEN_BIN) Doxyfile

41 42 43 44 45 46
ifeq ($(shell which $(SPHINX_BIN) >/dev/null 2>&1; echo $$?), 1)
man:
html:
else
man: $(SPHINX_BUILDDIR)/zathura.1 $(SPHINX_BUILDDIR)/zathurarc.5

Sebastian Ramacher's avatar
Sebastian Ramacher committed
47 48
# TODO: Make a better test for breathe and sphinx_rtd_theme
ifeq ($(shell which $(DOXYGEN_BIN) >/dev/null 2>&1 && $(PYTHON_BIN) -c "import breathe; import sphinx_rtd_theme" >/dev/null 2>&1; echo $$?), 0)
49 50 51 52 53 54 55
html: $(SPHINX_BUILDDIR)/html/index.html
else
html:
endif
endif

.PHONY: clean html man all