-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (32 loc) · 1.03 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
#
# Author: Jake Zimmerman <[email protected]>
#
# ===== 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 $(TARGETS)
.PHONY: clean
clean:
rm -rf docs
.PHONY: watch
watch:
./tools/serve.sh --watch
.PHONY: docs
docs:
rm -vrf docs && mkdir -p docs && cp -vr public/* docs
echo "azarkin.dev" > docs/CNAME
# 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 "$<" "$@"