-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
62 lines (53 loc) · 1.74 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
# Add your markdown sources here
# (do not include path or file extension)
PAPERS = what-is-blue-green-deployment \
cicd-pipeline-a-gentle-introduction \
cicd-continuous-integration-and-delivery-explained \
continuous-blue-green-deployments-with-kubernetes \
continuous-integration-explained \
a-complete-guide-to-making-your-slow-tests-fast \
a-complete-guide-to-making-your-slow-tests-fast-more \
canary-deployments \
what-is-monorepo \
stubbing-and-mocking-with-mockito \
cicd-interview \
testing-python-with-pytest \
dockerizing-django \
dockerizing-php \
java-with-spock \
a-first-look-at-bun \
building-rest-api-go-and-mux \
dockerizing-nodejs \
deploy-go-web \
ios-cicd \
5-options-to-deploy-microservices
PAPERDIR = papers
BUILDDIR = build
export YEAR = $(shell date +'%Y')
export MONTH = $(shell date +'%b')
export REVISION = $(shell git rev-parse --short HEAD)
# handle non-intel archs (eg. Apple M1)
EXTRA_OPTS =
ARCH = $(shell arch)
ifeq ($(ARCH),arm64)
EXTRA_OPTS += --platform linux/amd64
endif
.PHONY: pdf clean
# `make pdf` target for all PDFs generated in $(PAPERS)
pdf: $(addprefix build/pdf/,$(addsuffix .pdf,$(PAPERS)))
clean:
rm -rf $(BUILDDIR)
# builds intermediate markdown files with __BUILD_* variables interpolated
$(BUILDDIR)/md/%.md: $(PAPERDIR)/%.md
mkdir -p $(BUILDDIR)/md
sed -e "s/__BUILD_MONTH__/${MONTH}/g;s/__BUILD_YEAR__/${YEAR}/g;s/__BUILD_REVISION__/${REVISION}/g" $< > $@
# builds PDF using pandoc and docker
$(BUILDDIR)/pdf/%.pdf: $(BUILDDIR)/md/%.md
mkdir -p $(BUILDDIR)/pdf
docker run --rm $(EXTRA_OPTS) \
--volume `pwd`:/data -w /data pandoc/latex:2.10 \
--pdf-engine=xelatex \
-f markdown+implicit_figures \
-d pdf-options.yml \
--resource-path=$(PAPERDIR) \
-o /data/$@ $^