-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (38 loc) · 1.81 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
PYTHON ?= python3
PANDOC_MAN_OPTS = --metadata=pandoc-version:false --metadata=hyphenate:true
# Doc sources in DOCSDIR -> doc output in DATADIR
DOCSDIR = docs
DATADIR = data
# If any of these files are changed, update the datestamp:
DOC_SRC = $(addprefix $(DOCSDIR)/,video-dl.1.rst VideoDL.conf.5.rst include/SYNOPSIS.rst include/OPTIONS.rst include/CONFIGKEYS.rst)
METADATA = $(DATADIR)/version.yaml $(DATADIR)/date.yaml
PANDOC_METADATA_OPTS = $(addprefix --metadata-file=, $(METADATA))
docs: $(DATADIR)/MANUAL.txt $(DATADIR)/video-dl.1.gz $(DATADIR)/VideoDL.conf.5.gz
clean:
rm -rf $(DATADIR)
%.gz: %
gzip -9 -c $< > $@
$(DATADIR)/video-dl.1: $(DOCSDIR)/video-dl.1.rst $(METADATA) $(DOCSDIR)/include/SYNOPSIS.rst $(DOCSDIR)/include/OPTIONS.rst | $(DATADIR)
pandoc --to "man" --standalone \
$(PANDOC_MAN_OPTS) $(PANDOC_METADATA_OPTS) \
--metadata-file=$(DOCSDIR)/video-dl.1.yaml \
$(DOCSDIR)/video-dl.1.rst -o $(DATADIR)/video-dl.1
$(DATADIR)/VideoDL.conf.5: $(DOCSDIR)/VideoDL.conf.5.rst $(METADATA) $(DOCSDIR)/include/CONFIGKEYS.rst | $(DATADIR)
pandoc --to "man" --standalone \
$(PANDOC_MAN_OPTS) $(PANDOC_METADATA_OPTS) \
--metadata-file=$(DOCSDIR)/VideoDL.conf.5.yaml \
$(DOCSDIR)/VideoDL.conf.5.rst -o $(DATADIR)/VideoDL.conf.5
$(DATADIR)/version.yaml: video_dl.py | $(DATADIR)
$(PYTHON) scripts/get_version.py video_dl.py > $(DATADIR)/version.yaml
$(DATADIR)/date.yaml: $(DOC_SRC) | $(DATADIR)
$(PYTHON) scripts/get_mtime.py $(DOC_SRC) > $(DATADIR)/date.yaml
# Cross-platform, readable summary of the above
$(DATADIR)/MANUAL.txt: $(DOCSDIR)/Manual.rst $(METADATA) | $(DATADIR)
pandoc --to "plain" --standalone \
$(METADATA) $(DOCSDIR)/Manual.rst -o $(DATADIR)/MANUAL.txt
$(DATADIR):
mkdir -p $(DATADIR)
test:
$(PYTHON) -m doctest video_dl.py
$(PYTHON) -m unittest tests/test*.py
.PHONY: docs clean test