aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c6fca9290530bfb5f2cb5c1de4dd98a78c30ea65 (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# See LICENSE for licensing information.

PROJECT = asciideck
PROJECT_DESCRIPTION = Asciidoc for Erlang.
PROJECT_VERSION = 0.2.0

# Dependencies.

TEST_ERLC_OPTS += +'{parse_transform, eunit_autoexport}'
TEST_DEPS = $(if $(CI_ERLANG_MK),ci.erlang.mk) ct_helper
dep_ct_helper = git https://github.com/ninenines/ct_helper master

# CI configuration.

dep_ci.erlang.mk = git https://github.com/ninenines/ci.erlang.mk master
DEP_EARLY_PLUGINS = ci.erlang.mk

AUTO_CI_OTP ?= OTP-19+
AUTO_CI_HIPE ?= OTP-LATEST
# AUTO_CI_ERLLVM ?= OTP-LATEST
AUTO_CI_WINDOWS ?= OTP-19+

include erlang.mk

# Test building documentation of projects that use Asciideck
# and run Groff checks against the output.
#
# We only run against asciidoc-manual because the guide requires
# the DocBook toolchain at this time.

.PHONY: groff

GROFF_PROJECTS = cowboy gun ranch

tests:: groff

groff: $(addprefix groff-,$(GROFF_PROJECTS))

$(ERLANG_MK_TMP)/groff:
	$(verbose) mkdir -p $@

define groff_targets
$(ERLANG_MK_TMP)/groff/$1: | $(ERLANG_MK_TMP)/groff
	$(verbose) rm -rf $$@
	$(verbose) git clone -q --depth 1 -- $(call dep_repo,$1) $$@
	$(verbose) mkdir $$@/deps
	$(verbose) ln -s $(CURDIR) $$@/deps/asciideck
	$(verbose) touch $$@/deps/ci.erlang.mk
	$(verbose) cp $(CURDIR)/erlang.mk $$@/

groff-$1: $(ERLANG_MK_TMP)/groff/$1 app
	$(gen_verbose) $(MAKE) -C $$< asciidoc-manual MAKEFLAGS= DEPS_DIR=$$</deps ERL_LIBS=$$</deps
	$(verbose) for f in $$</doc/man*/*.gz; do \
		echo " GROFF " `basename "$$$$f"`; \
		zcat "$$$$f" | groff -man -rD1 -z -ww; \
	done
endef

$(foreach p,$(GROFF_PROJECTS),$(eval $(call groff_targets,$p)))