+# Copyright 2016 Philippe Proulx <pproulx@efficios.com>
+
CONF = asciidoc.html5.conf
PREFIX = lttng-docs
-ALLVERSIONS = 2.5 2.6 2.7
+ALLVERSIONS = $(sort $(wildcard 2.*))
+ALLCHECK = $(foreach v, $(ALLVERSIONS), check-$(v))
ASCIIDOC = asciidoc -v -f $(CONF) -a source-highlighter=pygments
RM = rm -rf
-htmldst = $(1)/$(PREFIX)-$(1).html
+define vrule
+$(1)/$(PREFIX)-$(1).html: $(1)/$(PREFIX)-$(1).txt $(CONF)
+ $(ASCIIDOC) -a "lttng_version=$(1)" $(1)/$(PREFIX)-$(1).txt
-.PHONY: all
+.PHONY: $(1)
-all: $(ALLVERSIONS)
+$(1): $(1)/$(PREFIX)-$(1).html
+
+view-$(1):
+ xdg-open $(1)/$(PREFIX)-$(1).html
+
+.PHONY: view-$(1)
-.PHONY: $(ALLVERSIONS)
+check-$(1): $(1)/$(PREFIX)-$(1).txt $(CONF)
+ python3 tools/check.py $(1)/$(PREFIX)-$(1).txt
-2.5: $(call htmldst,2.5)
+.PHONY: check-$(1)
+endef
+
+.PHONY: all
+
+all: $(ALLVERSIONS)
-2.6: $(call htmldst,2.6)
+$(foreach v,$(ALLVERSIONS),$(eval $(call vrule,$(v))))
-2.7: $(call htmldst,2.7)
+.PHONY: check
-%.html: %.txt $(CONF)
- $(ASCIIDOC) $<
+check: $(ALLCHECK)
.PHONY: clean
clean:
- $(RM) $(foreach version,$(ALLVERSIONS),$(call htmldst,$(version)))
+ $(RM) $(foreach v,$(ALLVERSIONS),$(v)/$(PREFIX)-$(v).html)