forked from neverworkintheory/neverworkintheory.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
171 lines (132 loc) · 4.49 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
JEKYLL=bundle exec jekyll
SITE=./_site
ABSTRACT_BIN=./bin/abstracts.sh
AUTHORS_BIN=./bin/authors.py
BIB2YAML_BIN=./bin/bib2yaml.py
YAML2HTML_BIN=./bin/yaml2html.py
YEARS_BIN=./bin/years.py
BIBTEX_BIN=bibtex
LATEX_BIN=pdflatex
STRINGS_BIB=./tex/strings.bib
NWIT_BIB=./tex/nwit.bib
TODO_BIB=./tex/todo.bib
ALL_BIB=${STRINGS_BIB} ${NWIT_BIB} ${TODO_BIB}
UNREVIEWED_TXT=./tex/unreviewed.txt
STRINGS_OPTION=--strings ./tex/strings.bib
AUTHORS_HTML=authors/index.html
BIB_HTML=bib/index.html
TODO_HTML=todo/index.html
YEARS_SVG=files/years-histogram.svg
SUPPORT_FILES=${AUTHORS_HTML} ${BIB_HTML} ${TODO_HTML} ${YEARS_SVG}
PDF=tex/nwit.pdf
CONFIG=_config.yml
INCLUDES=$(wildcard _includes/*.html)
LAYOUTS=$(wildcard _layouts/*.html)
POSTS=$(wildcard _posts/*/*.md)
PAGES=\
atom.xml\
index.html\
about/index.html\
bycategory/index.html\
bydate/index.html\
contributing/index.html
STYLES=$(wildcard _sass/*/*.scss) $(wildcard css/*.css) $(wildcard css/*.scss)
.DEFAULT: commands
## commands: show available commands
commands:
@grep -h -E '^##' ${MAKEFILE_LIST} | sed -e 's/## //g' | column -t -s ':'
## build: rebuild site without running server
build: ${SUPPORT_FILES} ${PDF}
${JEKYLL} build
## serve: build site and run server
serve: ${SUPPORT_FILES}
${JEKYLL} serve
# ---
## authors: cross-reference authors and bibliography entries
authors: ${AUTHORS_HTML}
## pdf: re-create PDF version of bibliography
pdf: ${PDF}
## bib: re-create HTML bibliography of reviewed articles
bib: ${BIB_HTML}
## todo: re-create HTML bibliography of upcoming articles
todo: ${TODO_HTML}
## years: regenerate plot of publication years of reviewed articles
years: ${YEARS_SVG}
## ----
## abstract: get abstract from DOI (DOI=value)
abstract:
@${ABSTRACT_BIN} ${DOI}
## entry: convert single entry (KEY=NameYear) to HTML
entry:
@cat ${STRINGS_BIB} ${NWIT_BIB} ${TODO_BIB} | bin/entry.py ${KEY} _template.html
## pick: select a random entry from the to-do list (YEAR=yyyy optional)
pick:
bin/list.py ${STRINGS_OPTION} --input ${TODO_BIB} --random --year ${YEAR}
## show: show all entries from the to-do list in chronological order (YEAR=yyyy optional)
show:
bin/list.py ${STRINGS_OPTION} --input ${TODO_BIB} --year ${YEAR}
## ----
## categories: list files by category
categories:
@bin/categories.py _posts/*/*.html
## check: run all checks
check:
@make check-ascii
@make check-bib
@make check-dates
@make check-used
## check-ascii: check that all .bib files are 7-bit ASCII
check-ascii:
@bin/check-ascii.py --inputs ${NWIT_BIB} ${TODO_BIB}
## check-bib: check integrity of bibliography
check-bib:
@bin/check-bib.py ${STRINGS_OPTION} --inputs ${NWIT_BIB} ${TODO_BIB}
## check-dates: make sure the dates in posts line up with filenames
check-dates:
@bin/check-dates.py --root _posts
## check-pdf: check that PDFs exist (use PDFDIR=<path>)
check-pdf:
@bin/check-pdf.py ${STRINGS_OPTION} --inputs ${NWIT_BIB} ${TODO_BIB} --pdfdir ${PDFDIR}
## check-used: check which papers have been used or not
check-used:
@bin/check-used.py --pagedir _posts ${STRINGS_OPTION} --used ${NWIT_BIB} --unreviewed ${UNREVIEWED_TXT}
## clean: clean up stray files
clean:
@find . -name '*~' -exec rm {} \;
@find . -name '*.aux' -exec rm {} \;
@find . -name '*.bbl' -exec rm {} \;
@find . -name '*.blg' -exec rm {} \;
@find . -name '*.log' -exec rm {} \;
## sterile: clean up and erase generated site
sterile:
@make clean
@rm -rf ${SITE}
# --------
${AUTHORS_HTML}: ${AUTHORS_BIN} ${NWIT_BIB}
@mkdir -p authors
@echo "---" > ${AUTHORS_HTML}
@echo "layout: page" >> ${AUTHORS_HTML}
@echo "title: Authors" >> ${AUTHORS_HTML}
@echo "---" >> ${AUTHORS_HTML}
@cat ${STRINGS_BIB} ${NWIT_BIB} | ${AUTHORS_BIN} ${UNREVIEWED_TXT} >> ${AUTHORS_HTML}
${BIB_HTML}: ${STRINGS_BIB} ${NWIT_BIB} ${BIB2YAML_BIN} ${YAML2HTML_BIN}
make TITLE="Bibliography" SLUG=nwit bib2yaml > $@
${TODO_HTML}: ${STRINGS_BIB} ${TODO_BIB} ${BIB2YAML_BIN} ${YAML2HTML_BIN}
make TITLE="To Do" SLUG=todo bib2yaml > $@
${YEARS_SVG}: ${NWIT_BIB} ${YEARS_BIN}
${YEARS_BIN} ${STRINGS_OPTION} --input ${NWIT_BIB} --output $@
${PDF}: ${NWIT_BIB} ${TODO_BIB} tex/nwit.tex tex/settings.tex tex/abstract.bst
@cd tex \
&& rm -f nwit.aux nwit.bbl \
&& ${LATEX_BIN} nwit \
&& ${BIBTEX_BIN} nwit \
&& ${LATEX_BIN} nwit \
&& ${LATEX_BIN} nwit
bib2yaml:
@mkdir -p ${SLUG}
@echo "---"
@echo "layout: page"
@echo "title: ${TITLE}"
@echo "---"
@echo '<p><a href="../tex/${SLUG}.bib">BibTeX</a> | <a href="../tex/${SLUG}.pdf">PDF</a></p>'
@cat ./tex/${SLUG}.bib | ${BIB2YAML_BIN} ${STRINGS_OPTION} | ${YAML2HTML_BIN}