Repository navigation
Expand file tree
/
Copy pathflat.mk
More file actions
87 lines (78 loc) · 2.6 KB
/
Copy pathflat.mk
File metadata and controls
87 lines (78 loc) · 2.6 KB
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
# Flat project layout:
#
# wg21-papers/
# |-- wg21 (submodule)
# |-- Makefile
# |-- p2806r4.md
# |-- p2996r13.md
# `-- generated/
# |-- p2806r4.html
# `-- p2996r13.html
#
# From the top-level Makefile:
#
# include path/to/wg21/flat.mk
#
# With that in place, the following commands are available:
#
# make p2806r4.html # builds generated/p2806r4.html from p2806r4.md
# make p2806r4.latex # builds generated/p2806r4.latex from p2806r4.md
# make p2806r4.pdf # builds generated/p2806r4.pdf from p2806r4.md
#
# make # builds all the papers in DEFAULT_FORMAT (HTML by default)
# make html # builds all the papers in HTML format
# make latex # builds all the papers in LaTeX format
# make pdf # builds all the papers in PDF format
#
# make serve p2806r4.html # rebuilds and live-reloads generated/p2806r4.html
# make serve p2806r4.pdf # rebuilds generated/p2806r4.pdf
# make serve # rebuilds and serves all papers in DEFAULT_FORMAT
#
# make clean # deletes generated files
#
# The following variables can be set before including this file:
#
# - OUTDIR := <path/to/directory>
#
# Build the papers to the specified directory instead of `generated`
#
# - DEFAULT_FORMAT := <html|pdf|latex>
#
# Default format built by `make` with no explicit target.
#
# - DEFAULTS := <path/to/defaults.yaml>
#
# Passed to Pandoc as an additional defaults file.
# If a top-level `defaults.yaml` file exists, it will be used automatically.
#
# - REQUIREMENTS := <path/to/requirements.txt>
#
# Passed to Python virtual env to install additional packages.
# If a top-level `requirements.txt` file exists, it will be used automatically.
OUTDIR ?= generated
DEFAULT_FORMAT ?= html
ifneq ($(filter $(DEFAULT_FORMAT),html pdf latex),$(DEFAULT_FORMAT))
$(error DEFAULT_FORMAT must be one of html, pdf, latex)
endif
DEFAULTS ?= $(wildcard defaults.yaml)
REQUIREMENTS ?= $(wildcard requirements.txt)
src := $(filter-out \
CHANGELOG.md LICENSE.md README.md %.slides.md, \
$(wildcard *.md))
html_targets := $(src:.md=.html)
pdf_targets := $(src:.md=.pdf)
latex_targets := $(src:.md=.latex)
targets := $(html_targets) $(pdf_targets) $(latex_targets)
.PHONY: all html pdf latex
all: $(DEFAULT_FORMAT)
html: $(html_targets)
pdf: $(pdf_targets)
latex: $(latex_targets)
include $(dir $(lastword $(MAKEFILE_LIST)))base.mk
# Automatic rules to handle, e.g. `p2688r0.html : p2688r0.md`.
$(OUTDIR)/%.html: %.md $(DEPS) | $(OUTDIR)
$(PANDOC)
$(OUTDIR)/%.latex: %.md $(DEPS) | $(OUTDIR)
$(PANDOC)
$(OUTDIR)/%.pdf: %.md $(DEPS) | $(OUTDIR)
$(PANDOC)