-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathMakefile
83 lines (68 loc) · 2.66 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
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
SHA = $(shell git rev-parse --short HEAD)
CONTAINER_SITE_NAME=com.glacier.website
TOC_FILE=_data/docs_toc.yml
SOURCE_DIR=_docs
SOURCE_MD=$(shell find $(SOURCE_DIR) -type f -iname '*.md')
SOURCE_HTML=$(shell find _includes _layouts -type f -iname '*.html')
SOURCE_CSS=$(shell find _sass css -type f -iname '*.scss' -o -iname '*.css')
################################################################################
# Main targets
################################################################################
# Builds the site locally so that you can preview it without pushing to Github
.PHONY: site
site: run-site
# Stops serving the website
.PHONY: stop-site
stop-site: run-stop-site
# Generates a pdf version of the Glacier protocol
.PHONY: pdf
pdf: assets/glacier.pdf
## Runs a spell checker on the sources
.PHONY: spell
spell: run-spell-check
################################################################################
# Utilities
################################################################################
.PHONY: run-site
run-site:
@echo "Deploying website"
@docker run -dit --rm --name $(CONTAINER_SITE_NAME) \
-v "$(shell pwd)":/usr/src/app \
-p 4000:4000 \
starefossen/github-pages:172
@echo "Website running at http://localhost:4000"
.PHONY: run-stop-site
run-stop-site:
@docker rm -f $(CONTAINER_SITE_NAME)
@echo "Site stopped"
# Utility to generate a pdf version of the protocol
assets/glacier.pdf: dockerfiles/bin/.weasyprint $(SOURCE_MD) $(SOURCE_HTML) $(SOURCE_CSS)
./_build/generate_pdf.sh
# Runs a spell checker to make sure your site looks nifty without typos
.PHONY: run-spell-check
run-spell-check: dockerfiles/bin/.spellcheck
@echo "Running spellchecker"
@docker run --rm -t -v "$(shell pwd)":/src spellcheck
# TODO: Add target that removes docker images
.PHONY: clean
clean:
@echo "Cleaning temp files and artifacts"
@rm -rf _site .sass-cache .jekyll-metadata bin
################################################################################
# Build Docker images
################################################################################
dockerfiles/bin/.spellcheck: dockerfiles/spellcheck/Dockerfile dockerfiles/spellcheck/.spelling
@echo "Building Docker image with spellchecker"
@docker build -t spellcheck $(<D)
@mkdir -p dockerfiles/bin
@touch $@
dockerfiles/bin/.weasyprint: dockerfiles/weasyprint/Dockerfile
@echo "Building Docker image with Pandoc and WeasyPrint"
@docker build -t weasyprint $(<D)
@mkdir -p dockerfiles/bin
@touch $@
dockerfiles/bin/.pandoc: dockerfiles/pandoc/dockerfile dockerfiles/pandoc/entrypoint.sh
@echo "Building Docker image with Pandoc"
@docker build -t pandoc $(<D)
@mkdir -p dockerfiles/bin
@touch $@