-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
67 lines (45 loc) · 1.12 KB
/
Makefile
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
60
61
62
63
64
65
66
67
# DIRECTORIES
# ===========
BASE_DIR := test
DATA_DIR := $(BASE_DIR)/docs
NORM_DIR := $(BASE_DIR)/norms
TEMP_DIR := $(BASE_DIR)/tmp
# PROGRAMMES
# ==========
MKDIR ?= mkdir
PANDOC ?= pandoc
RM ?= rm
SHELL ?= sh
# FILES
# =====
FILTER ?= ./pandoc-quotes.lua
# DOCUMENTS
# =========
DOCS = $(wildcard $(DATA_DIR)/*.md)
TESTS = $(notdir $(DOCS:.md=))
all: lint test
test: $(TESTS)
$(TESTS): tempdir
$(PANDOC) -f markdown -t plain -L $(FILTER) \
-o $(TEMP_DIR)/$@.txt $(DATA_DIR)/$@.md
@diff $(TEMP_DIR)/$@.txt $(NORM_DIR)/$@.txt
lint:
@luacheck $(FILTER) || [ $$? -eq 127 ]
tempdir:
@$(RM) -rf $(TEMP_DIR)
@$(MKDIR) -p $(TEMP_DIR)
%.1: %.rst
$(PANDOC) -f rst -t man -s --output=$@ \
--metadata=title=$(notdir $*) \
--metadata=section=1 \
--metadata=date="$$(date '+%B %d, %Y')" \
$*.rst
%.1.gz: %.1
gzip --force $<
%.lua: man/man1/%.lua.rst
$(SHELL) scripts/header-add-man -f $@
doc/index.html: $(FILTER) README.md doc/config.ld
ldoc -c doc/config.ld .
man: man/man1/$(FILTER).lua.1.gz
docs: man/man1/$(FILTER).lua.1.gz $(FILTER) doc/index.html
.PHONY: all docs lint man test tempdir $(TESTS)