summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Finney <ben@benfinney.id.au>2016-03-04 16:06:17 +1100
committerBen Finney <ben@benfinney.id.au>2016-03-04 16:06:17 +1100
commitcafc46a8e92abcd4efb6399c42ee975140cc4b4a (patch)
tree3d34db5903b96304385b2052beb05a15bbd44a8c
parent5993b178c559838e5963d87ba5cc4aa0dcdef2fa (diff)
downloadinfinitytier-cafc46a8e92abcd4efb6399c42ee975140cc4b4a.tar.gz
infinitytier-cafc46a8e92abcd4efb6399c42ee975140cc4b4a.zip
Add Makefile module for building documentation.
-rw-r--r--doc/module.mk48
-rw-r--r--make-linux.mk7
2 files changed, 55 insertions, 0 deletions
diff --git a/doc/module.mk b/doc/module.mk
new file mode 100644
index 00000000..581d06c0
--- /dev/null
+++ b/doc/module.mk
@@ -0,0 +1,48 @@
+# doc/module.mk
+# Part of ZeroTier One, a software-defined network layer.
+#
+# Copyright © 2016 Ben Finney <ben+zerotier@benfinney.id.au>
+# This is free software: you may copy, modify, and/or distribute this
+# work under the terms of the GNU General Public License, version 3 or
+# later as published by the Free Software Foundation.
+# No warranty expressed or implied.
+# See the file ‘LICENSE.txt’ for details.
+
+# Makefile module for ZeroTier One documentation.
+
+TEMPFILE_SUFFIX = .tmp
+.INTERMEDIATE: ${DOCUMENTATION_DIR}/*${TEMPFILE_SUFFIX}
+
+RST_SUFFIX = .txt
+manpage_sections = 1 2 3 4 5 6 7 8
+manpage_names += zerotier-one.8
+manpage_names += zerotier-idtool.1
+manpage_names += zerotier-cli.1
+manpage_source_paths = $(addprefix ${DOC_DIR}/, \
+ $(addsuffix ${RST_SUFFIX},${manpage_names}))
+manpage_paths = $(addprefix ${DOC_DIR}/,${manpage_names})
+manpage_encoding_stub = ${DOC_DIR}/manpage_encoding_declaration.UTF-8
+
+GENERATED_FILES += $(addprefix ${DOC_DIR}/,\
+ $(foreach section,${manpage_sections},*.${section}))
+
+RST2MAN = rst2man
+RST2MAN_OPTS =
+
+.PHONY: manpages
+manpages: ${manpage_paths}
+
+%.1: %.1${RST_SUFFIX}
+ $(RST2MAN) "$<" > "$@"${TEMPFILE_SUFFIX}
+ cat ${manpage_encoding_stub} "$@"${TEMPFILE_SUFFIX} > "$@"
+
+%.8: %.8${RST_SUFFIX}
+ $(RST2MAN) "$<" > "$@"${TEMPFILE_SUFFIX}
+ cat ${manpage_encoding_stub} "$@"${TEMPFILE_SUFFIX} > "$@"
+
+
+# Local variables:
+# coding: utf-8
+# mode: makefile
+# End:
+# vim: fileencoding=utf-8 filetype=make :
diff --git a/make-linux.mk b/make-linux.mk
index 3704c4ac..bb621359 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -17,6 +17,8 @@
# clean: removes all built files, objects, other trash
#
+GENERATED_FILES :=
+
# Automagically pick clang or gcc, with preference for clang
# This is only done if we have not overridden these with an environment or CLI variable
ifeq ($(origin CC),default)
@@ -115,6 +117,7 @@ installer: one FORCE
./ext/installfiles/linux/buildinstaller.sh
clean: FORCE
+ $(RM) -r ${GENERATED_FILES}
rm -rf *.so *.o netcon/*.a node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o $(OBJS) zerotier-one zerotier-idtool zerotier-cli zerotier-selftest zerotier-netcon-service build-* ZeroTierOneInstaller-* *.deb *.rpm .depend netcon/.depend
# Remove files from all the funny places we put them for tests
find netcon -type f \( -name '*.o' -o -name '*.so' -o -name '*.1.0' -o -name 'zerotier-one' -o -name 'zerotier-cli' -o -name 'zerotier-netcon-service' \) -delete
@@ -129,3 +132,7 @@ official: FORCE
make ZT_OFFICIAL_RELEASE=1 installer
FORCE:
+
+DOC_DIR = doc
+
+include ${DOC_DIR}/module.mk