-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Makefile
90 lines (66 loc) · 1.88 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#! /bin/bash -m
# Author.: Anonymous Planet
# License.: CC BY-NC 4.0
# Setup shell
# https://github.com/QubesOS/qubes-issues/issues/8343
# if the default shell ($SHELL) is zsh, else use bash
ifneq ($(shell echo $$SHELL | grep -q 'zsh' && echo zsh), zsh)
SHELL := /bin/bash # using standard shell
else
SHELL := /bin/zsh # else use zsh (Whonix)
endif
ifneq ($(shell which safe-rm), /usr/bin/safe-rm)
RM := /usr/bin/rm # using standard rm
else
RM := /usr/share/safe-rm/bin/rm # else use safe rm
endif
# Paths
BUILD_DIR := ./export
PANDOC=/usr/bin/pandoc
PANDOC_OPTIONS=--smart --standalone
SOURCE_DOCS := $(wildcard *.md)
# converts: e.g., verify.md -> verify.html
EXPORTED_DOCS=\
$(SOURCE_DOCS:.md=.html) \
$(SOURCE_DOCS:.md=.pdf) \
$(SOURCE_DOCS:.md=.docx) \
$(SOURCE_DOCS:.md=.rtf) \
$(SOURCE_DOCS:.md=.odt) \
$(SOURCE_DOCS:.md=.epub)
PANDOC=/usr/bin/pandoc
PANDOC_OPTIONS=--standalone --metadata title="The Hitchhiker's Guide to Online Anonymity" -t context
PANDOC_HTML_OPTIONS=--to html5
PANDOC_PDF_OPTIONS=
PANDOC_DOCX_OPTIONS=
PANDOC_RTF_OPTIONS=
PANDOC_ODT_OPTIONS=
PANDOC_EPUB_OPTIONS=--to epub3
# TODO: Makefile flags
.PHONY: clean sigs docs
# target: cleanup
clean:
-$(RM) -drf $(BUILD_DIR)/*
-$(RM) -rf *sum*
-$(RM) -rf *.md.asc
-$(RM) -rf *.txt.asc
-$(RM) -rf *.md.minisig
-$(RM) -rf *.txt.minisig
-$(RM) -f $(EXPORTED_DOCS)
# target: signatures
sigs:
mkdir -p export
./sigs.sh
# target: documentation
docs:
%.html : %.md
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_HTML_OPTIONS) -o $@ $<
%.pdf : %.md
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_PDF_OPTIONS) -o $@ $<
%.docx : %.md
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_DOCX_OPTIONS) -o $@ $<
%.rtf : %.md
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_RTF_OPTIONS) -o $@ $<
%.odt : %.md
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_ODT_OPTIONS) -o $@ $<
%.epub : %.md
$(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_EPUB_OPTIONS) -o $@ $<