aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/asciidoc.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-05-07 21:00:53 +0300
committerLoïc Hoguin <[email protected]>2015-05-07 21:00:53 +0300
commit030041dc06f80371aecc929e43fdf870d1f09973 (patch)
tree91a1eb56f954f8598a679d8589a6c7c494fc15a8 /plugins/asciidoc.mk
parent49ffed442a9e01e79e3561da1f92f77bad1d38cd (diff)
downloaderlang.mk-030041dc06f80371aecc929e43fdf870d1f09973.tar.gz
erlang.mk-030041dc06f80371aecc929e43fdf870d1f09973.tar.bz2
erlang.mk-030041dc06f80371aecc929e43fdf870d1f09973.zip
Add Asciidoc documentation support
Diffstat (limited to 'plugins/asciidoc.mk')
-rw-r--r--plugins/asciidoc.mk46
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/asciidoc.mk b/plugins/asciidoc.mk
new file mode 100644
index 0000000..baf4d3b
--- /dev/null
+++ b/plugins/asciidoc.mk
@@ -0,0 +1,46 @@
+# Copyright (c) 2015, Loïc Hoguin <[email protected]>
+# This file is part of erlang.mk and subject to the terms of the ISC License.
+
+.PHONY: asciidoc asciidoc-guide asciidoc-manual install-asciidoc distclean-asciidoc
+
+MAN_INSTALL_PATH ?= /usr/local/share/man
+MAN_SECTIONS ?= 3 7
+
+docs:: asciidoc
+
+asciidoc: distclean-asciidoc doc-deps asciidoc-guide asciidoc-manual
+
+ifeq ($(wildcard doc/src/guide/book.asciidoc),)
+asciidoc-guide:
+else
+asciidoc-guide:
+ a2x -v -f pdf doc/src/guide/book.asciidoc && mv doc/src/guide/book.pdf doc/guide.pdf
+ a2x -v -f chunked doc/src/guide/book.asciidoc && mv doc/src/guide/book.chunked/ doc/html/
+endif
+
+ifeq ($(wildcard doc/src/manual/*.asciidoc),)
+asciidoc-manual:
+else
+asciidoc-manual:
+ for f in doc/src/manual/*.asciidoc ; do \
+ a2x -v -f manpage $$f ; \
+ done
+ for s in $(MAN_SECTIONS); do \
+ mkdir -p doc/man$$s/ ; \
+ mv doc/src/manual/*.$$s doc/man$$s/ ; \
+ gzip doc/man$$s/*.$$s ; \
+ done
+
+install-docs:: install-asciidoc
+
+install-asciidoc: asciidoc-manual
+ for s in $(MAN_SECTIONS); do \
+ mkdir -p $(MAN_INSTALL_PATH)/man$$s/ ; \
+ install -g 0 -o 0 -m 0644 doc/man$$s/*.gz $(MAN_INSTALL_PATH)/man$$s/ ; \
+ done
+endif
+
+distclean:: distclean-asciidoc
+
+distclean-asciidoc:
+ $(gen_verbose) rm -rf doc/html/ doc/guide.pdf doc/man3/ doc/man7/