forked from crystal-lang/shards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.mk
35 lines (25 loc) · 1012 Bytes
/
docs.mk
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
ASCIIDOC ?= asciidoctor
ASCIIDOC_OPTIONS = -a shards_version=$(SHARDS_VERSION)
MAN_FILES := man/shards.1 man/shard.yml.5
HTML_FILES := docs/shards.html docs/shard.yml.html
SHARDS_VERSION := $(shell cat VERSION)
SOURCE_DATE_EPOCH := $(shell (git show -s --format=%ct HEAD || stat -c "%Y" Makefile || stat -f "%m" Makefile) 2> /dev/null)
.PHONY: docs
docs: ## Build documentation
docs: manpages
.PHONY: manpages
manpages: ## Generate manpages from adoc
manpages: $(MAN_FILES)
.PHONY: htmlpages
htmlpages: ## Generate HTML files from adoc
htmlpages: $(HTML_FILES)
man/%.1: docs/%.adoc
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) $(ASCIIDOC) $(ASCIIDOC_OPTIONS) $< -b manpage -o $@
man/%.5: docs/%.adoc
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) $(ASCIIDOC) $(ASCIIDOC_OPTIONS) $< -b manpage -o $@
docs/%.html: docs/%.adoc
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) $(ASCIIDOC) $(ASCIIDOC_OPTIONS) $< -b html5 -o $@
.PHONY: clean_docs
clean_docs: ## Remove documentation data
rm -f $(MAN_FILES)
rm -rf docs/*.html