-
Notifications
You must be signed in to change notification settings - Fork 145
/
Makefile
63 lines (47 loc) · 1.54 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
# Makefile to build PDF and Markdown cv from YAML.
#
# Brandon Amos <http://bamos.github.io> and
# Ellis Michael <http://ellismichael.com>
WEBSITE_DIR=$(HOME)/repos/website
WEBSITE_PDF=$(WEBSITE_DIR)/data/cv.pdf
WEBSITE_MD=$(WEBSITE_DIR)/_includes/cv.md
WEBSITE_DATE=$(WEBSITE_DIR)/_includes/last-updated.txt
TEMPLATES=$(shell find templates -type f)
BUILD_DIR=build
TEX=$(BUILD_DIR)/cv.tex
PDF=$(BUILD_DIR)/cv.pdf
MD=$(BUILD_DIR)/cv.md
ifneq ("$(wildcard cv.hidden.yaml)","")
YAML_FILES = cv.yaml cv.hidden.yaml
else
YAML_FILES = cv.yaml
endif
.PHONY: all public viewpdf stage jekyll push clean
all: $(PDF) $(MD)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
public: $(BUILD_DIR) $(TEMPLATES) $(YAML_FILES) generate.py
./generate.py cv.yaml
$(TEX) $(MD): $(TEMPLATES) $(YAML_FILES) generate.py publications/*.bib
./generate.py $(YAML_FILES)
$(PDF): $(TEX)
# TODO: Hack for biber on OSX.
rm -rf /var/folders/8p/lzk2wkqj47g5wf8g8lfpsk4w0000gn/T/par-62616d6f73
latexmk -pdf -cd- -jobname=$(BUILD_DIR)/cv $(BUILD_DIR)/cv
latexmk -c -cd $(BUILD_DIR)/cv
viewpdf: $(PDF)
gnome-open $(PDF)
stage: $(PDF) $(MD)
git -C $(WEBSITE_DIR) checkout $(WEBSITE_PDF) $(WEBSITE_MD) $(WEBSITE_DATE)
git -C $(WEBSITE_DIR) pull --rebase
cp $(PDF) $(WEBSITE_PDF)
cp $(MD) $(WEBSITE_MD)
date +%Y-%m-%d > $(WEBSITE_DATE)
jekyll: stage
cd $(WEBSITE_DIR) && bundle exec jekyll server
push: stage
git -C $(WEBSITE_DIR) add $(WEBSITE_PDF) $(WEBSITE_MD) $(WEBSITE_DATE)
git -C $(WEBSITE_DIR) commit -m "Update cv."
git -C $(WEBSITE_DIR) push
clean:
rm -rf *.db $(BUILD_DIR)/cv*