forked from jez/pandoc-markdown-css-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (34 loc) · 1.15 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
#
# Author: Jake Zimmerman <jake@zimmerman.io>
#
# ===== Usage ================================================================
#
# make Prepare docs/ folder (all markdown & assets)
# make docs/index.html Recompile just docs/index.html
#
# make watch Start a local HTTP server and rebuild on changes
# PORT=4242 make watch Like above, but use port 4242
#
# make clean Delete all generated files
#
# ============================================================================
SOURCES := $(shell find src -type f -name '*.md')
TARGETS := $(patsubst src/%.md,docs/%.html,$(SOURCES))
.PHONY: all
all: docs/.nojekyll $(TARGETS)
.PHONY: clean
clean:
rm -rf docs
.PHONY: watch
watch:
./tools/serve.sh --watch
docs/.nojekyll: $(wildcard public/*) public/.nojekyll
rm -vrf docs && mkdir -p docs && cp -vr public/.nojekyll public/* docs
.PHONY: docs
docs: docs/.nojekyll
# Generalized rule: how to build a .html file from each .md
# Note: you will need pandoc 2 or greater for this to work
docs/%.html: src/%.md template.html5 Makefile tools/build.sh
tools/build.sh "$<" "$@"
docs/%.pdf: src/%.md Makefile
pandoc "$<" -o "$@"