aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 3eca455b3d8e6bc6b350667c94b4515a65092d95 (plain) (blame)
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
title="Style Guide"
subtitle="Software Engineering at Driver"
url=https://github.com/drivergroup/best-practices/blob/master
git_url=git@github.com:drivergroup/best-practices.git

ghpages=.gh-pages

markdown=$(wildcard guides/*.md)
html_out=$(addprefix $(ghpages)/, $(notdir $(markdown:.md=.html)))


all: $(html_out)

$(ghpages):
	mkdir $(ghpages)
	cp -r assets $(ghpages)


$(ghpages)/%.html: guides/%.md $(ghpages)
	pandoc \
		--standalone \
		--template=layout.html \
		--from=markdown \
		--to=html5 \
		--metadata=title:$(title) \
		--metadata=subtitle:$(subtitle) \
		--metadata=date:$$(date --iso) \
		--variable=url:$(url) \
		--out=$@ $<

publish: $(html_out)
	git -C $(ghpages) init
	git -C $(ghpages) add .
	git -C $(ghpages) commit -m "Publish website" || true
	git -C $(ghpages) push -f $(git_url) master:gh-pages

clean:
	rm -rf $(ghpages)

.PHONY: all clean publish