-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (52 loc) · 1.92 KB
/
Makefile
File metadata and controls
62 lines (52 loc) · 1.92 KB
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
SHELL=/bin/bash
SRC = _src
CV_TEX := $(SRC)/cv.tex
CV_MD := index.md
SPELL := $(shell command -v aspell 2> /dev/null)
CACHE_FOLDER := /opt/build/cache
TEXLIVEDIR := $(CACHE_FOLDER)/texlive
TEXLIVE_BIN := $(TEXLIVEDIR)/bin/x86_64-linux
PATH := $(PATH):$(TEXLIVE_BIN)
.PHONY: texlive pdf md clean spell check
default: pdf md
check:
ifndef SPELL
$(error "Spell check requires aspell")
endif
texlive:
mkdir -p $(CACHE_FOLDER) _texlive-installer $(TEXLIVEDIR)
wget -q http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xf install-tl-unx.tar.gz -C ./_texlive-installer --strip 1
rm install-tl-unx.tar.gz
printf '%s\n' \
"selected_scheme scheme-basic" \
"TEXDIR $(TEXLIVEDIR)" \
"TEXMFLOCAL $(TEXLIVEDIR)/texmf-local" \
"TEXMFSYSCONFIG $(TEXLIVEDIR)/texmf-config" \
"TEXMFSYSVAR $(TEXLIVEDIR)/texmf-var" \
"binary_x86_64-linux 1" \
"tlpdbopt_install_docfiles 0" \
"tlpdbopt_install_srcfiles 0" \
> _texlive.profile
_texlive-installer/install-tl --profile _texlive.profile
tlmgr install parskip titlesec enumitem
pdf: $(CV_TEX)
pdflatex -output-directory $(SRC) $(CV_TEX)
mv $(SRC)/cv.pdf chris-buckley-cv.pdf
md: $(CV_TEX)
cp $(SRC)/cv.md $(CV_MD)
sed -i'.bak' "s/description:.*$$/&$(shell awk -f $(SRC)/summary.awk $(CV_TEX))/" $(CV_MD)
awk -f $(SRC)/cv.awk $(CV_TEX) >> $(CV_MD)
while IFS=: read text link; do \
sed -i'.bak' "s~$$text~[&]({% include mainurl.html %}$${link/ /})~" $(CV_MD); \
done < _data/links.yml
rm $(CV_MD).bak
netlify: texlive md pdf
sub=$$(sed -E 's#https://(.+)--.*#\1#;s/deploy-preview|^main$$/staging/' <<< "$$DEPLOY_PRIME_URL"); \
echo "url: https://cv-$${sub}.cmbuckley.co.uk" >> _staging.yml
bundle exec jekyll build --config _config.yml,_staging.yml
clean:
rm -rf $(CV_MD) cv.* $(SRC)/cv.{aux,log,out,toc}
rm -rf _texlive-installer $(TEXLIVEDIR) _texlive.profile
spell: check $(CV_TEX)
aspell --conf=./$(SRC)/aspell/aspell.conf list < $(CV_TEX) | LANG=C sort -u | (! grep --color=never .)