-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
73 lines (54 loc) · 1.75 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
# Makefile to build PDF and Markdown cv from YAML.
#
# Brandon Amos <https://bamos.github.io> and
# Ellis Michael <https://ellismichael.com>
WEBSITE_DIR=$(HOME)/repos/website/chahuja.github.io
WEBSITE_PDF=$(WEBSITE_DIR)/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 stageweb jekyllweb pushweb 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
./generate.py $(YAML_FILES)
$(PDF): $(TEX) publications/*.bib
# 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)
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
stageweb: $(MD)
cp $(MD) $(WEBSITE_MD)
date +%Y-%m-%d > $(WEBSITE_DATE)
jekyllweb: stageweb
cd $(WEBSITE_DIR) && bundle exec jekyll server
pushweb: stageweb
git -C $(WEBSITE_DIR) add $(WEBSITE_MD) $(WEBSITE_DATE)
git -C $(WEBSITE_DIR) commit -m "Update cv."
git -C $(WEBSITE_DIR) push
clean:
rm -rf $(BUILD_DIR)/cv*