-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (38 loc) · 1.38 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
#
# Author: Jake Zimmerman <jake@zimmerman.io>
#
# ===== Usage ================================================================
#
# make Prepare public/ folder (all markdown & assets)
# make public/index.html Recompile just public/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 pages -type f -name '*.md') README.md
TARGETS := $(patsubst %.md,public/%.html,$(patsubst README.md,index.md,$(SOURCES)))
.PHONY: all
all: public/.nojekyll $(TARGETS) public/index.html
.PHONY: clean
clean:
rm -rf public
.PHONY: watch
watch:
./tools/serve.sh --watch
public/.nojekyll: $(wildcard public/*) public/.nojekyll
rm -vrf public/{css,fonts,img} && mkdir -p public/pages && cp -vr assets/.nojekyll assets/* public
.PHONY: public
public: public/.nojekyll
sources:
@echo $(SOURCES)
list:
@echo $(TARGETS)
# Generalized rule: how to build a .html file from each .md
# Note: you will need pandoc 2 or greater for this to work
public/pages/%.html: pages/%.md template.html5 Makefile tools/build.sh public/.nojekyll
tools/build.sh "$<" "$@"
public/index.html: README.md template.html5 Makefile tools/build.sh public/.nojekyll
tools/build.sh "$<" "$@"